Shopify themes, liquid, logos, and UX
I've set "Product1" to have inventory of 5 (and and I'm not allowing it be still sold when out of stock). However, the user can keep clicking the + on the product amount (whereas I want it to stop being able to be increased once the user has selected 5). It doesn't allow you to add more than 5 to the cart (an error message pops up), but I don't want this to happen - I only want the max number of inventory to be able to be selected in the first place. Also if a product only has an inventory of 1, it should just advise "add to cart" rather than give an option of being able to increase the number that you want to try add to cart. So I'd like it to stop increasing when it hits my max inventory, for example this item only has 5 so I shouldn't be able to click + anymore after 5
I've seen Shopify stores do this correctly - does it depend on the theme? As it seems like a basic online store thing to have. I'm using Sense theme. Thanks in advance!
I want it to work on my product page
Hi @Timadewale ,
To limit the user from changing quantity to maxinventory, you will have to update main-product.liquid file. Please follow below steps to update this.
Step 1: Open main-product.liquid and go to line 275.
Seep 2: Add below code on line 275
{% if product.selected_or_first_available_variant.inventory_policy == 'deny' %}
max="{{ product.selected_or_first_available_variant.inventory_quantity }}"
data-max="{{ product.selected_or_first_available_variant.inventory_quantity }}"
{% endif %}
Step: Save the changes.
If you require further help to optimize your store, please don’t hesitate to reach out. If you find this information useful, a Like would be greatly appreciated. And if this solves the problem, please Mark it as Solution!
Best Regards,
Makka
Thanks it is working now
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024