Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When using the documented method for loading an Order Item:
$order_item = \Drupal\commerce_order\Entity\OrderItem::load($order_item_id);
The Order Item loaded is a cached instance for anonymous users.
Steps to reproduce:
- Anonymous user adds an item to their cart
- Cart is deleted on backend by admin
- Order Item is loaded using above snippet as the anonymous user
- Order Item still exists, even though it was deleted
Is this a bug?
If not, is there a way to load the order item directly (uncached)?
Comments
Comment #2
bojanz CreditAttribution: bojanz at Centarro commentedThere is no such caching on the Entity API level.
Your page might be cached a level above. You'll have to investigate.
Comment #3
3CWebDev CreditAttribution: 3CWebDev commentedYou were correct. The form where the logic resided was caching the entity.
Setting:
Resolved my issue.
Thank you.
Comment #4
3CWebDev CreditAttribution: 3CWebDev commented