Hi,
I’m trying to add an additional field to the checkout for a purchase order number. I can get the code below to work fine, but I can’t position it where I want. I’d like it in the location of “woocommerce_review_order_before_payment” but it doesn’t display and breaks that order summary. It will display in “woocommerce_before_checkout_billing_form” or “woocommerce_after_order_notes”. Or anywhere on the left hand side. Is there something in the theme that’s overriding the code? or am I missing something?
Thanks again.
Jon
Code:
/**
* Add the field to the checkout
*/
add_action( ‘woocommerce_before_checkout_billing_form’, ‘my_custom_checkout_field’ );
function my_custom_checkout_field( $checkout ) {
echo ‘<div id=”my_custom_checkout_field”>’;
woocommerce_form_field( ‘my_field_name’, array(
‘type’ => ‘text’,
‘class’ => array(‘my-field-class form-row-wide’),
‘label’ => __(‘Purchase Order Number:‘),
‘placeholder’ => __(‘Enter you PO number here’),
), $checkout->get_value( ‘my_field_name’ ));
echo ‘</div>’;
}