Insert custom field in woocommerce checkout page (solved)

im trying to insert custom drop-down before place-order that can be anywhere between:
woocommerce_review_order_after_order_total and woocommerce_review_order_before_submit this drop-down will be carried to order-details as well as invoice too. but im getting error:

add_action( 'woocommerce_review_order_before_payment', 'custom_dropdown_before_submit', 10 );
function custom_dropdown_before_submit(){
  echo '<h2>'.__('Next Day Delivery').'</h2>';

            woocommerce_form_field( 'daypart', array(

                'type'          => 'select',

                'class'         => array( 'custom-drop' ),

                'label'         => __( 'Delivery options' ),

                'options'       => array(

                    'blank'             => __( 'Select a day part', 'custom' ),

                    'morning' => __( 'In the morning', 'custom' ),

                    'afternoon'           => __( 'In the afternoon', 'custom' ),

                    'evening' => __( 'In the evening', 'custom' )

                )

 ),

            $checkout->get_value( 'daypart' ));
}



as payment will cash on delivery only

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.