【问题标题】:Woocommerce - My account -Add Payment Method not workingWoocommerce - 我的帐户 - 添加付款方式不起作用
【发布时间】:2019-11-16 18:35:22
【问题描述】:

我很困惑为什么$_POST(gateway-id-card-number) 以及到期和 CVV 没有从我的帐户页面的表单中发布?

结帐表格由$this->form根据https://docs.woocommerce.com/wc-apidocs/class-WC_Payment_Gateway_CC.html生成

相同的表格在我的帐户页面中,但不起作用。 该帖子发生在结帐页面中,但在我的帐户页面中该帖子没有发生。

显示的错误是提交到帖子的所有字段都是空的。请帮忙

类似的问题: https://wordpress.org/support/topic/problem-with-tokenization-developing-a-custom-gateway/

【问题讨论】:

    标签: php wordpress class woocommerce payment-gateway


    【解决方案1】:

    如果有人对此有问题

    /**
         * Output field name HTML
         *
         * Gateways which support tokenization do not require names - we don't want the data to post to the server.
         *
         * @since  2.6.0
         * @param  string $name Field name.
         * @return string
         */
        public function field_name( $name ) {
            return $this->supports( 'tokenization' ) ? '' : ' name="' . esc_attr( $this->id . '-' . $name ) . '" ';
        }
    

    【讨论】:

    • 这个答案不清楚,这是需要修改的功能吗?一个钩子?这段代码是什么?如何应用它来解决手头的问题?
    • @ZacharyCraig 这段代码来自 woo commerce 核心。这并不能解决我的问题,但 woocommerce 默认表单不允许发布数据。因此,如果我想使用过滤器,我可以调整代码。也许我的方法是错误的。我仍然对 add_payment_method 以及它如何保存信用卡感到困惑。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-03-16
    • 2018-02-03
    • 2017-08-13
    • 2016-11-17
    • 2018-03-31
    • 2018-08-30
    相关资源
    最近更新 更多