Shopify themes, liquid, logos, and UX
I currently have a quantity setup on my products, however the Debut theme doesn't have any css for the increase/decrease value buttons and so it uses the default for your device. How can I make my quantity field look like this
instead of this?
I don't care about the font, I just like the buttons.
Thank you so much,
Owen
Solved! Go to the solution
This is an accepted solution.
Follow this:
1. Go to theme customize theme editor->select product page->tick "Show quantity selector" box from left side.
2. Go to section->product-template.liquid ->find {% if section.settings.show_quantity_selector %} and comment code that in between condition (only product-form__item--quantity this div ). and paste bellow:
<div class="qtydiv"> <label for="Quantity" class="quantity-selector">Quantity</label> <div class="qtybox"> <span class="btnqty qtyminus icon icon-minus">-</span> <input type="text" id="quantity" name="quantity" value="1" min="1" class="quantity-selector quantity-input" readonly=""> <span class="btnqty qtyplus icon icon-plus">+</span> </div> </div>
3. Go to Asset->theme.scss file and add this code at bottom
.qtydiv label{display: block;margin-bottom: 12px;letter-spacing: 2.8px;color: #747a7b;} .qtydiv .btnqty{display: inline-block;cursor: pointer;user-select: none;font-size: 25px;padding: 5px;line-height: 5px;} .qtydiv .btnqty.qtyminus{margin-right: 8px;} .qtydiv .btnqty.qtyplus{margin-left: 8px;} .qtydiv .quantity-input{border: none;border: none;padding: 8px;text-align: center;width: 50px;outline: none;display: inline-block;} .qtydiv {display: inline-block;padding-right: 15px;padding-top: 10px;}
4. Go to Asset->theme.js and add this code at bottom:
$('.qtybox .btnqty').on('click', function(){ var qty = parseInt($(this).parent('.qtybox').find('.quantity-input').val()); if($(this).hasClass('qtyplus')) { qty++; }else { if(qty > 1) { qty--; } } qty = (isNaN(qty))?1:qty; $(this).parent('.qtybox').find('.quantity-input').val(qty); });
Let me know if you need help.
Hello,
The only thing I can recommend is to recheck the codes posted above. My carts are updating correctly, so I'm not sure what the issue may be. Maybe @LobsterNoodels can help with more insight
CODE DIDNOT WORK
@Jasoliya I have followed all the steps you shared and successfully added the Quantity box there... But it is not working, it contains both the buttons + - left and right side but they both are not clickable.
I am a bit confused with this step but I commented on the old quantity selector code.
2. Go to section->product-template.liquid ->find {% if section.settings.show_quantity_selector %} and comment code that in between condition (only product-form__item--quantity this div ). and paste bellow:
Can you please guide me on what to do now?
Which theme you have?
I am using the Debut theme, please help me in adding the product quantity box? I tried your method but it was not working, I was seeing the box but not clickable.
Hi @Dixravi
If you follow proper step then it must work because its for debut theme.
which issue getting? send e store url and password.
@Jasoliya As I already said, I have followed the entire tutorial and it worked but the quantity selector is not working. I mean the + and - buttons are not clickable and not adding the quantity as well.
I am a bit confused about the second step, can you please explain me:
2 Go to section->product-template.liquid ->find {% if section.settings.show_quantity_selector %} and comment code that in-between condition (only product-form__item--quantity this div ). and paste bellow:
Thanks for your help
Send sore url will check
I have removed that because it wasn't working well and hurting my customers and eventually, I was loosing sales.
ok then without checking code i cant say anything,
@Jasoliya Okay I understand it completely, can you let me know what 2nd step means?
@Jasoliya I'm having the same issue. Followed the tutorial exactly (with a few minor css changes) but as soon as I publish the code, clicking the "-" or "+" buttons doesn't do anything.
I'm using the Debut theme. Here's a link to my product page. Thanks so much!
Hi,
That's because of you have new theme and in new theme shopify removed Jquery library in build so you have to add Jquery library to make it work,
You should have to do this:
1. copy code from this library:
2. open your asset->vendor.js file and add whole code at bottom of file.
Note: if you don't want to use Jquery code then you must have to convert my Jquery code in JavaScript.
Got it working by adding the following snippet in my header.liquid file just before </header>
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
Yes its same thing but by my given way it will not affect on speed, and direct file adding will bit affect on Js code rendering.
try to add in top of theme.js file if work.
i tried this code on narrative theme but the minus plus buttons aren't working can you help me here please
Hi,
I have added your code. It is working fine. But the problem is quanitity is not taken in cart section while adding the product. it is showing the quantity:1. can anyone help me on that?
Thanks,
Aravinth.
Hello, I know this is an old thread but your solution helped me out, however I've run into a new issue implementing it. The plus button is not rendering correctly, it is rendering as a square symbol. I'm not sure what changes need to now be made to the code in order to have it render correctly?
Thanks, let me know if I can provide any more info.
Hey!
I need help, I added two codes in .html and .css. Took its proper form on the product page, but after the code, for adding to .js there is no functionality.
Thanks.
send me store url or pm me
Jasoliya,
Thank you!
Where you have added js code?
this code
$('.qtybox .btnqty').on('click', function(){ var qty = parseInt($(this).parent('.qtybox').find('.quantity-input').val()); if($(this).hasClass('qtyplus')) { qty++; }else { if(qty > 1) { qty--; } } qty = (isNaN(qty))?1:qty; $(this).parent('.qtybox').find('.quantity-input').val(qty); });
You can add same type of html in section->cart-template.liquid file but you have to manage js code more
How to understand you about js? do you need to add something or refer to the pro?
need to do whole js code based on your store so cant do from front side just need store access pm me,
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024