问题
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