"Add to cart" button in Header bottom layout, possible?

Is it possible to have a “add to cart” button in the bottom layout (demo here https://www.plasticsurgeryholiday.com/shop/fierte-breast-cream/)

I don’t want to create 11 headers and then select page for each product.

Thanks.

Hi @ak47marx

Yes, it is possible to that.

Just follow these steps.

  1. Add a Class to the button, for this example I added “add_to_cart”.

  2. Then add this javascript to Theme Options > JS

// note this "add_to_cart" text bellow needs to match the class you added to the button
$( ".add_to_cart" ).click(function() {
  $( ".cart .single_add_to_cart_button" ).click();
});

Hope this helps.

Thanks

Thanks. I’m a little lost about the second part - cart class. Currently I get

Uncaught TypeError: $ is not a function
at (index):1633

$( ".add_to_cart" ).click(function() {  

For the button I added add_to_cart class in customize, and left the url empty.
But not sure what to put “.cart .single_add_to_cart_button” that part.

Hi,

Try this, replace the previous JS with this one.

(function($){ 
	$( ".add_to_cart" ).click(function(e) {
    $( ".cart .single_add_to_cart_button").click();  
    return false;
  });
})(jQuery);

You can leave this “.cart .single_add_to_cart_button” as it is.

Hope this helps.

If it is still not working, can we ask for the login details for your site in a Secure Note? So we can help you make the button work.

Thanks

Works perfect, thanks :slight_smile:

We are glad we could help.

You’re Welcome :smiley:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.