Solved

How to turn the add-to-cart button into an external link button?

Wolfi
Shopify Partner
6 0 2

Dear,
I am using the Refresh theme and would like to change the add-to-cart into an external link button, but I don't want to use an app. I already found a guide that supports Vintage-Shopify-Themes, but I am using an 2.0-Theme.

 

I want to do this in bulk, so not just only with one link. It would be great if I could change the external link when I create the product.

 

Is there any way I can do this?

 

 

Best, Wolfi

Accepted Solution (1)
MarinaPetrovic
Shopify Partner
559 124 182

This is an accepted solution.

Hi @Wolfi , when I said file structure, I meant on your files that contain code. When you go to Edit Code > Sections > There are many files. Is there a file called main-product.liquid or product.liquid? 
That contains this piece of code:

<div class="product-form__buttons">
                    <button type="submit" name="add" class="product-form__submit button button--full-width button--secondary" aria-haspopup="dialog">

This submit button is your add to cart button. So we should remove that and add:

<a href="URL THAT YOU WANT" class="atc-url-btn" />

 

And some styling should come later. 🙂 

M.Petrovic | Shopify Developer
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution

View solution in original post

Replies 12 (12)

MarinaPetrovic
Shopify Partner
559 124 182

@Wolfi Why don't you hide add to cart button and add another one with another url? Or maybe, I misunderstood your problem 🙂 

M.Petrovic | Shopify Developer
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Wolfi
Shopify Partner
6 0 2

@MarinaPetrovic 

 

I forgot to say that I want to do this at bulk. That means I could hide the add to card button and add a new button. The problem is, I don't know how to add a button with a changeable external link in the product editor. Do you understand what I mean?

MarinaPetrovic
Shopify Partner
559 124 182

Yeah sure @Wolfi , you'd like to do that for every product page, add button, but each page should have different url. It's great that you're on 2.0 theme.
Not a problem. I'm not sure about the file structure on your store. Could you share url so I can take a look?

M.Petrovic | Shopify Developer
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Wolfi
Shopify Partner
6 0 2

@MarinaPetrovic 

 

Sorry for the late respawns. What do you mean by Filestrukture? Do you mean the URL to my shop?

Here is my shop link: men-commodity.myshopify.com
Password: sownto

I don't care if everyone can see this website, I am atm just working on this function only anyway.

Wolfi
Shopify Partner
6 0 2

@MarinaPetrovicHey again, I would like to know if you could help me soon, because I need to get this to work asap. If not, that's no problem, I just need to know. Thanks

MarinaPetrovic
Shopify Partner
559 124 182

This is an accepted solution.

Hi @Wolfi , when I said file structure, I meant on your files that contain code. When you go to Edit Code > Sections > There are many files. Is there a file called main-product.liquid or product.liquid? 
That contains this piece of code:

<div class="product-form__buttons">
                    <button type="submit" name="add" class="product-form__submit button button--full-width button--secondary" aria-haspopup="dialog">

This submit button is your add to cart button. So we should remove that and add:

<a href="URL THAT YOU WANT" class="atc-url-btn" />

 

And some styling should come later. 🙂 

M.Petrovic | Shopify Developer
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Wolfi
Shopify Partner
6 0 2

@MarinaPetrovicThanks for the reply. The filename is "main-product.liquid". Removing the add-to-card button is already working 🙂

jamal4e
New Member
5 0 0

Hi is there a way to just apply this to certain product pages and not all?

jamal4e
New Member
5 0 0
MarinaPetrovic
Shopify Partner
559 124 182

Hi @jamal4e , sure there is a way. You should add condition that check which product page are you at:

{% if product.url == '/products/product-name' %}
 //your code
{% endif %}

 

M.Petrovic | Shopify Developer
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
ecommexio
Visitor
2 0 0

Hello, I have done the search you mentioned and in my code it did not give me any coincidence. Is there another way and should I say another way?

ecommexio
Visitor
2 0 0

Could we get this updated? Right now I'm trying to solve it and it doesn't appear the same anymore, I look forward to your comments. Thank you.