Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Njengah/efb43334af69ad53b09b7bf6088f5e99 to your computer and use it in GitHub Desktop.
Save Njengah/efb43334af69ad53b09b7bf6088f5e99 to your computer and use it in GitHub Desktop.
Code snippet to create order comments field.
<?php
//Create order comments field
if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
$fields = WC()->checkout->checkout_fields['billing'];
} else {
$fields = WC()->checkout->get_checkout_fields( 'billing' );
}
woocommerce_form_field(
'order_comments',
$fields['order_comments'],
WC()->checkout->get_value( 'order_comments')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment