Jump to content

Hide quantity field on select product pages


Recommended Posts

Is it possible to simply hide the quantity field in global.css for specific product pages? Preferable if I could hide it for all product pages that belong to a particular category.

 

I've been trying different things to hide the quantity box on select product pages, but have not found a solution. 

Link to comment
Share on other sites

Hi

 

You can try this

 

Open themes>yourtheme>product.tpl

 

Go to the end of the file and paste the below code for the selected category id. In this case, the products under the default category id 3 will have a product page with hidden quantity box, quantity label, plus/minus buttons.

{if $category->id==3}
<script type="text/javascript">
$("#quantity_wanted, #quantity_wanted_p, .button-minus, .button-plus").css( "display", "none" );
$("#quantity_wanted").prev().css( "display", "none" );
</script>
{/if}
Link to comment
Share on other sites

  • 1 year later...

 

Hi

 

You can try this

 

Open themes>yourtheme>product.tpl

 

Go to the end of the file and paste the below code for the selected category id. In this case, the products under the default category id 3 will have a product page with hidden quantity box, quantity label, plus/minus buttons.

{if $category->id==3}
<script type="text/javascript">
$("#quantity_wanted, #quantity_wanted_p, .button-minus, .button-plus").css( "display", "none" );
$("#quantity_wanted").prev().css( "display", "none" );
</script>
{/if}

This does exactly what i need to do in a store however there are multiple categories we need to hide the add quantity box. How would I write this to include multiple category numbers?

Link to comment
Share on other sites

This does exactly what i need to do in a store however there are multiple categories we need to hide the add quantity box. How would I write this to include multiple category numbers?

 

 

Hi

 

You can code like below:

{if ($category->id==3) || ($category->id==4) || ($category->id==5)}
<script type="text/javascript">
$("#quantity_wanted, #quantity_wanted_p, .button-minus, .button-plus").css( "display", "none" );
$("#quantity_wanted").prev().css( "display", "none" );
</script>
{/if}
Link to comment
Share on other sites

  • 9 months later...

hello i have same problem but with quantity in groups,

i need visitor group or guest can NOT see quantity available, and only register can see the stock, how is the code ??

 

Prestashop 1.6.1.9

 

thanks a lot.

 

 

You can try this (add the below lines to the themes>yourtheme>product.tpl at the end of file)

{if (Group::getCurrent()->id == '1' || Group::getCurrent()->id == '2')}
<script type="text/javascript">
$("#quantity_wanted, #quantity_wanted_p, .button-minus, .button-plus").css( "display", "none" );
$("#quantity_wanted").prev().css( "display", "none" );
</script>
{/if}
Link to comment
Share on other sites

×
×
  • Create New...