Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue] Fixes: Bundle product with only one product in required bundle option not being added to cart with bundle option. #38605

Closed
5 tasks
m2-assistant bot opened this issue Apr 10, 2024 · 12 comments
Labels
Area: Content Component: Widget Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@m2-assistant
Copy link

m2-assistant bot commented Apr 10, 2024

This issue is automatically created based on existing pull request: #38601: Fixes: Bundle product with only one product in required bundle option not being added to cart with bundle option.


Description (*)

Adding a bundle product to the cart from the product list widget doesn’t let the product be added properly with the bundle option. The bundle product options are not added within the parent product. It shows a warning message in minicart like ‘Please specify product option(s)’. It doesn’t fail in all the cases, it only fails in a certain case where a bundle product has been created with a required bundle option & the bundle option contains only one product with the ‘is_default’ checkbox selected.

Screenshot 1:
image
Here you can see in the screenshot a bundle product has been created with a bundle option containing only one product in it & the option is required and the product is default select.

Screenshot 2:
image
After creating a bundle product, a widget has been created with a type of Catalog Product List & a condition that matches the particular bundle product.

Screenshot 3:
image
As we have created a widget, a bundle product is visible on the home page in the widget.

Screenshot 4:
image
When we click on the add-to-cart button, the product seems to be added to the cart & it doesn’t throw any error. And then if you check in the mini-cart, you will come to see a warning message like “Please specify product option(s).”

The same thing works fine on a list page, but it fails while adding a product to the cart through the widget.

Manual testing scenarios (*)

  1. Create a bundle product that contains one or more bundle options & each bundle option is required and must contain only one product that is default selected. (see screenshot 1)
  2. Create a widget with the type ‘Catalog Product List’ with a condition that includes the newly created bundle product in the widget. (see screenshot 2)
  3. From the front end visit the widget & try to add the bundle product from the widget product list.(see screenshot 3)
  4. After clicking Add to Cart observe a warning message in minicart. (see screenshot 4).

Expected result (*)

The bundle product should be added to the cart with bundle options.

Actual result (*)

The bundle product isn’t being added to the cart with bundle options.

Additional Information (*)

File1: Magento/CatalogWidget/view/frontend/templates/product/widget/content/grid.phtml
File2: Magento/Catalog/view/frontend/templates/product/list.phtml

If we check in the above-given list.phtml, it gets the option by using the ViewModel & which works fine on the list page. (see screenshot 5).
Screenshot 5:
image

In the given grid.phtml file it doesn’t get the options data where the add-to-cart form is rendered for the particular product (see screenshot 6). As the options are not rendered, adding that product to the cart will only add the parent bundle product to the cart without any bundle options. So, we need to implement the same thing as list.phtml to get the data in grid.phtml.

Screenshot 6:
image

Solution (*)

We have to update the given phtml to get the bundle options in the add-to-cart form. We can get the bundle product options by using the Magento\Catalog\ViewModel\Product\OptionsData ViewModel. (see screenshot 7)

A separate function has been created in the block file of the grid.phtml (Magento\CatalogWidget\Block\Product\ProductsList) to get the ViewModel that returns the object of Magento\Catalog\ViewModel\Product\OptionsData.

Screenshot 7:
image

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)
@m2-assistant m2-assistant bot added the Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. label Apr 10, 2024
@engcom-Bravo engcom-Bravo self-assigned this Apr 10, 2024
Copy link
Author

m2-assistant bot commented Apr 10, 2024

Hi @engcom-Bravo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Bravo engcom-Bravo added the Reported on 2.4.x Indicates original Magento version for the Issue report. label Apr 10, 2024
@engcom-Bravo
Copy link
Contributor

@magento give me 2.4-develop instance

Copy link

Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you.

Copy link

@engcom-Bravo
Copy link
Contributor

Hi @bhoopatparmar,

Thank you for reporting and collaboration.

Verified the issue on Magento 2.4-develop instance and the issue is reproducible.Kindly refer the attached screenshots.

Manual testing scenarios (*)

  • Create a bundle product that contains one or more bundle options & each bundle option is required and must contain only one product that is default selected. (see screenshot 1)
  • Create a widget with the type ‘Catalog Product List’ with a condition that includes the newly created bundle product in the widget. (see screenshot 2)
  • From the front end visit the widget & try to add the bundle product from the widget product list
Screenshot 2024-04-15 at 13 05 52 Screenshot 2024-04-15 at 13 09 03

Bundle Product is adding without bundle options to the cart.

Hence Confirming the issue.

Thanks.

@engcom-Bravo engcom-Bravo added Area: Content Component: Widget Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Apr 15, 2024
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-11779 is successfully created for this GitHub issue.

Copy link
Author

m2-assistant bot commented Apr 15, 2024

✅ Confirmed by @engcom-Bravo. Thank you for verifying the issue.
Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@nicholasfishjgm
Copy link

Hi there, is there any update on this issue? We have seen the same thing occur when setting up a bundle product with 3 or 4 products with all required options.

@engcom-Bravo
Copy link
Contributor

@magento give me 2.4-develop instance

Copy link

Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you.

Copy link

@engcom-Bravo
Copy link
Contributor

Hi @bhoopatparmar,

As per this #38601 (comment) since it was fixed we are closing this issue.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Content Component: Widget Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
3 participants