Hey Bo,
I tried following the steps and it didn't work out. Here is a screenshot. I'll be glad if you can guide. Thanks.
@Bo wrote:Hey there,
Bo here from Shopify Support!
That is a really great question and you are absolutely heading down the right path to get this done. You will be able to remove the quantity selector from this product by creating a new template and a new section so let's get started.
- Go to Online Store > Edit Code.
- Under the Templates folder select "Add a new template". Select product from the dropdown and you can name it what you want, for this case we will simply call it alternate and create the template.
- On line six replace:
{% section 'product-template' %}with:
{% section 'product-template-alternate' %}
- Click Save.
- Under the Sections folder you will select "Add a new section". You will name this new section "product-template-alternate".
- Go to product-template.liquid and copy all the code. Once copied go back to product-template-alternate and paste replace whatever code is there with what you have copied.
- At the start of line 329 you will add {% comment %} and at the end of line 334 you will close it with {% endcomment %}. The finished product will look like this:
- Click Save.
Now that you have made this change to the code itself you can go ahead and select that template for your product.
Let me know how this goes and if there is anything else I can assist you with, I'm happy to help!
All the Best,
Bo
Hey there, @Rafay-Hussain
Could you please confirm the name of the theme that you are using and send me on a link to your store?
Thank You!
Bo
Bo | 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
Hey there, @hushlifestyle
So most of the steps are the same as my original posting, you will just need to edit a different line in this new alternate copy of the product-template.liquid. You will need to comment out the following code:
{% if section.settings.show_quantity_selector %} <div class="product-form__item product-form__item--quantity"> <label for="Quantity-{{ section.id }}">{{ 'products.product.quantity' | t }}</label> <input type="number" id="Quantity-{{ section.id }}" name="quantity" value="1" min="1" class="product-form__input" pattern="[0-9]*"> </div> {% endif %}
The end result will look like this:
Let me know how this goes and if there is anything else I can assist you with, I'm happy to help!
All the Best,
Bo
Bo | 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
Hey there, @opulence
That would be a completely different tutorial, I would recommend posting your request as a new post here in our design forum to get help.
All the Best,
Bo
Bo | 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
Hi Bo,
I would like to do this to remove the quantity from the Minimal theme as the quantity and price will be dictated by the variants. How do I do that? I got to the section where you change the code on line 329 but I did not find that code there.
@Bo wrote:Hey there,
Bo here from Shopify Support!
That is a really great question and you are absolutely heading down the right path to get this done. You will be able to remove the quantity selector from this product by creating a new template and a new section so let's get started.
- Go to Online Store > Edit Code.
- Under the Templates folder select "Add a new template". Select product from the dropdown and you can name it what you want, for this case we will simply call it alternate and create the template.
- On line six replace:
{% section 'product-template' %}with:
{% section 'product-template-alternate' %}
- Click Save.
- Under the Sections folder you will select "Add a new section". You will name this new section "product-template-alternate".
- Go to product-template.liquid and copy all the code. Once copied go back to product-template-alternate and paste replace whatever code is there with what you have copied.
- At the start of line 329 you will add {% comment %} and at the end of line 334 you will close it with {% endcomment %}. The finished product will look like this:
- Click Save.
Now that you have made this change to the code itself you can go ahead and select that template for your product.
Let me know how this goes and if there is anything else I can assist you with, I'm happy to help!
All the Best,
Bo
User | Count |
---|---|
455 | |
194 | |
139 | |
61 | |
42 |