How can I change the URL of my gift card in my online store?

MACRORY
Excursionist
32 2 7

Hey Guys,

 

I have recently found a problem with my gift card. When I send a gift card to someone, they will be linked to a address start with "checkout.shopify.com". However, it should be "mystoredomain.com/gift_cards/...something". So I look up on shopify help center, there is an article says 

gift_card.url

Returns the unique URL that links to the gift card's page on the shop (rendered throughgift_card.liquid).

But I couldn't find any code that render the url for my gift card.

 

Can someone help me with that! 

 

Thanks

Replies 36 (36)

Qualitycheck
Shopify Expert
1449 114 233

Hi @MACRORY,

 

Could you please send Store URL in order to check the actual URL?

Hamzah-Bao
Visitor
3 0 0

Hi,

I am having the same issue as well, in Settings > Notifications > Gift card created, the code for the gift page link in the email template is this: <a class="button__link" href="{{ gift_card.url }}">View your gift card</a>. The gift_card.url is: 'checkout.shopify.com' URL and not the shop domain. This means that when they click on the link, land on the 'checkout.shopify.com/gift_cards' page, all the links and search bar URL on the page are incorrect.

SamAM
Visitor
3 0 0

I can see you resolved this issue, but have not stated how it was resolved.

as you might have guessed we have the same issue. Can you advise on the solution please?

Kate1c2
Visitor
2 0 0

HI @SamAM Did you ever get a reply on how this issue was fixed?  We are experiencing the same thing and I am having a hard time troubleshooting.  

SamAM
Visitor
3 0 0

Hey @

MACRORY
Excursionist
32 2 7

@SamAM @Kate1c2 

Hey Guys, sorry for the late reply. Basically, the gift card email sent from Shopify redirect customer to a checkout.shopify.com/gift_cards/xxx address. However, the gift card still works if you change checkout.shopify.com to yourdomain.com/gift_cards/xxx  There are few options you could do.

 

1. Change the URL your send to customer in your email notification template.

Change the following elment in your Email Notification 

{{ gift_card.url }}

to something like

{{ gift_card.url | replace: "checkout.shopify.com", "yourdomain.com"}}

 

2. Redirect your customers when they go to your checkout.shopify.com page

Add javascript to your gift_card.liquid that identify the current url, if it is checkout.shopify.com/gift_cards/xxx ... ,then redirect your customer to yourdoamin.com/gift_cards/xxx 

You could search on stackoverflow to achieve this option

 

Kate1c2
Visitor
2 0 0

Much appreciated for this information @MACRORY ! 

 

@SamAM Additionally, after chatting with a Shopify Guru person as well, they determined that when we changed our theme within the last couple of months that our new theme we chose has some impact over this link not working too.  If you are using a third party theme, that could also be the issue.  We are using the prestige theme.  The theme developer has reached out so I will let you know if they are able to fix it.  They might also be using the same thing that @MACRORY mentioned above!  

 

Best of luck!

SamAM
Visitor
3 0 0

Oh my word. Thank you for your swift reply. I just implement option 1 and it works completely. Thank you so much this is such a help to us.

TechSolver
Pathfinder
134 3 17

@MACRORY is correct but missed a little something. For most third-party themes, this is how the notification code will look for the gift card URL:

<a href="{{ gift_card.url }}"

 

Makes sure to keep those quotation marks at the end. This is how it will look once you change it to your URL:

<a href="{{ gift_card.url | replace: "checkout.shopify.com", "www.yoursite.com" }}"

 

jenni2
Visitor
2 0 0

I tried to follow this but I cannot find <a href="{{ gift_card.url }}" in the code in the edit code gift card page. Is the code correct or am I doing something wrong?

TechSolver
Pathfinder
134 3 17

Hi @jenni2

I was a bit unclear. You don't edit the code of the theme. You edit the code of the notification email for Gift card created. This link will take you straight to where you're supposed to make changes.

jenni2
Visitor
2 0 0

Thank you so much! It worked! 🙂

TechSolver
Pathfinder
134 3 17

@jenni2 Glad it did!

Salmank4
New Member
7 0 0

 

Hey techsolver, the url change works fine for the e-mail but not working for the SMS. Can you please help me out with this as it is redirecting to the checkout.shopify.com.

TechSolver
Pathfinder
134 3 17

@Salmank4 I got it! Since Shopify makes you include the gift care url as is, you have to trick it. Copy and paste the below code:

 

Here's your {{ gift_card.balance | money_without_trailing_zeros }} {{shop.name}} gift card:{{ {{ gift_card.url }} {{ gift_card.url | replace: "checkout.shopify.com", "www.yoursite.com" }} . {% if gift_card.expires_on %} This gift card expires on {{ gift_card.expires_on }} {% endif%}

 

Salmank4
New Member
7 0 0

 @TechSolver thanks for the reply! I tried the code you suggested and once i clicked on the link it says page not found. 😞

 

TechSolver
Pathfinder
134 3 17

@Salmank4 The code I posted above is correct. You just need to replace your domain name in there, and the rest will happen magically.

Salmank4
New Member
7 0 0

@TechSolver  i just found out the reason why it says page not found that's because when i received the url it had https://www.mywebsite.com/giftcards/ but it is supposed to have gift_card in the url path and i made the change and i see it worked!

TechSolver
Pathfinder
134 3 17

No, you are doing it wrong. It won't work for other people if you do that.

Salmank4
New Member
7 0 0

i have removed the dot from the code which was after the flower braces and still it's the same! Not working and it said page not found

TechSolver
Pathfinder
134 3 17

@Salmank4 Please send the code you posted, including your domain name. If your domain name does not have www at the beginning, then remove that from the code below.

 

And just double-check, are you sure you pasted the exact same code as below?

 

Here's your {{ gift_card.balance | money_without_trailing_zeros }} {{shop.name}} gift card:{{ {{ gift_card.url }} {{ gift_card.url | replace: "checkout.shopify.com", "www.yoursite.com" }} . {% if gift_card.expires_on %} This gift card expires on {{ gift_card.expires_on }} {% endif%}

 

 

 

 

Salmank4
New Member
7 0 0

here's the code that i have pasted

Here's your {{ gift_card.balance | money_without_trailing_zeros }} {{shop.name}} gift card:{{ {{ gift_card.url }} {{ gift_card.url | replace: "checkout.shopify.com", "www.pashionera.com" }} {% if gift_card.expires_on %} This gift card expires on {{ gift_card.expires_on }} {% endif%}

Salmank4
New Member
7 0 0

@TechSolver 

here's the code that i have pasted

Here's your {{ gift_card.balance | money_without_trailing_zeros }} {{shop.name}} gift card:{{ {{ gift_card.url }} {{ gift_card.url | replace: "checkout.shopify.com", "www.pashionera.com" }} {% if gift_card.expires_on %} This gift card expires on {{ gift_card.expires_on }} {% endif%}

TechSolver
Pathfinder
134 3 17

@Salmank4 Try removing the 

www.
Calikim
Visitor
1 0 0

gift card.png

Is this what I replace??

TechSolver
Pathfinder
134 3 17

@Calikim wrote:

gift card.png

Is this what I replace??


No.

You need to find:

<a href="{{ gift_card.url }}"

 

and replace that with:

<a href="{{ gift_card.url | replace: "checkout.shopify.com", "www.YOURSITEHERE.com" }}"

 

m_merconic
Visitor
1 0 0

Hi we have a huge problems with the gift cards.

We translate our site with a translation app and German Users are redirected to

domain.com/DE/

Now Gift Card Visitors are also redirected to checkout.shopify.com/de/ and this page does not exist so the users end up on an error page from shopify.

Any idea how to solve this?

Corratec
Visitor
1 0 0

Perfect @

TechSolver
Pathfinder
134 3 17

@Corratec That is so kind of you!

I don't have PayPal or Revolut; I only have Cash App. My CashTag is $techeroo.

Again, thanks for being so kind - I really appreciate the sentiment.

APR-CC
Visitor
1 0 0

Hi there. I've been trying to use steps on this forum but have hit a brick wall. I edited the code, did a test purchase and was met with a 'Page not found'.

Initially, I was looking to change the 'START SHOPPING' button on the gift card page as I use Shopify on our WordPress site and the button directs to the Shopify store (which we don't use). Am I following the correct forum for this? Any help would be greatly appreciated. Thanks!FireShot Capture 505 - Here's your £0.10 gift card for Faith Baby Boutique UK!_ - checkout.shopify.com.jpg

jonhatz
Visitor
1 0 0

Any luck with this? Having the same issue. Any help would be greatly appreciated.

AmeliaCheng
Visitor
2 0 2

It's really worked !!! I have changed it for my store! thanks so much!

TechSolver
Pathfinder
134 3 17

No problem! Glad I helped.

My CashApp is $techeroo if you'd like to leave a tip.

gena_jewelry
Visitor
1 0 0

Hi everyone! I tried doing this but it's not working for me it seems... now the "explore our products" button on the gift card page is just redirecting to that same page. Any ideas?

See here: https://checkout.shopify.com/gift_cards/31846727817/feccb715e37667fa56cf3c5a5bd960f3

Thank you!

Salmank4
New Member
7 0 0

Hey macrory, the url change works fine for the e-mail but not working for the SMS. Can you please help me out with this as it is redirecting to the checkout.shopify.com.

ryantkelly
Excursionist
12 0 12

I ran into this issue on my shop (we had a larger issue where styles weren't loading - our issue was due to Gift Card specific CSS files not being present).

 

Unless maintaining branding on the Gift Card landing page is extremely important, I'd caution against doing this because:

 

  1. It does work correctly to distribute the Gift Card/allow a customer to add it to their mobile wallet.
  2. You'd have to maintain this find/replace in you email templates.
  3. Shopify probably has some good internal reason to moving it to checkout.shopify.com instead of your store URL - and I wouldn't be surprised if this breaks in the future.