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.