Magento2: Minimum Qty Allowed in Shopping Cart for Simple Products effects Bundle Products

Created on 26 Mar 2018  路  16Comments  路  Source: magento/magento2


We are wondering about the effects of the configuration "Minimum Qty Allowed in Shopping Cart" for Simple Products. Setting this configuration, we expect that it is not possible to individually add the product to the Shopping Cart, if the chosen quantity is below the configuration. Additionally, we expect that this configuration does not effect the allowed quantities in Bundle Products that are a parent of the Simple Product.

Preconditions



Magento 2.2.3 Community

Steps to reproduce

  1. Create a Simple Product
  2. Set the "Minimum Qty Allowed in Shopping Cart" for that Simple Product e.g. to 5
  3. Create a Bundle Product
  4. Add the Simple Product to an Option of the Bundle Product
  5. Open the Bundle Product on Frontend
  6. Select the Simple Product and set the desired quantity below the defined "Minimum Qty Allowed in Shopping Cart" (e.g. < 5)
  7. Try to add the Bundle Product to the Shopping Cart

Expected result


The Bundle Product will be successfully added to the Shopping Cart even when the quantity of the Simple Product is below the defined "Minimum Qty Allowed in Shopping Cart".

Actual result


The Bundle Product can not be added to the Shopping Cart, the page refreshes and the error message "The fewest you may purchase is %1." is shown.

Additional

If you set the quantity of the Bundle Product itself to e.g. 5 (so that the "Minimum Qty Allowed in Shopping Cart" of the Simple Product is fulfilled) and the quantity for the Simple Product to e.g. 1, the Bundle can be added to Shopping Cart.

Cannot Reproduce Clear Description Format is valid Ready for Work Reproduced on 2.1.x Reproduced on 2.2.x Reproduced on 2.3.x

Most helpful comment

Hey @dmanners,

for example, you have a computer store and don't want to ship single cables because it doesn't pay off (paper work etc.) resp. only pays off when you ship multiple (e.g. 4) of these cables. On the other hand, you want to sell a computer (Bundle) that requires exactly one of these cables.

In this example it makes sense to ship one cable in the context of Bundle, but does not pay off to ship a single cable.

All 16 comments

@densen45 , thank you for your report.
We've acknowledged the issue and added to our backlog.

Hi @densen45

Thank you for this report. I would be interested in knowing why expect that the bundle product would not use the same validation on it's simple products?

Hey @dmanners,

for example, you have a computer store and don't want to ship single cables because it doesn't pay off (paper work etc.) resp. only pays off when you ship multiple (e.g. 4) of these cables. On the other hand, you want to sell a computer (Bundle) that requires exactly one of these cables.

In this example it makes sense to ship one cable in the context of Bundle, but does not pay off to ship a single cable.

Thank you @densen45 for the clear explanation.

I am working on this at #dmcdindia

@monikachintu thank you for joining. Please accept team invitation here and self-assign the issue.

@ishakhsuvarov @dmanners @magento-engcom-team

I have checked above issue, following the description added by @densen45.
Please refer below comments.

  1. I set 'Minimum Qty Allowed in Shopping Cart' = 5 - from the Store Configuration.
  2. I created a bundle product (Bundle A) with 2 child products.
  3. Child Product A
  4. Child Product B
  5. Bundle A is consist of Bundle of (2 x Child Product A) and (3 x Child Product B)
  6. On Bundle Product Frontend Page, I can only add 4 qty of that bundle. The qty box will not allow me to add qty < 4 here.
  7. So, I removed validation from that qty box as below.
    I changed below code in addtocart.phtml, only when product type = bundle.

from

<input type="number"  name="qty" id="qty" 
value="<?= /* @escapeNotVerified */ $block->getProductDefaultQty() * 1 ?>"
title="<?= /* @escapeNotVerified */ __('Qty') ?>"
class="input-text qty"
data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>" />

to

<input type="number" name="qty" id="qty"  
value="<?= /* @escapeNotVerified */ $block->getProductDefaultQty() * 1 ?>" 
title="<?= /* @escapeNotVerified */ __('Qty') ?>" class="input-text qty" />
  1. Now, I can add qty < 4 in qty box for that bundle product. But again we have validation in Magento, that comes into picture, for simple products.

  2. If I add qty=1 for bundle product, it will not allow to add, and send error message - 'The fewest you may purchase is 4'. Because it's trying to add (2 x Child Product A) and (3 x Child Product B)

  3. Now, when you add qty=2 for bundle product, you will be able to add it into cart.
    because it has added (2 x 2 = 4 qty of Child Product A) and (2 x 3 = 6 qty of Child Product B)

  4. One can always set 'Minimum Qty Allowed in Shopping Cart' at product level too. If we set it as '1' - for product level (for individual product) - these case will not even occur. And Magento will let you add qty=1 for the bundle product and it will add (2 x Child Product A) and (3 x Child Product B).

  5. So what do you suggest, we should consider it as bug? becuase I think this flow is dependant on one's own flow for website, one should customize it based on his requirement.

Please share your thought, and let me know if any concerns.

For me, it would be sufficient if this could be configured / individualized.

But -- if we get you @viral-wagento right -- your suggested modification does not solve this issue. Cause it still wouldn't be possible to e.g. order one computer that requires one cable, while the cable's minimal quantity is set to 4. Your modification only enables the user to change the value of the input element but not add the desired quantity to the card. I apologize, if I got you @viral-wagento wrong.

@densen45
Yes, I know that the code I have mentioned above was just to remove the validations. It is not the complete solutiom. To match your desired output, one should do customization for that.
That's why I have asked Magento Team - as mentioned in above comment.

@magento-engcom-team what do you think about @viral-wagento's investigation and questions?

Hi @p-bystritsky. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [x] 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [x] 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [x] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

@p-bystritsky are you still working on it or i can reassign to myself?

MM19IN

Hi @monikachintu. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

Hi @engcom-Echo. 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: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components 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.

Hello All

I am not able to reproduce this issue on the 2.4-develop branch by provided steps.

Testing scenario:

Steps to reproduce:

  1. Create a Simple Product
  2. Set the "Minimum Qty Allowed in Shopping Cart" for that Simple Product e.g. to 5
  3. Create a Bundle Product
  4. Add the Simple Product to an Option of the Bundle Product
  5. Open the Bundle Product on Frontend
  6. Select the Simple Product and set the desired quantity below the defined "Minimum Qty Allowed in Shopping Cart" (e.g. < 5)
  7. Try to add the Bundle Product to the Shopping Cart

Result
The Bundle Product will be successfully added to the Shopping Cart even when the quantity of the Simple Product is below the defined "Minimum Qty Allowed in Shopping Cart".
Screenshot_48
Please feel free to comment, reopen or create new ticket according to the Issue reporting guidelines
if you are still facing this issue on the latest 2.4-develop branch. Thank you for collaboration.

Was this page helpful?
0 / 5 - 0 ratings