Jump to content

Hide quantity if product has variants


Recommended Posts

Hey everyone.
I´m trying to hide the Quantity button if the product has some variants. I´m getting an error on the page if I use $product.id_product_attribute != 0.
The script works just fine if I apply it for some category ID but not with that one above. Can you, please, share some solution with me?
 

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

<!--doesn´t work-->
{if ($product.id_product_attribute != 0)}
<script type="text/javascript">
$("#quantity_wanted, #quantity_wanted_p, .button-minus, .button-plus").css( "display", "none" );
$("#quantity_wanted").prev().css( "display", "none" );
</script>
{/if}

Thanks in forward!

 

Edited by jaymz1097 (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...