Problem/Motivation
AssertionError: Cannot load the "commerce_product_variation" entity with NULL ID. in assert() (line 244 of D:\Projects\antiqa\web\core\lib\Drupal\Core\Entity\EntityStorageBase.php).
and line that trying to load the entity is in line 135 commerce_stock\modules\enforcement\commerce_stock_enforcement.module.
Steps to reproduce
when use ajax add to cart form with commerce_variation_cart_form and commerce_stock_enforcement, so install commerce_variation_cart_form, ajax_add_to_cart, commerce_stock_enforcement modules and try the ajax add to cart feature.
Proposed resolution
a patch to resolve the purchased entity from form entity if not set in form state values.
Remaining tasks
community to review patch.
Comments
Comment #2
mohamed nabawy commentedComment #3
mohamed nabawy commentedComment #4
mohamed nabawy commentedComment #5
randalv commentedI have had this issue as well, thank you for the patch. It seems to work for me.
I had my doubts about retrieving the entity from the form object, but I suppose in the end it makes sense to do it this way.
Comment #7
guy_schneerson commentedThanks @Mohamed Nabawy for the patch and @RandalV for testing.