• Amazing little tweak to the built-in coupon codes.
    I had to add this code to my functions.php for the discount to refresh when changing payment typ:

    //Update the cart preview when payment method is changed by the customer
            add_action( 'woocommerce_review_order_after_submit' , function () {
            	?><script type="text/javascript">
            		jQuery(document).ready(function($){
            			$(document.body).on('change', 'input[name="payment_method"]', function() {
            				$('body').trigger('update_checkout');
            				$.ajax( $fragment_refresh );
            			});
            		});
            	</script><?php
            } );

    Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Author Soft79

    (@josk79)

    Thanks for sharing the tweak! It could also be done through the theme as stated in the FAQ:

    In your theme add class “update_totals_on_change” to the container (div / p / whatever) that holds the payment method radio buttons.
    You can do this by overriding woocommerce/templates/checkout/payment.php (place it in your_template/woocommerce/checkout/).

Viewing 1 replies (of 1 total)
  • The topic ‘Easy as ABC’ is closed to new replies.