Skip to content

fix: allow bundle product with only non-required options to be added …#40577

Open
baudeval wants to merge 4 commits intomagento:2.4-developfrom
baudeval:baudeval-patch-2
Open

fix: allow bundle product with only non-required options to be added …#40577
baudeval wants to merge 4 commits intomagento:2.4-developfrom
baudeval:baudeval-patch-2

Conversation

@baudeval
Copy link
Copy Markdown
Contributor

@baudeval baudeval commented Mar 6, 2026

…to cart

Resolves #40573 - Bundle products with no required options were incorrectly blocked with "Please specify product option(s)." error. Added bundleHasRequiredOptions() check before throwing the exception when no options are selected.

Description (*)

When a bundle product has only non-required options, adding it to the cart without selecting any option throws the error "Please specify product option(s).".

The root cause is in _prepareProduct() inside Magento\Bundle\Model\Product\Type: when $optionIds is empty and strict process mode is active, the exception is thrown unconditionally — without checking whether any option is actually required.

This PR adds a bundleHasRequiredOptions() private method that checks if the bundle has at least one required option before throwing the exception. If no options are required, the bundle is allowed to be added to the cart without any selection.

Changes:

  • Added bundleHasRequiredOptions() private method to Magento\Bundle\Model\Product\Type
  • Modified the empty($optionIds) && $isStrictProcessMode check to only throw when required options exist

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes Bundle with only not required options is not possible to be added to cart "Please specify product option(s)." #40573

Manual testing scenarios (*)

  1. Create a bundle product with only non-required options (all options have Required set to No)

  2. Add at least one selection to each option

  3. Navigate to the bundle product page on the storefront

  4. Click Add to Cart without selecting any option

  5. Expected: The product is added to the cart successfully

  6. Actual (before fix): Error message "Please specify product option(s)." is displayed

  7. Create a bundle product with at least one required option

  8. Navigate to the product page and click Add to Cart without selecting any option

  9. Expected: Error message "Please specify product option(s)." is displayed (existing behavior preserved)

  10. ...

  11. ...

Questions or comments

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
Copy link
Copy Markdown

m2-assistant bot commented Mar 6, 2026

Hi @baudeval. Thank you for your contribution!
Here are some useful tips on how you can test your changes using Magento test environment.
❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@baudeval
Copy link
Copy Markdown
Contributor Author

baudeval commented Mar 6, 2026

@magento run all tests

@baudeval
Copy link
Copy Markdown
Contributor Author

baudeval commented Mar 6, 2026

@magento run all tests

…to cart

Resolves magento#40573 - Bundle products with no required options were
incorrectly blocked with "Please specify product option(s)." error.
Added bundleHasRequiredOptions() check before throwing the exception
when no options are selected.
@engcom-Hotel engcom-Hotel added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Mar 10, 2026
@baudeval
Copy link
Copy Markdown
Contributor Author

@magento run all tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: pending review

Projects

Status: Pending Review

Development

Successfully merging this pull request may close these issues.

Bundle with only not required options is not possible to be added to cart "Please specify product option(s)."

2 participants