0
  • Drupal core 8.2.6
  • Drupal Commerce 8.x-2.0-beta5
  • Bootstrap 8.x-3.2

I tried making a View that renders Products in view mode (Grid of Products in Default view), but when I try to add a product to cart - if the product has no variations - often times a wrong product that has no variations gets added. If the product that I try to add has variations I get a php error: InvalidArgumentException: Unknown attribute field name "attribute_period". in Drupal\commerce_product\Entity\ProductVariation->getAttributeValueId() (line 260 of drupal/modules/commerce/modules/product/src/Entity/ProductVariation.php).

Other attributes pop up there as well if I add a different product to cart.

It seems like it still tries to add a different product but provides the right variation name, which the different product does not have, so it errors.

If I view just the product on its own - works just fine. So for now I have the view show a table of products with "View" link, but I'd really like to be able to add products to cart right from the view. Any ideas for how to make that happen? I can't seem to find any tickets about this issue.

0

I believe we have this captured in an issue. The main issue was https://www.drupal.org/node/2831895 and is now in https://www.drupal.org/node/2827721.

Part of our blocker has been getting tests for this. We need to build a test for the use case then work towards a resolution.

There is a pull request in progress at https://github.com/drupalcommerce/commerce/pull/582. I have not reviewed this and not sure how close it is to a final solution.

The issue is unique form IDs.

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.