Closed
Description
Preconditions (*)
Version 2.2.6 (Community Edition).
Steps to reproduce (*)
- Create a product attribute, for example Size with several values (S, M and L). This attribute must have property "use in product listing" set to Yes.
- Create a product that uses this attribute with a configuration setting. Define different quantities for each values. Set this product as new for the current month.
- Create a block with a widget for new products (choose the grid template) and add this block at any page.
- On this page click on Add to cart (from a computer, not smartphone) for this new product.
Expected result (*)
User should see the product page with the message "You need to choose options for your item."
Actual result (*)
User is redirected to the cart page and the product is not added to the cart.
I think the issue is in vendor/magento/module-catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml.
I replaced :
<?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?>
with :
<?php if (!$_item->getTypeInstance()->isPossibleBuyFromList($_item)): ?>
This way it is consistent with Magento\Catalog\Block\Product\AbstractProduct->getAddToCartUrl(), since this method uses isPossibleBuyFromList() to choose the url.
Several templates are concerned with this issue :
- vendor/magento/module-catalog-widget/view/frontend/templates/product/widget/content/grid.phtml (for the widget "Catalog Products List")
- vendor/magento/module-catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml (for the widget "Catalog New Products List" with "New Products Grid Template")
- vendor/magento/module-catalog/view/frontend/templates/product/widget/new/content/new_list.phtml (for the widget "Catalog New Products List" with "New Products List Template")
- vendor/magento/module-catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml (for the widget "Catalog New Products List" with "New Products Images and Names Template")
Metadata
Metadata
Assignees
Labels
The issue has been fixed in 2.3 release lineGate 2 Passed. Manual verification of the issue description passedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 1 Passed. Automatic verification of issue format passedGate 4. Acknowledged. Issue is added to backlog and ready for developmentThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.3 release