Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Re: How to limit to one item and one quantity only per checkout?

Solved

How to limit to one item and one quantity only per checkout?

Besguerra
Visitor
1 0 3

Hi,

I'm looking for a way on how to limit transactions to one item and one quantity only per checkout.

 

Thank you

Accepted Solution (1)

Don
Shopify Staff
2787 199 398

This is an accepted solution.

Hi there @Besguerra!

 

Don here from Shopify. 🙂

 

The first thing that comes to mind for your requirements is the Order Limits (MinMaxify) app.

 

I know that this will allow you to set a maximum (as well as minimum) product quantity.

 

From your post here, it sounds like you also want to restrict which products a customer can purchase as well as limiting the quantity of that item to one per customer?

 

I'm not 100% certain, but it does sound from the app store page description that this app should also be able to limit:

 

* Number of items for a specific product
* Number of items within a group of products

 

If you want to be totally sure of any aspect of using this app I would reach out to its developers using the contact details listed on the app store page as they will be able to field any queries you have about using this app.

 

Should you prefer to get this functionality coded into your store rather than using an app, you can also consider hiring an Expert Developer to create a private app or otherwise handle this using a custom-coded solution.

 

Are you still getting set up with your business here or have you been selling for a while already?

 

 

Regards,

Don

Don | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

View solution in original post

Replies 65 (65)
scom
Explorer
45 1 69

The solution is the same as every other basic Shopify feature that is missing .... pay pay pay

Its honestly a joke how many times I have hunted around for how to do the most basic e-commerce feature and found myself reading a thread of other users asking for the same feature for YEARS, with the only option being to pay monthly for a plugin.

I use Shopify but have never and will never recommend it to anyone else because of this.

 

If you are listening (Shopify) please create a wish list for features where people can add and vote what they would like to see integrated and then dedicate a team to start implementing them.

grizzlypoppy
Shopify Partner
158 5 24

Shopify offers an app store, and they make money on apps installed from that app store. Someone built an app that solves this issue (for merchants that can code, they can implement this solution with code fwiw). But by bringing this feature in natively to Shopify, they're cutting a revenue stream for themselves and a third-party app developer. I'm not arguing it's good or bad -- just that the incentive to please merchants for a lot of these asks just doesn't have a sense of urgency, because, well, there's money left on the table.

scom
Explorer
45 1 69

I get that, but my point being that this business model also incentives Shopify to deliberately omit functionality because it will create more revenue for them. Think about that, they make more money by making a worse product. That is a negative feedback loop and in many cases the feature omissions are beyond ridiculous. For example, i recently discovered there is no way for a customer to manage their own account password, if they need to change it, we need to manually send them a reset request. I honestly can't think of a single online platform that doesn't have this feature built in and guess what, if you want this functionality in Shopify ... surprise surprise, there is an app for that and its NOT free. There is no excuse for that, its pure greed and not only have I stopped recommending shopify to others because of it, but I'm actively looking for a good alternative, not going to name drop but there are a few out there. The thing that lured me to shopify was the ease of initial setup, but beyond that, I wish I went with something that didn't have this app store business model. The number of apps I've consequently had to install or get devs customised is more than any Wordpress site I manage (which says a lot)

grizzlypoppy
Shopify Partner
158 5 24

I hear you, and I do agree. And there's certainly some apps that have been absorbed by native Shopify, and with the release of Shopify Functions, I think there's going to be a lot of app store apps that will be dethroned by the more clever merchants that realize it's a huge sandbox of options for them. 

Not sure where you're getting your reset password info, but virtually anyone with an account on almost any storefront can simply go to the xxx.myshopify.com/account, click the "Forgot Password" link and reset their own password via email. It doesn't require a back office reset whatsoever (assuming it's a store-bought theme). That's a pretty standard feature.

scom
Explorer
45 1 69

Right, but why is it 'forgot password'? what if they are logged in already? i honestly get customers asking me this because they are logged in and looking at their account page trying to find the password settings because that's how it works everywhere else. forgot password is not intuitive if you know your password but want to change it.

 

I just gave that example but there are many others and believe me, Im not trying to trash shopify, if anything this comes from a place of wanting to love it and recommend it to others but its just difficult when so many basic features are hidden behind a this app paywall. I wouldn't even mind if there was a more granular subscription that enabled these features, its just the idea of app after app that is irritating and means the cost of ownership is not clear from the start. You also bring up a good point, this model means that as an app developer you could suddenly become redundant on the whim of shopify, if they decide to implement the functionality that you developed as an app but that is another story.

 

annafaie
Excursionist
14 0 112

Would LOVE a limit per order feature! Seems basic enough.

udizisser
Tourist
4 0 2

It's basic feature that should be build in to the platform. I sell software licenses and don't want customer to be able to select more than one Quantity per product in the cart. 

kzap
Visitor
2 0 1

You can do this with Custom Data by adding a field to all your products called Max Cart Quantity, then edit your Liquid templates in the right place to set the max="" field on the Quantity <input HTML tag.

 

Steps:

  1. Go to Settings -> Custom Data -> Products
  2. Click Add Definition
  3. Add a new field called Max Cart Quantity
  4. Take note of the Namespace and Key field. This will be important for the Theme editing.
  5. Select Type as Integer. Set Minimum Value to 1 so that you can't enter an negative quantity.
  6. Click Save

It should look like this once saved:

Screenshot 2023-12-03 at 11.39.25 PM.png

Note the custom field key of product.metafields.custom.max_cart_quantity.

 

Now lets edit your theme:

  1. Go to your theme and click on the three dots and click Edit Code.
  2. Find the .liquid files which contains the Quantity Input field. For the Dawn Theme this is in main-product.liquid and main-cart-items.liquid
  3. Look for the HTML which contains the quantity. This may looks something like

 

<input
  class="quantity__input"
  type="number"
  name="quantity"
/>

 

 

 Edit it to add a max field with a condition like:

 

{%- if product.selected_or_first_available_variant.product.metafields.custom.max_cart_quantity != null %}
max="{{ product.selected_or_first_available_variant.product.metafields.custom.max_cart_quantity }}"
{%- endif %}

 

Note the custom field key of product.metafields.custom.max_cart_quantity that was configured in our Custom Data for Products.

 

Now you can go edit any of your products and edit the Max Cart Quantity custom field that you made.

Screenshot 2023-12-03 at 11.48.29 PM.png

BRITTBRITT
Excursionist
14 0 3

So I tried updating the code but it still didn't work.  I did get an error message on a product page stating There was an error while updating your cart. Please try again. but it still let me add the products to my cart and go through with the checkout process. Any help would be greatly appreciated. 

 

main-cart-items.liquid updated code

<input
class="quantity__input"
data-quantity-variant-id="{{ item.variant.id }}"
type="number"
name="updates[]"
value="{{ item.quantity }}"
{% # theme-check-disable %}
data-cart-quantity="{{ cart | item_count_for_variant: item.variant.id }}"
min="{{ item.variant.quantity_rule.min }}"
{% if item.variant.quantity_rule.max != null %}
max="{%- if product.selected_or_first_available_variant.product.metafields.custom.max_cart_quantity != null %} max="{{ product.selected_or_first_available_variant.product.metafields.custom.max_cart_quantity }}" {%- endif %}
{% endif %}
step="{{ item.variant.quantity_rule.increment }}"
{% # theme-check-enable %}
aria-label="{{ 'products.product.quantity.input_label' | t: product: item.product.title | escape }}"
id="Quantity-{{ item.index | plus: 1 }}"
data-index="{{ item.index | plus: 1 }}"
>

 

main-product.liquid code that was updated

 

<input
class="quantity__input"
type="number"
name="quantity"
id="Quantity-{{ section.id }}"
data-cart-quantity="{{ cart_qty }}"
data-min="{{ product.selected_or_first_available_variant.quantity_rule.min }}"
min="{{ product.selected_or_first_available_variant.quantity_rule.min }}"
{%- if product.selected_or_first_available_variant.product.metafields.custom.max_cart_quantity != null %}
data-max="{{ product.selected_or_first_available_variant.quantity_rule.max }}"
max="{{ product.selected_or_first_available_variant.product.metafields.custom.max_cart_quantity }}"
{%- endif %}
step="{{ product.selected_or_first_available_variant.quantity_rule.increment }}"
value="{{ product.selected_or_first_available_variant.quantity_rule.min }}"
form="{{ product_form_id }}"
/>

DutchDelight
Excursionist
30 0 6

From what I can see.. sure, that would work. However, when you're on a Featured Product page and you add 1, the item is added, but you'll stay on the same page. You can then click 'add to cart' again and it will add this same item to the cart, etc. Quantities in the cart is now increasing.

How can THIS be resolved? (If the page would update, then you can get around this .. but not when it stays on the same page)

GLeon
Visitor
1 0 0

I am having the same issue. It works on the product page, but not on the cart. Any updates would be really appreciated!

ArmagnacDE
Shopify Partner
6 0 6

Yesterdays Editions Update presented a new validation API for the cart and checkout. Hopefully we will get at least an app with good UX. All current apps just rely on frontend validation and are not really nice for the customer... 😞 Maybe the new API Is simple and we will see a free or cheap app for that.

shopify.dev/docs/api/functions/reference/cart-checkout-validation?utm_campaign=winter24edition&utm_source=editions&utm_medium=W24E-page&utm_content=W24E&utm_channel=W24-editions-website

Shahramsoft
Shopify Partner
4 0 0

Hi Dear

 

As I know, some Apps in the app Store give you this option.

 

I recommend Discounty App to you. Install It and use the Quantity Discount option as you want. 

 

Dascalargo
Shopify Partner
109 7 46

I realize this is an old thread, but I was looking for this solution, as well. Ultimately, I figured out how to code it myself in Dawn. 

 

I had already removed the quantity selector from the item in question, but needed a way to prevent the customer from adding more in the cart, and THEN a way to prevent them from going back to the product page and adding another by selecting Add to Cart. I think I have all the bases covered now.

 

If anyone is still looking for this solution, I’m happy to help if I can.

DutchDelight
Excursionist
30 0 6

Prevent from adding more to the cart: Put in a check that checks if it's already in the cart. If not show the 'add to cart' button, otherwise show message.

Dascalargo
Shopify Partner
109 7 46

I believe it was discussed here in this thread (or perhaps another) that that is not enough. You have a quantity button in the cart, too. And it needs to be for only particular products.

 

And as I said, I’m not looking for help on this, but offering help if anyone else is stuck.

 

But thanks for trying to help.