I have been scratching my head all day. I would like to add a custom checkbox within order review before placing order. Here is my code:

add_action( 'woocommerce_checkout_order_review', 'my_checkbox' );

   function my_checkbox( $checkout ) {
   echo '<div class="my_split_checkbox"><h2>' . __('Split Order', 'woocommerce') .'</h2>';

   woocommerce_form_field( 'my_split_checkbox', array(
'type'          => 'checkbox',
'class'         => array('checkbox_field'),
'label'         => __('Split Order', 'woocommerce'),
'required'  => false,
), $checkout->get_value( 'my_split_checkbox' ));

   echo '</div>';
}

but the page doesn’t fully load. However if I replace the hook by

add_action( 'woocommerce_after_checkout_billing_form', 'my_checkbox' );

then the chekbox shows at the end of billing details with no issues. How can I get the textbox to show within checkout order review? Ideally after table .woocommerce-checkout-review-order-table.

Read more here: Add custom checkbox to woocommerce_checkout_order_review


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: