Support » Plugin: WooCommerce » Have a Checkbox on the Checkout Page Which Updates the Order Totals

  • I added a checkbox in the checkout page and i need to update the total with checkbox’s value, if checked.

    I suppose i should use Jquery but where to do this ? In functions.php ?

    thanks

    function action_woocommerce_review_order_before_payment( ) {

    $myvar=3;//for example
    echo ‘<h4>Options</h4>’;

    woocommerce_form_field( ‘my_cbox’, array(
    ‘type’ => ‘checkbox’,
    ‘class’ => array(‘input-checkbox’),
    ‘label’ => ‘Garantie tranquillité ‘. $myvar.’€ pour ‘.$duration.’ nuit(s)’,
    ‘required’ => false,
    ), $myvar);

    }}

    add_action( ‘woocommerce_review_order_before_payment’, ‘action_woocommerce_review_order_before_payment’, 10, 0 );

  • The topic ‘Have a Checkbox on the Checkout Page Which Updates the Order Totals’ is closed to new replies.