Skip to content

Instantly share code, notes, and snippets.

View jlan155's full-sized avatar

Jodie-Ann Langley jlan155

View GitHub Profile
@paaljoachim
paaljoachim / functions.php
Last active March 7, 2023 18:50
WooCommerce: Adding multiple custom fields to the order notes area in the checkout page
/* 1. Adds a custom field. NB. I am using some Norwegian words in the below text.
* 2. Then adds a validate error message if person does not fill out the field.
* 3. Then adds the custom field to the order page.
https://businessbloomer.com/woocommerce-add-custom-checkout-field-php/
https://businessbloomer.com/woocommerce-add-shipping-phone-checkout/
https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/#section-6
*/
add_action( 'woocommerce_before_order_notes', 'my_custom_checkout_field' );
function my_custom_checkout_field( $checkout ) {