Jump to content

Disable/Hide add to cart button if price is zero in prestashop 1.6.1.3


Zen_j1

Recommended Posts

how to Disable/Hide Add to cart button if price is zero in prestashop 1.6.1.3

Hello, 

 

You want to disable add to cart button in one page in particular or in all pages that appear the product - Home, Categories, Product, Lists...

 

If is in one page is quite simple, but in all pages maybe you need to override some controllers.

 

¿Would you like to add request info link in all your products?

<- This module can help you to convert visitors to customers ->

Link to comment
Share on other sites

Hi there,

        I went thru  solution given in topic below to hide add to cart using js but i can not make this work in 1.6.3.1 i am have able do till "Call for Price" but could not hide add to cart as given in solution

 

Can someone guide to make this solution work on prestashop 1.6.3.1

https://www.prestashop.com/forums/topic/317432-call-for-pricing-help-in-prestashop-v16/page-2

My code in prestahop 1.6.3.1 before change

    if (priceWithDiscountsDisplay > 0)
    {
        $('#our_price_display').text(formatCurrency(priceWithDiscountsDisplay, currencyFormat, currencySign, currencyBlank)).trigger('change');
    }
    else
    {
        $('#our_price_display').text(formatCurrency(0, currencyFormat, currencySign, currencyBlank)).trigger('change');
    }


After change as suggested


if (priceWithDiscountsDisplay > 0)
    {
        if (basePriceDisplay > 0)
    
{
var text_or_price = formatCurrency(priceWithDiscountsDisplay * currencyRate, currencyFormat, currencySign, currencyBlank).trigger('change');
$('#quantity_wanted_p').show();     //show quantity counter if it's hidden
$('#add_to_cart').show();     //show add to cart if it's hidden
}

else
{
var text_or_price = "Not available" ;
$('#quantity_wanted_p').hide();     //show quantity counter if it's hidden
$('#add_to_cart').hide();     //show add to cart if it's hidden
}
    
$('#our_price_display').text(text_or_price);
    }
    else
    {
        $('#our_price_display').text(formatCurrency(0, currencyFormat, currencySign, currencyBlank)).trigger('change');
    }
 

Edited by Zen_j1 (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...