0

Using Drupal Commerce 2 in Drupal 8.8, if an unregistered user puts something in the cart (and doesn't check it out) another unregistered user sees these items in Cart block (provided by view (order)). They aren't shown to the users on the /cart page.

1

The reason for the behavior described above is that in Views I changed the advanced option context filter - order id - for "if there is no value for the context filter" from: "static" (the option after installation, which had the effect that no cart was shown at all) to "show all results" (with the effect described above).

I found this link https://www.drupal4u.org/howtos/how-hide-empty-shopping-cart-drupal-commerce saying the correct value would be "Current user's cart order ID", but this was not available. I'm not sure if this is a bug, if things changed for Commerce 2 or if I configured something wrong.

| improve this answer | |
0

Without know your specific site, it's hard to say what the culprit is, but this sounds like a pretty typical caching issue. Ultimately, you need to prevent Drupal from caching pages or page elements rendered for anonymous users with shopping carts.

| improve this answer | |
  • When I use the button "clear all caches" the problem remains. Is this an indication that it is not a cache issue or is this a matter of a different level of cache? – paul77 May 13 at 18:15
  • Even if you clear the cache, as soon as someone visits the page again, it will be re-cached with whatever their cart contents are and then visible for all to see. I'm not versed enough in all the options for cache invalidation, so I'll see if someone else can chime in - but you basically need to get to a point where this element isn't being cached at all. – Ryan Szrama May 14 at 17:27
  • If somebody had any idea how to prevent this element from being cached, I would really appreciate it. My first step war to configure order types that an abandoned cart will be cleared after two hours to mitigate the problem. – paul77 May 14 at 20:14
  • I deinstalled the core module Internal Dynamic Page Cache the only cache module that was installed, but it didn't change the site's behaviour. – paul77 May 21 at 18:28

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.