I went through Save and display specific payment gateway additional field everywhere in Woocommerce that displays an additional dropdown field for specific payment gateway in checkout page. But I need to show a text box instead of the drop down menu and save and show in orders, emails etc.
I have edit the code from the above link and made changes according to my ipg plugin, but it doesn't show.
add_filter( 'woocommerce_gateway_description', 'gateway_digitalipg_custom_fields', 20, 2 );
function gateway_digitalipg_custom_fields( $description, $payment_id ){
//
if( 'digitalipg' === $payment_id ){
ob_start(); // Start buffering
echo '<div class="digital-ipg" style="padding:10px 0;">';
woocommerce_form_field( 'digital-ipg', array(
'type' => 'select',
'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;
}
the output was nothing i dont see any dropdowns on the cart when i select my ipg