Last active
December 22, 2024 17:13
-
-
Save helpercode0/c32915b37d14bf723c6c6191adb832f1 to your computer and use it in GitHub Desktop.
Add Field in Checkout Woocommerce Block Programmatically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( | |
'woocommerce_init', | |
function() { | |
woocommerce_register_additional_checkout_field( | |
array( | |
'id' => 'namespace/delivery-date-id', | |
'label' => 'Delivery Date', | |
'optionalLabel' => 'Delivery Date (optional)', | |
'location' => 'address', | |
'required' => true, | |
'attributes' => array( | |
'autocomplete' => 'delivery-date-id', | |
'aria-describedby' => 'some-element', | |
'aria-label' => 'custom aria label', | |
'title' => 'Title to show on hover', | |
'data-custom' => 'custom data', | |
), | |
), | |
); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment