Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1440371

    Hello , we have installed Discount Rules for WooCommerce – PRO → ID # 20 2.6.3,
    I am trying to setup a discount based on the Payment Method as a 20% discount on Direct Bank Transfer. Default Payment method is PayPal. If I am in checkout page and I click on the Direct Bank Transfer checkbox nothing happens. If I change something else, like the region or province in the address, then there is an AJAX reload in the background and the discount is displayed correctly. But if I change back to Paypal, after the discount has been applied, the discount remains there.
    Checkout page is the standard Enfold page.
    Theme is Enfold 5.7 and everything has been updated to the latest version a few days ago.
    There is something that can be adjusted to allow AJAX reload also on payment method change?
    Thank you
    Mauro

    #1440424

    Hey profumopuntoit,
    Unfortunately I’m not able to test or support your paid plugin, but in my past experience the ajax reload on the cart page is fired by the woocommerce plugin.
    I found this snippet that seems to force a ajax reload when the payment type is changed on my demo site, perhaps it will also work or your site too.
    Try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    add_action( 'woocommerce_review_order_before_payment', 'ajax_refresh_payment_method' );
    function ajax_refresh_payment_method(){
        ?>
        <script>
            (function($){
                $( 'form.checkout' ).on( 'change', 'input[name^="payment_method"]', function() {
                    $('body').trigger('update_checkout');
                });
            })(jQuery);
        </script>
        <?php
    }

    Best regards,
    Mike

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.