Solved

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

Yash234
Shopify Partner
16 0 5

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
157 56 50

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.

View solution in original post

Replies 3 (3)

swym
Excursionist
10 3 4

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

Vinsinfo
Shopify Partner
157 56 50

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.
Yash234
Shopify Partner
16 0 5

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