2

To start I want to make it clear that this is not the old 'price rules disappear at midnight' question - I have all that set up properly. This is a little stranger.

I have a Catalog Price Rule set in Magento 2.2.5 that will give all customers in the a specific customer group a percentage off the price of all items except for those in a particular category.

When the customer logs in, everything looks good - the special price is shown on category and product view. But when they add just one product to the shopping cart, things start to go wrong. The special price is not shown in the cart, instead the full price is shown. And from here on out, the product and category views are also showing the full price again - it's as though the session has lost the value for customer group, because the only way I can get the special price to show consistently is to also apply it to the default customer group.

The value of $product->getFinalPrice() changes in each case, so it is no longer applying the Catalog Price Rule.

I have run a couple of queries to ensure the rule is being saved in the database, but each returns what you would expect.

SELECT
    *
FROM
    catalogrule_product_price
WHERE
    product_id = 'YOUR_PRODUCT_ID' AND website_id = 1

This returns the correct discounted price for the product with entries for the current date.

SELECT
    product_id
FROM
    catalogrule_product
WHERE
    rule_id = 1

This returns a list of products that the rule applies to, and I have verified that the product I am testing this on is in that list.

All that said, I'm rather stuck. Has anyone encountered anything like this before? I've tried to step through the code but I haven't had any luck finding it.

  • I observed this last night as well at midnight. Something occured to me that had not before, but I'm not a Varnish expert, but here is my theory. Since the site goes through a large reindexing process at midnight, I'm wondering if the health probe of varnish is failing out trying to reach the server before the timeout setting (default 2 seconds) and then serving stale content via grace mode again. My symptoms were the same, briefly okay, and then reverts back to stale, so this is all I can think of. – ladle3000 Sep 5 '18 at 18:53
  • I am also on 2.2.5 – ladle3000 Sep 5 '18 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.