Hiding checkout options
-
Hi,
I have coded custom button to my checkout form. Now I want to hide it if Order exceeds 299 €. I have tried everything I found but nothing is working.
Now I’m going with this one:
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' ); add_action( 'woocommerce_before_cart' , 'wc_minimum_order_amount' ); function wc_minimum_order_amount() { // Set this variable to specify a minimum order value $minimum = 299; if ( WC()->cart->total > $minimum ) { add_action('woocommerce_after_order_notes', 'my_custom_checkout_field'); function my_custom_checkout_field( $checkout ) { echo '<div id="my-new-field"><h3>'.__('AutoSound-lehti: ').'</h3>'; woocommerce_form_field( 'my_checkbox', array( 'type' => 'checkbox', 'label' => __('Haluan ottaa vastaan AutoSound lehden vuosikerran, jonka JJ-Tuonti Oy lahjoittaa minulle. Ymmärrän, että lahjatilaus jatkuu kestotilauksena ensimmäisen vuosikerran jälkeen ja jos en itse sitä irtisano riittävän ajoissa, joudun itse maksamaan lehden tilausmaksun uudesta tilausjaksosta eteenpäin.'), 'required' => false, ), $checkout->get_value( 'my_checkbox' )); echo '</div>'; } } }
- The topic ‘Hiding checkout options’ is closed to new replies.