Lock Child Product to a quantity of 1

jitpaljitpal Member
I want to add a child product and have that locked to a quantity of 1 as long as the parent product is in the cart. The scenario I work with is the customer trying to buy 100 widgets and 1 widget instruction manual, as an example. The customer clearly doesn't need 100 manuals. Setting the quantity alone or the min/max do not seem to do it as the quantity is matched to the parent product or multiplied in that scenario. Thanks
  • jitpaljitpal Member
    By setting the minimum as 0, maximum as 1, and quantity as 1 it only adds 1 to the cart but of course, then I can manipulate the quantity. Would the best solution there be just hiding the box or editing the template in some way?
  • fc_adamfc_adam FoxyCart Team

    Good question. While our bundling functionality does allow you to restrict a customers ability to alter the quantity - it is locked relative the parent products quantity, so if that product is altered, the locked child products quantity adjusts accordingly.

    You could hide the quantity input to prevent the customer from being able to alter it with some CSS. Assuming you're assigning a code to the child product - you can use that to target it with CSS:
    <style type="text/css">
    [data-item-code="abc123"] . fc-cart__item__quantity__input { display:none; }
    That should hide the quantity input for a product with a code of "abc123".
  • jitpaljitpal Member
    This strategy worked great. Thank you!
Sign In or Register to comment.