Last active
April 1, 2024 13:42
-
-
Save mikeott/24618f6b770ae34e00580522d804125c to your computer and use it in GitHub Desktop.
Add custom radio buttons to Woo checkout
Your email notification code is not working since you made a mistake. Working code:
add_filter( 'woocommerce_email_order_meta_fields', 'add_delivery_option_to_emails' , 10, 3 );
function add_delivery_option_to_emails ( $fields, $sent_to_admin, $order ) {
$delivery_option = get_post_meta( $order->get_id(), '_delivery_option', true );
if ( '' != $delivery_option ) {
$fields[ 'Delivery Date' ] = array(
'label' => __( 'Delivery Option', 'delivery_option' ),
'value' => $delivery_option,
);
}
return $fields;
}
@lensbreak You're correct. I left out a condition in the add_delivery_option_to_emails()
function that decides how to return the $order_id
variable, based on your version of WooCommerce. Even though I have it in my production code, I seem to have somehow removed/forgotten it in this gist by accident. I've updated it now.
Props for pointing it out.
Bump on a old thread. How can I create additional radio buttons next to the terms and conditions at check out page using code snippets. Anybody know the exact code I would use?
It should look like the link here: https://imgur.com/a/VyUKEoj
@brock39 Your link is a 404
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello
I like your code. I need help with customization. I want individual options to have $ value that will be added to the order. Can you show me how to do it?