Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I am using the Studio Theme v15.0.1 (Password: "artgisback") and I have managed to successfully implement logic on the Product page (main-product.liquid), that IF stock is greater than 1, then show the quantity selectors, ELSE hide the selectors, and it works perfectly. I added on LINE 235 this code:
{% if product.selected_or_first_available_variant.inventory_quantity > 1 %}
But now I need to also update the CART, so that the same logic applies, as follows:
Example of Product with >1 stock - you can see the Quantity selectors show on the Product page: https://artgazette-dev.myshopify.com/products/002-from-the-window-peruvian-rainforest-tambopata
Example of Product with only 1 stock item - you can see the Quantity selectors DO NOT show on the Product page: https://artgazette-dev.myshopify.com/products/01-an-ideal-for-living-21
Can someone guide me on the code to EDIT and ADD please?
Solved! Go to the solution
This is an accepted solution.
Thanks, your suggestion didn't solve it BUT it did help to get me onto the right path, and it needed to be:
{% if item.variant.inventory_quantity > 1 %}
THANKS for your help!
Hello @artgazette
Yes, i can do this but i need to access your store i mean as staff member
If you require further help to optimize your store, please don’t hesitate to reach out.
This contribution will always benefit you and you will get my full help easily and you can contact me easily.
Sorry @AK_Design_Dev I'm on the BASIC plan, can't do that. Perhaps you can steer me? I saw in the main-cart-items.liquid where the selectors are managed, I assume in there, but not entirely surely on the logic and placement.
okay okay then srry i can't helping you..
If you require further help to optimize your store, please don’t hesitate to reach out.
This contribution will always benefit you and you will get my full help easily and you can contact me easily.
Hi @artgazette studio is based on the Dawn reference theme
Add your quantity display logic to sections/main-cart.liquid and snippets/cart-drawer.liquid similar to the below files and lines
https://github.com/Shopify/dawn/blob/main/sections/main-cart-items.liquid#L243
and https://github.com/Shopify/dawn/blob/main/snippets/cart-drawer.liquid#L277
Though this does not account for removing the entire table column for quantity in the situation where no line-items have a quantity display.
Good Hunting.
If you need this customization then contact me by my email for services.
Contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.
Contact [email protected] for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
@PaulNewtonthanks for the steer. I tested and it works 50% 🙂 In the attached hyou can see that it removes ALL the Quantity selectors, where it should not have removed the first one (as Stock >1) and it should only have removed the second one, where Stock =1.
Any tips?
Oh adjust it for the context of cart items, as this isn't a product page
See what type of output loop your in
https://github.com/Shopify/dawn/blob/main/sections/main-cart-items.liquid#L81C25-L81C30
So it's probably just {% if item.inventory_quantity > 1 %}
Contact [email protected] for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
This is an accepted solution.
Thanks, your suggestion didn't solve it BUT it did help to get me onto the right path, and it needed to be:
{% if item.variant.inventory_quantity > 1 %}
THANKS for your help!
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024