• Resolved bt_dev

    (@biotrace)


    Hello – We are using a code snippet to add a credit card fee to a particular payment method and it is dependent on Javascript being enabled. Is there an alternative method of updating the checkout without using Javascript? Here is the code snippet we currently use for refreshing checkout.

    add_action( 'woocommerce_review_order_before_payment', 'bt_refresh_payment_method' );
    
    function bt_refresh_payment_method(){
        // jQuery
        ?>
        <script type="text/javascript">
            (function($){
                $( 'form.checkout' ).on( 'change', 'input[name^="payment_method"]', function() {
                    $('body').trigger('update_checkout');
                });
            })(jQuery);
        </script>
        <?php
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @biotrace, thank you for reaching out

    I’m not sure if I understand what you’re trying to achieve.

    Could you provide us with the URL of the checkout page and further details, such as the particular payment method you’re using, and what should trigger the price change?

    Thanks

    We haven’t heard back from you in a while, so I’m marking this thread as resolved – we’ll be here if and/or when you are ready to continue.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Is there a way to refresh checkout without Javascript?’ is closed to new replies.