Additional checkout payment gateway field for Authorize.net in Woocommerce

大兔子大兔子 提交于 2019-12-13 03:05:16

问题


I'm trying to add an additional field inside the Authorize.net Payment Gateway plugin for WooCommerce.

The following code will add a field into a default gateway, like COD or BACS. This solution was found here.

if( 'cod' === $payment_id ){
    ob_start(); // Start buffering

    echo '<div  class="bacs-options" style="padding:10px 0;">';

    woocommerce_form_field( 'bacs_option', array(
        'type'          => 'text',
        'label'         => __("Fill in this field", "woocommerce"),
        'class'         => array('form-row-wide'),
        'required'      => true,
        'options'       => array(
            ''          => __("Select something", "woocommerce"),
            'Option 1'  => __("Choice one", "woocommerce"),
            'Option 2'  => __("Choice two", "woocommerce"),
        ),
    ), '');

    echo '</div>';

    $description .= ob_get_clean(); // Append buffered content
}
return $description;

This exact code works great for cod or bacs but when I change if( 'cod' === $payment_id ) to if( 'authorize_net_cim_credit_card' === $payment_id ) only the label shows up with an empty wrapper where the input should be. (see image below)

Any idea why this is happening and how to fix it?

来源:https://stackoverflow.com/questions/59185457/additional-checkout-payment-gateway-field-for-authorize-net-in-woocommerce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!