I wanna replace my buy button/Add to cart button with a custom link url (enquiry button)

Solved

I wanna replace my buy button/Add to cart button with a custom link url (enquiry button)

Yash234
Shopify Partner
17 0 4

I am using DAWN theme and i wanna replace the link for the buttons available on the product page (any one)
here is my store link : https://b58128-e6.myshopify.com/products/diamond-earring?variant=47798300967203

Yash234_0-1710705732305.png

as you can see the make an enquiry button is redirecting to checkout can anyone please help me out

 

Accepted Solution (1)

Vinsinfo
Shopify Partner
486 165 169

This is an accepted solution.

@Yash234 

Please follow below steps to add a button redirect to custom URL. Let me know whether it is helpful for you.
1.  From admin, go to "Online Store" -> "Themes".
2. Click "Customize" button from the current theme.
3. Go to the product page and select "Product information" section.
Vinsinfo_1-1710855826429.png
4. Click "Buy buttons" and uncheck the "Show dynamic checkout buttons" checkbox

 

Vinsinfo_2-1710855923128.png
5. Click "Add block" and select "</> Custom Liquid".
Vinsinfo_3-1710856040655.png

 

6. Click "Custom Liquid" and paste below code in the field as shown in the attached image below.

 

<a href="your_custom_url" class="button custom_url">Make An Enquiry </a>
{% style %}
.custom_url {
    display: flex !important;
    width: 100%;
    margin: 0px !important;
}
.product__info-container .product-form {
    margin: 0px !important;
}
{% endstyle %}

 

 

Vinsinfo_5-1710860724137.png
7. Drag the newly added "</> Custom Liquid" and place it below the "Buy buttons", it will shown like below.
Vinsinfo_6-1710860810555.png

 

Please provide your support by click "Like" and "Accepted" if our solution works for you. Thanks for your support.
Please reach out to bizdev@vinsinfo.com for any enquires related to Shopify.
Our Services: Custom Theme Development, Theme Customization, Custom Feature Implementation, Data Migration, Custom APP Development, Website Optimization and Google Merchant Center Support

View solution in original post

Replies 5 (5)

swym
Trailblazer
182 37 79

Hello @Yash234

 

It's good practice to create a copy of your theme and work on that to preview the changes before applying, especially if you are editing the raw code. Alternatively, you can also use the Shopify theme editor’s versions to revert to previous versions, but it is not recommended if you are making multiple changes.

 

Now to your specific question on replacing Shopify's default 'Buy Now' button with a custom link. First, you will need to disable the “Buy Now” button from the customization settings of the product page, as shown in the screenshot below:

swym_1-1710827550299.png

 

After disabling the checkbox, the Buy Now button will no longer appear in your store.


Now to add a custom link please follow the steps below: 

  1. Open the code editor. (Referring to Dawn theme here)

    step-3.png

  2. Open the “snippets/buy-buttons.liquid” file.
    swym_2-1710828127904.png

     


  3. Search for "{%- if show_dynamic_checkout -%}" and add your custom button code above it. It should look something like below:

    swym_3-1710828170105.png

     


  4. Done? Now save the file, and try previewing to confirm if the changes work for you.  In the reference above, it looks something like below:
    swym_4-1710828256322.png

     


  5. You will need to add additional CSS if you want to match it according to your store's theme/branding. 

Hope this helps!

Regards,
Abhishek from Swym

- Appreciate the assistance. Show your approval with a Like! And when your question finds its answer, seal the deal by marking it as an Accepted Solution!
- Our Solutions: Wishlist Plus | Swym Back in Stock Alerts | Swym Gift Lists and Registries

Vinsinfo
Shopify Partner
486 165 169

This is an accepted solution.

@Yash234 

Please follow below steps to add a button redirect to custom URL. Let me know whether it is helpful for you.
1.  From admin, go to "Online Store" -> "Themes".
2. Click "Customize" button from the current theme.
3. Go to the product page and select "Product information" section.
Vinsinfo_1-1710855826429.png
4. Click "Buy buttons" and uncheck the "Show dynamic checkout buttons" checkbox

 

Vinsinfo_2-1710855923128.png
5. Click "Add block" and select "</> Custom Liquid".
Vinsinfo_3-1710856040655.png

 

6. Click "Custom Liquid" and paste below code in the field as shown in the attached image below.

 

<a href="your_custom_url" class="button custom_url">Make An Enquiry </a>
{% style %}
.custom_url {
    display: flex !important;
    width: 100%;
    margin: 0px !important;
}
.product__info-container .product-form {
    margin: 0px !important;
}
{% endstyle %}

 

 

Vinsinfo_5-1710860724137.png
7. Drag the newly added "</> Custom Liquid" and place it below the "Buy buttons", it will shown like below.
Vinsinfo_6-1710860810555.png

 

Please provide your support by click "Like" and "Accepted" if our solution works for you. Thanks for your support.
Please reach out to bizdev@vinsinfo.com for any enquires related to Shopify.
Our Services: Custom Theme Development, Theme Customization, Custom Feature Implementation, Data Migration, Custom APP Development, Website Optimization and Google Merchant Center Support
Yash234
Shopify Partner
17 0 4

Thank you so much buddy!!! it worked...

ADG-Ireland
New Member
12 0 0

Hi, I am attempting to use this. I keep getting a 404 error. I'm guessing you have to insert a custom url but I am wondering where in the code does it go and where can I get the url from? Thank in advance.

IlBocciolo
Visitor
1 0 0

Ciao @Vinsinfo , e se invece volessi sostituire il collegamento per i pulsanti disponibili nella pagina del prodotto per una singola collezione da "aggiungi al carrello" ad "acquista su whats app"?