Jump to content

How to show the "Add to cart" button on some products pages only?


Jess Chen

Recommended Posts

Hi, 

I am not really familiar with Prestashop. I would like to show the "Add to cart" button on some of the products pages only.

I have tried to tick off the "Available for order" options and change the quantity to 0, but the button is still showing.  

Can anyone help me with it?

Thanks,

Jessica

 

 

Link to comment
Share on other sites

Hi...
if you tick off the "Available for order" options for admin then "Add to Cart" button is disable not hide.

if you need to hide button then you need to change this  "product-add-to-cart.tpl" which is locate in " themes/your_themes/templates/catalog/__partials/product-add-to-cart.tpl" appox line 44

 

//current code

<div class="add">
          <button
            class="btn btn-primary add-to-cart"
            data-button-action="add-to-cart"
            type="submit"
            {if !$product.add_to_cart_url}
              disabled
            {/if}
          >
            <i class="material-icons shopping-cart">&#xE547;</i>
            {l s='Add to cart' d='Shop.Theme.Actions'}
          </button>
        </div>

//hide button code 

{if !$product.add_to_cart_url}
<div class="add">
          <button
            class="btn btn-primary add-to-cart"
            data-button-action="add-to-cart"
            type="submit"
            {if !$product.add_to_cart_url}
              disabled
            {/if}
          >
            <i class="material-icons shopping-cart">&#xE547;</i>
            {l s='Add to cart' d='Shop.Theme.Actions'}
          </button>
        </div>
{/if}



 

Link to comment
Share on other sites

 
 
 
 
 
3
On 8/20/2019 at 5:28 PM, Nishith said:

Hi...
if you tick off the "Available for order" options for admin then "Add to Cart" button is disable not hide.

if you need to hide button then you need to change this  "product-add-to-cart.tpl" which is locate in " themes/your_themes/templates/catalog/__partials/product-add-to-cart.tpl" appox line 44

 


//current code

<div class="add">
          <button
            class="btn btn-primary add-to-cart"
            data-button-action="add-to-cart"
            type="submit"
            {if !$product.add_to_cart_url}
              disabled
            {/if}
          >
            <i class="material-icons shopping-cart">&#xE547;</i>
            {l s='Add to cart' d='Shop.Theme.Actions'}
          </button>
        </div>

//hide button code 

{if !$product.add_to_cart_url}
<div class="add">
          <button
            class="btn btn-primary add-to-cart"
            data-button-action="add-to-cart"
            type="submit"
            {if !$product.add_to_cart_url}
              disabled
            {/if}
          >
            <i class="material-icons shopping-cart">&#xE547;</i>
            {l s='Add to cart' d='Shop.Theme.Actions'}
          </button>
        </div>
{/if}



 

Hi Nishith,

Thanks for your reply, but I couldn't find the file "product-add-to-cart.tpl", any idea about it?

Jessica

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...