Support » Plugin: YITH WooCommerce Subscription » Add to cart button issue

  • Hi,

    Hi i am using your plugin and have created subscription plans, also I am using direct checkout when client click on add to cart button.

    When i choose the first time a subscription plan it is working good, it add product to cart and redirects me to checkout page, but if a client do not place order checkout and return to shop page to choose other subscription plan it does not work.

    Here is a video error I’m facing

    I need your plugin to empty cart with old item if there is any on a cart after i click Choose Plan (or add to cart button).

    Can you help me. If you could fix this strange error i will buy premium version of this plugin.


    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Salvatore Strano


    Hi @besifab
    Our plugin not empty the cart, you need to a custom solution for this

    Thread Starter besifab


    Yes, but this is essential to work your plugin. what if a customer want to change plan and not continue with that, he don’t complete checkout page data and get back for other option, it shows error adding second subscription plan in a cart. Client should have opportunity to go with the last plan subscription he choosed. Maybe you are not understanding what I mean it has error with default woocommerce shop plugin. This is esential

    Plugin Support Salvatore Strano


    Hi @besifab
    I understand your problem, but unfortunately the plugin not allow to add more subscription in the cart at same time.

    Thread Starter besifab


    I don’t want to add more than one subscription at the same time, just to change subscription after the last one was added to cart.

    Thanks for trying to help me but seems we have to find a better solution, this is not working

    I’m having the same issue!
    The add to cart button is not working, just the same as yours. Cany ou help us?

    Hello @besifab
    I think I’ve found out a solution for this problem.
    As the error has to do with the cart – because it doesn’t allow you to add more than one subscription at the same time besides you are only buying one – you need to make the cart empty before adding another subscription. For that, I used this code:

    add_action( 'wp_head', 'wc_clear_cart' );
    function wc_clear_cart() {
        if ( wc_get_page_id( 'cart' ) == get_the_ID() || wc_get_page_id( 'checkout' ) == get_the_ID() ) {
        WC()->cart->empty_cart( true );

    This empty cart every time a page is loaded except the cart and checkout pages.
    For me, this works perfectly. Hope this can help you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Add to cart button issue’ is closed to new replies.