- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Magento2 Varnish 4, group/special pricing
I'm stumped on this one and can't find a solution; there are similar questions/solutions but for Magento 1.x
We've had Varnish 4 working great since M2.0.1 - that is, without using group pricing. Everything works fine (varnish purges, caches etc) and fast but as soon as a customer from a special group logs in, their prices are cached only to confuse the next visitor when they check out (aka go to a secured portion of the site).
For example: standard visitors pay $20/unit, Gold customers $15. If a Gold customer logs in, views products etc, the next visitor will automatically see $15/unit instead of $20. When this next visitor goes to the cart it shows the proper pricing of $20 which is an issue.
I don't know enough programmatically what I'm looking for so my question is, could this be a theme/template issue where price blocks are supposed to be a cacheable/non-cacheable block? And/or has anyone experienced this when using group pricing AND regular visitor pricing?
Any pointers would be appreciated.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento2 Varnish 4, group/special pricing
Disregard this message - I can't delete my own post. I disabled FPC and all works as it should.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento2 Varnish 4, group/special pricing
Hi, I'm having the same issue here.
Magento 2.1.3.
Disable the FPC is not best solution I think. Because it will just make the site heavy to load. So we should not disable the FPC on live site.
Does anyone have a solution for this issue?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento2 Varnish 4, group/special pricing
you need to do customer group wise caching.
Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento2 Varnish 4, group/special pricing
The Vary HTTP header is used to allow a cache to distinguish between different types of content.
However, Magento 2 also has additional Vary-like behaviour that allows store/customer specific content to be differentiated in the cache. This is achieved by setting a cookie called X-Magento-Vary, which is then used as part of the VCL hash.
... sub vcl_hash { if (req.http.cookie ~ "X-Magento-Vary=") { hash_data(regsub(req.http.cookie, "^.*?X-Magento-Vary=([^;]+);*.*$", "\1")); } ...
Check your VCL for this rule. Do you have one varnish or many?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento2 Varnish 4, group/special pricing
I have a similar problem in Magento 2.3.1 but I do not have varnish installed. I have special prices for a group and sometimes they show themselves well and sometimes they do not and it's very confusing. How can i fix this?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento2 Varnish 4, group/special pricing
Yes, 2.3.2, even not logged in users are sometimes getting group-based tier prices, even int heir shopping carts.
It looks like the prices themselves are cached too somehow regardless of the customer group of the current user.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento2 Varnish 4, group/special pricing
Experiencing the same where prices are getting cached and shown to wrong groups.