WordPress.org

Forums

W3 Total Cache
[resolved] Page cache Settings to allow Dynamic Price changes in Woocommerce (4 posts)

  1. lickthespoon
    Member
    Posted 1 year ago #

    Hello,

    Could anyone please advise on a cache setting for the following scenarion...
    I have woocommerce and also IgnitWoos Wholesale Plus plugin. Some products have retail prices and others have Wholesale prices.
    If a Wholesale user is logged in the page serves up the Wholesale priced products.
    If the Wholesale user logs out the user is served the retail price settings.
    I have caching enabled
    My problem is when a wholesale user logs in with the wholesale_buyer role I have to refresh the browser page to see the new products and pricing.
    If I disable page caching it goes away.
    Is there a way of making the act of a user logging in or loggin out flush the cache on the woocommerce product pages - or something like that?
    It seems to be the page caching which is the issue as essentially the same page is served but with different dynamic content depending if a wholesale buyer is logged in.

    Thank you - its' a great plugin and hence well worth working out how to configure it properly.

    https://wordpress.org/plugins/w3-total-cache/

  2. Watch Teller
    Member
    Posted 1 year ago #

    Dynamic website cannot fully benefit from full page cache unless to use fragment cache. Same like other WooCommerce baddies here. If have add new plugin and upgrage new version WooCommerce (change to new code), we have to come back here find solutions.

    1. If your plugin serve cookie, you can TRY reject cache cookie at w3tc database setting;
    2. If you have login and logout cached, you can TRY don't cache pages for following user role for customers.
    3. For the both options above, definitely need configure the browser HTML cache, especially expires header lifetime to zero (0) and cache control header to public cache must revalidation proxy must revalidation. This also related page cached issue.

    If I were you TRY Options 3 only > Options 2 only > Options 1 only > Options 3 & 2 only>2 & 1 only>3 & 1 only>3 & 2 & 1. Please remeber clear all cache and your browser cache for each TRY.

    If solved your issue. Please marked resolved to help other WC baddies here.

  3. lickthespoon
    Member
    Posted 1 year ago #

    Thank you, I will try your excellent suggestions on my test site and report back how I get on.

  4. lickthespoon
    Member
    Posted 1 year ago #

    Thank you for your suggestions.
    To recap I am using the IgniteWoo Wholesal and Wholesale Plus plugin.
    Both serve different prices depending if a user is logged in with a Wholesale user role. My problem was when enabling the page cache and then logging in as a wholesale user the browser still shown the retail pricing until a browser refresh occurred.

    The trick seemed to be to set the Browser HTML cache - header lifetime to zero (0) and cache control header to public cache must revalidation proxy must revalidation. I also set the don't cache pages for Wholesale User role - though i'm not sure if that is 100% necessary.

    As suggested it is very important to purge the browser cache before testing using ctrl-f5.
    I have yet to retest how fast the changes are, but certainly looking at pingdom history when i disabled the page cache my time went from 2 to 4 seconds.

    As an aside there does seem to be some funnies with the Ignite woo plugin VAT setting and being logged in as an administrator. to test properly I found i needed to sign out as an administrator, clear the browser cache, then try logging in and out between wholesale and retail roles.
    I hope that helps - I guess a similar setup may apply for many dynamic pricing situations.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • W3 Total Cache
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic