• Resolved c_dilla

    (@c_dilla)


    If I have the standard [product_page id=”{{product_id}}”] in the WooCommerce Pay Per Post settings and visit a protected page and click on “Add to cart” I get redirected to a 404 error on “mydomain.com/my_page/null” and then when I click back and “Add to cart” again I get “You cannot add another ‘product_name’ to your cart” together with “‘product_name’ has been added to your cart.”

    It might be working but it seems like some kind of bug when you have to click “Add to cart” twice. Is this a problem with WooCommerce 3.2.3?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Matt Pramschufer

    (@mattpramschufer)

    Hurm.. sounds like a WC issue with your install. The PPP plugin uses the standard WC Shortcodes. If you put the shortcode [product_page id='ONE_OF_YOU_PRODUCT_IDs'] on a blank page or post. Does that still produce your same issue?

    Thread Starter c_dilla

    (@c_dilla)

    Okay, I’m not sure how you mean but if I put the shortcode [product_page id='ONE_OF_YOU_PRODUCT_IDs'] on a post that is NOT protected the “Add to cart” button works straight away but not if the post is also protected or if I put the shortcode in the “Oops, page restricted” text box.

    If I protect this page: https://skoinfo.se/kop-travtips/ for example with the shortcode in the “Oops, page restricted” text box,
    and you click “Add to cart”, what happens?

    Plugin Author Matt Pramschufer

    (@mattpramschufer)

    Sounds like you have some issues with caching going on. If you look at your source and you search for cart_url you will see on your site it shows up as `<script type=’text/javascript’>
    /* <![CDATA[ */
    var wc_add_to_cart_params = {“ajax_url”:”\/wp-admin\/admin-ajax.php”,”wc_ajax_url”:”https:\/\/skoinfo.se\/?wc-ajax=%%endpoint%%”,”i18n_view_cart”:”View cart”,”cart_url”:null,”is_cart”:””,”cart_redirect_after_add”:”yes”};
    /* ]]> */
    </script>`

    Someone reported same issue back in 2016 on WooCommerce GitHub and it was related to caching – https://github.com/woocommerce/woocommerce/issues/12593

    Thread Starter c_dilla

    (@c_dilla)

    Okay, I was a bit confused since I don’t have any cache plugins installed or even the default WordPress cache enabled as far as I can tell. I think that it’s working again anyway and it seems like it was the “Add to cart behaviour->Enable AJAX add to cart buttons on archives” in the WooCommerce settings that caused the problem.

    The “Add to cart” redirect behaviour is still a bit weird though since the “Add to cart behaviour->Redirect to the cart page after successful addition” doesn’t seem to work as it should. If you for example go to https://skoinfo.se/kop-travtips/ and click “Add to cart” and then go back to https://skoinfo.se/kop-travtips/ again the “Add to cart” button doesn’t send you through anymore when you already have the product in your cart.

    Sorry if this is WooCommerce problems and beyond the realm of support for your plugin but it would be great if everything worked. I guess you could always have the cart in the sidebar or something. I’m looking forward to when you instead of the product table underneath the posts and pages simply had a shortcode like Enter content here [woocommerce-payperpost id='ONE_OF_YOU_PRODUCT_IDs'] Protected content here[/woocommerce-payperpost] where you could protect whichever part of the content that you wanted to.

    • This reply was modified 7 years, 4 months ago by c_dilla.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘You cannot add another product to your cart’ is closed to new replies.