The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Limiting Qty Per Item in Cart

samashsamash Member
in Help edited September 2014
Is it possible to limit a user to 1 item per product to checkout and if they have more than 1 of the same product they will not be able to process the order?
Comments
  • fc_adamfc_adam FoxyCart Team
    edited September 2014
    @samash,

    You can set a quantity_max attribute to prevent the customer from adding more than that value of a given product. If you add that as "1" to any products you want to restrict it for, that should work well for you. More details on that here: http://wiki.foxycart.com/static/redirect/add_to_cart
  • Is there any way to control this in the cart, or it is only at the style level?
  • fc_adamfc_adam FoxyCart Team
    @samash,

    How do you mean control it in the cart? If you set the quantity_max attribute with the product, the customer won't be able to add or change the product quantity to more than that amount.
  • The quantity_max attribute wont really work for me in this case because a person would still be able to purchase a max of 1 of multiple sizes since different sizes cause the item to not be identical. i am looking for a way to prevent someone purchasing even multiple sizes of a certain product, only allowing 1 item in the cart for a checkout. is there any way to hide the "place order" button and show the reason if there is multiple items in the cart?
  • fc_adamfc_adam FoxyCart Team
    @samash,

    Ah - that would definitely be an issue. It would be possible to tackle this on the cart and checkout - could you confirm which version of FoxyCart you're using? The approach will be slightly different between the two.
  • @fc_adam,

    currently using version 1.1
  • fc_adamfc_adam FoxyCart Team
    @samash,

    Thanks for confirming that - one other thing I forgot to confirm with you (sorry about that) - is there just one product type that you're working with here, or are there multiple products that you only want to restrict to having a single instance of in the cart?

    So for example, will you only be checking for a single product name, or do you want to ensure that in the cart there is only one instance of any product name present.
  • @fc_adam,

    if possible, multiple products each having a single instance of in the cart. Only allowing 1 unit per product regardless of a variant.
  • fc_adamfc_adam FoxyCart Team
    @samash,

    That is possible! I'll work up some code and get back to you in the next day or so.
  • fc_adamfc_adam FoxyCart Team
    @samash,

    Give this a try - pasted in your cart template: http://pastie.org/private/suye0rqxftufgrlh4f9abw
  • @fc_adam,

    any specific place in my cart template where this should go?
  • fc_adamfc_adam FoxyCart Team
    @samash,

    You should be fine to place that either right before the closing </head> or </body> tags - whichever suits you best.
Sign In or Register to comment.