How to add extra add to cart button on product page? Sense theme?

Solved

How to add extra add to cart button on product page? Sense theme?

jeffreym
Excursionist
21 1 5

At the bottom of my product page I want to add another add to cart button. I can only add a button then link it back to the product page but not add to cart.

 

Accepted Solution (1)
Dan-From-Ryviu
Shopify Partner
8519 1677 1688

This is an accepted solution.

please update the code 

<div style="display: flex;justify-content: center;">
<button id="product-form__submit-2" style="color: #23232;" type="button" class="button button--secondary">
<span>Add to cart</span>
</button>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
  document.getElementById('product-form__submit-2').addEventListener('click', function(event) {
    event.preventDefault();
    document.querySelector('.product-form__submit').click();
  });
});
</script>

- Helpful? Like and Accept solution to let me know or Buy me Coffee ❤️!
- Ryviu - Product Reviews app, collect product reviews, import reviews from AliExpress, Amazon, Etsy, Shopee and Walmart and CSV.
- Lookfy app: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Enjoy 1 month of Shopify for $1. Sign up now.

View solution in original post

Replies 7 (7)

Dan-From-Ryviu
Shopify Partner
8519 1677 1688

Hi @jeffreym 

You can add an HTML button into a Custom Liquid block at the bottom of your product page template and then add the script to trigger the Add to Cart button when clicking this custom button.  

- Helpful? Like and Accept solution to let me know or Buy me Coffee ❤️!
- Ryviu - Product Reviews app, collect product reviews, import reviews from AliExpress, Amazon, Etsy, Shopee and Walmart and CSV.
- Lookfy app: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Enjoy 1 month of Shopify for $1. Sign up now.

jeffreym
Excursionist
21 1 5

Okay understood, Do you have this said script?

 

Dan-From-Ryviu
Shopify Partner
8519 1677 1688

Hi @jeffreym 

You can try to use this code 

<button id="product-form__submit-2" type="button" class="button button--secondary">
<span>Add to cart</span>
</button>
<script>
document.addEventListener('DOMContentLoaded', function() {
  document.getElementById('product-form__submit-2').addEventListener('click', function(event) {
    event.preventDefault();
    document.querySelector('.product-form__submit').click();
  });
});
</script>

- Helpful? Like and Accept solution to let me know or Buy me Coffee ❤️!
- Ryviu - Product Reviews app, collect product reviews, import reviews from AliExpress, Amazon, Etsy, Shopee and Walmart and CSV.
- Lookfy app: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Enjoy 1 month of Shopify for $1. Sign up now.

jeffreym
Excursionist
21 1 5

Okay, That puts an add to cart button on the page now I will need to centre the button & make the text black

Dan-From-Ryviu
Shopify Partner
8519 1677 1688

This is an accepted solution.

please update the code 

<div style="display: flex;justify-content: center;">
<button id="product-form__submit-2" style="color: #23232;" type="button" class="button button--secondary">
<span>Add to cart</span>
</button>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
  document.getElementById('product-form__submit-2').addEventListener('click', function(event) {
    event.preventDefault();
    document.querySelector('.product-form__submit').click();
  });
});
</script>

- Helpful? Like and Accept solution to let me know or Buy me Coffee ❤️!
- Ryviu - Product Reviews app, collect product reviews, import reviews from AliExpress, Amazon, Etsy, Shopee and Walmart and CSV.
- Lookfy app: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Enjoy 1 month of Shopify for $1. Sign up now.

jeffreym
Excursionist
21 1 5

Honestly, you guys that help us newbies are amazing! I thank you kin sir!

 

Dan-From-Ryviu
Shopify Partner
8519 1677 1688

You are very welcome! 

- Helpful? Like and Accept solution to let me know or Buy me Coffee ❤️!
- Ryviu - Product Reviews app, collect product reviews, import reviews from AliExpress, Amazon, Etsy, Shopee and Walmart and CSV.
- Lookfy app: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Enjoy 1 month of Shopify for $1. Sign up now.