• Resolved webchina

    (@webchina)


    Hi!

    I created one coupon to one product and an specific payment method. If I place this payment method first in the list of payment methods of checkout page, then discount is calculated because takes it by default, but if I select other payment method then price is not actualized.
    In the other hand, if I place this payment method in other position of the list (Woocommerce don’t take it as default) then when I choose it the discount don’t apply.

    Could you help me with this?

    Thanks in advance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter webchina

    (@webchina)

    Really, when I select another payment method and click in checkout, this message appear and it’s impossible to buy:

    “Sorry, it appears that the coupon “name of coupon” is invalid – it has been removed from your order.”

    Ckeckout page is reloaded without the discount, but if I click in checkout button the page it’s loaded again with the same message.

    Plugin Author Soft79

    (@josk79)

    Append this snippet to functions.php:

    
    //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 
    } );
    
    Thread Starter webchina

    (@webchina)

    Thanks for your reply. I put the code and it seems to reload the section of the checkout but when I change the payment method it continues to subtract the value of the coupon.

    Plugin Author Soft79

    (@josk79)

    Please send me your coupon settings and an url to reproduce the issue.

    Thread Starter webchina

    (@webchina)

    Url is: https://www.chinarodriguez.com/crea-tu-propia-marca/

    You have to click on “Realizar tu pago” button to add the product to cart and go to checkout page.

    Coupon settings:

    Percentage discount
    Coupon amount: 20
    Product #2392
    Apply without message

    Thanks!

    Plugin Author Soft79

    (@josk79)

    What is the coupon code, please? If you don’t want to publish it here, you can send it to admin at soft79.nl.

    There are some errors on your page as well:
    “POST https://api.mercadopago.com/modules/tracking/checkout?token=&referer=https%3A//www.chinarodriguez.com 400 (Bad Request)”

    but probably not related.

    Plugin Author Soft79

    (@josk79)

    Solved. The user’s functions.php had a conflicting snippet that disabled coupons on cart/checkout page.

    • This reply was modified 7 years, 9 months ago by Soft79.
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Auto coupon with one payment method don’t works fine in checkout’ is closed to new replies.