![]() |
Disable 'Add to cart' for $0 products
Wonder how to disable 'add to cart' button for products without a price, for example, the 'add to cart' button remains visible but does nothing onclick when the product is out of stock.
cheers |
Re: Disable 'Add to cart' for $0 products
Products without a price? Try something like this:
{if $product.price ne 0}{include file="buttons/add_to_cart.tpl" style="button" href="javascript: if(FormValidation()) document.orderform.submit();"} {else} {if $product.price eq 0}{$lng.lbl_your_label_that_you_want_displayed} |
Re: Disable 'Add to cart' for $0 products
How about...
{if $product.taxed_price ne 0} {include file="buttons/add_to_cart.tpl" style="button" href="javascript: if(FormValidation()) document.orderform.submit();"} {/if} |
Re: Disable 'Add to cart' for $0 products
thanks for both replies,
I copied the code into /customer/main/product.tpl PHP Code:
to PHP Code:
This method works well only when there is no product variants. New question now is what template(s) should I edit for those hav variants? cheers |
Re: Disable 'Add to cart' for $0 products
Currently I set the quantity to 0 for those products without a price to disable add to cart.
However, if the first variant on the list is set to be out of stock, then the rest of variants will appear to be out of stock too even they are stocked. Vice versa, if the first variant is set to be stocked, then the rest of products will still be able to add to cart even they are out of stock. |
Re: Disable 'Add to cart' for $0 products
try this
{if $product.taxed_price ne 0 || $variant_price_no_empty} |
Re: Disable 'Add to cart' for $0 products
Hi Ashley, thank you for your previous replies, even I replaced the code, the 'add to cart' button still work for variants with no price.
|
All times are GMT -8. The time now is 04:32 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.