Support » Plugin: WP Super Cache » 1.6.8 Broke Woocommerce Cart Widget with PHP Add to Cart on Custom Template

  • Resolved linux4me2


    I’m using WP 5.2.2 and Woocommerce 3.6.4 with WP Super Cache 1.6.8.

    I have a custom template that allows customers to configure a product. The page submits the form to itself, and uses PHP to handle adding the product to the Woocommerce cart. There is a Woocommerce Cart widget in the sidebar, that prior to v. 1.6.8 of WP Super Cache, updated when the customer submitted the form.

    After updating to v. 1.6.8, a not-logged-in user can add the product and receive the message that the product was successfully added to the cart; however, the Cart widget and the shopping cart page do not show the product. There are no javascript or PHP errors. If the user is logged in, the product is added to the cart, but doesn’t show up in the Cart widget unless the user navigates away from and back to the page.

    I saw this post, and tried changing “Disable caching for visitors who have a cookie set in their browser” to “Disable caching for logged in visitors.” That helped some, in that the Cart widget updates as it should when a product is added for not-logged-in users, but if a user is logged in, the Cart widget doesn’t update unless they navigate away from and back to the page.

    If I roll back to v. 1.6.7 of WP Super Cache, everything works fine for logged-in and not-logged-in users, the product is added, the Cart widget updates, and all is good.

    How can I fix this?

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


    I did some more testing, and here’s a strange twist. I get issues with my custom template add to cart and the Cart Widget with WP Super Cache deactivated or uninstalled as well as with WP Super Cache 1.6.8 installed, which means the proper functioning of the custom template’s add to cart was dependent on WP Super Cache 1.6.7 and earlier, on which it was developed, which means I probably have an issue with my code, and it’s not WP Super Cache’s new version.



    This stuff never gets boring. 🙂

    The fix was to move my Woocommerce add to cart above the:

    get_header(); ?>

    in my custom template. Now, with WP Super Cache v. 1.6.8 and “Disable caching for logged in visitors” checked, both logged-in and not-logged-in users can successfully use a page based on the custom template to add products to the cart and the Cart widget updates correctly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘1.6.8 Broke Woocommerce Cart Widget with PHP Add to Cart on Custom Template’ is closed to new replies.