Klaviyo - How to take recipients directly to checkout with their gifted subscription

Some aspects of this article require programming knowledge of HTML and Shopify Liquid. Please note this customization is not officially supported.

Govalo's Subscription Gifts functionality is described on Subscription Gifts - How it works, and by default, recipients that have been gifted a subscription receive a code that they can redeem towards the purchase of that subscription.

Some merchants may wish to cut on some steps and take the recipient directly to a pre-filled checkout, containing the gifted subscription and the redeemable code applied. While this involves some more detailed customization, it may be possible to achieve the desirable results through our integration with Klaviyo.

Since this consists in building a custom URL within your email template, it's first necessary to disable Klaviyo's Email-to-website Tracking, to prevent Klaviyo from breaking the custom URL. Klaviyo provides further details about this feature here.

Note: make sure that you are not making use of the Email-to-website Tracking before disabling it. If you are unsure of how disabling this setting will affect you, we recommend reaching out to Klaviyo's support or a Klaviyo expert.

It may be possible to disable the Email-to-website Tracking setting and have the _KX parameter included in your URLs through some advanced customization. Given the effort and complexity involved, reach out to your developer if you have one, or connect with a Klaviyo partner to set this up for you.

Here's how you can disable the Email-to-website Tracking in Klaviyo:

1 - In Klaviyo, go to Settings.

2 - In the settings page, go to Email > Attribution.

3 - Uncheck the box Enable email-to-website activity tracking, then click Update Email Tracking Settings:


Next, to guide us through this example, imagine you have three subscription options that can be sent as a gift - 1-Month, 3-Months, and 6-Months. Once you have added your subscription products to Govalo, it will create a copy of each product on Shopify, used by Govalo when a subscription is sent as a gift. You will notice the copies have "Gift" appended to their title:

Pay attention to the difference, because when building your email template and the custom URL, some parts will refer to the ID in the original product, and other parts will refer to the ID in the copy. Setting up the logic around the custom URL will require you to manually obtain the corresponding IDs from Shopify, so the checkout is filled with the correct subscription.

You can use the example below as an alternative to the template presented in step 7 on Creating your Flow and Email Template - Subscription Gift, in order to build a custom URL that will take the recipient directly to checkout:

<p>You received a subscription gift!</p>

<p>Hi {{ event.recipient }}! {% if event.sent_to_self %}Here's your subscription gift.{% else %}{{ event.customer }} thinks you deserve to treat yourself.{% endif %}</p>

{% if event.sent_to_self %}

{% else %}

{% if event.gift_note != "" %}

<p>They also wanted us to tell you this:</p>

<p>{{ event.gift_note }}</p>

{% else %}

{% endif %}

{% endif %}

<p>

{% if event.product_id == '<GIFT_COPY_PRODUCT_ID_1MONTH>' %}

<a href="https://<MYSHOPIFY_URL>/discount/{{ event.gift_card_code }}/?redirect=/cart/add?items%5B%5D%5Bid%5D=<ORIGINAL_VARIANT_ID_1MONTH>%26items%5B%5D%5Bquantity%5D=1%26items%5B%5D%5Bselling_plan%5D=<ORIGINAL_SELLING_PLAN_ID_1MONTH>%26return_to=/checkout" target="_blank">Redeem your subscription</a>

{% elsif event.product_id == '<GIFT_COPY_PRODUCT_ID_3MONTH' %}

<a href="https://<MYSHOPIFY_URL>/discount/{{ event.gift_card_code }}/?redirect=/cart/add?items%5B%5D%5Bid%5D=<ORIGINAL_VARIANT_ID_3MONTH>%26items%5B%5D%5Bquantity%5D=1%26items%5B%5D%5Bselling_plan%5D=<ORIGINAL_SELLING_PLAN_ID_3MONTH>%26return_to=/checkout" target="_blank">Redeem your subscription</a>

{% elsif event.product_id == '<GIFT_COPY_PRODUCT_ID_6MONTH' %}

<a href="https://<MYSHOPIFY_URL>/discount/{{ event.gift_card_code }}/?redirect=/cart/add?items%5B%5D%5Bid%5D=<ORIGINAL_VARIANT_ID_6MONTH>%26items%5B%5D%5Bquantity%5D=1%26items%5B%5D%5Bselling_plan%5D=<ORIGINAL_SELLING_PLAN_ID_6MONTH>%26return_to=/checkout" target="_blank">Redeem your subscription</a>

{% else %}

<a href="https://redeem.govalo.com/subscription/{{ event.hash }}" target="_blank">Redeem your subscription</a>

{% endif %}

</p>

<p>Total value: {{ event.card_value}} </p>

<p>Subscription image:</p>

<p><img alt="Gift card image" style="height: 300px; width: auto;" src="{{ event.gift_card_image }}" /></p>

The if/else conditional above will build the custom URL according to the gift sent, therefore the variables indicated below need to be replaced as follows:

  • <MYSHOPIFY_URL>: your myshopify URL, e.g. 'govalo-site.myshopify.com'.
  • <GIFT_COPY_PRODUCT_ID_1MONTH>: the product ID of the copy created by Govalo, indicating which subscription option has been gifted. See Find a variant ID - the product ID will be the first number that appears after "/admin/products/".
  • <ORIGINAL_VARIANT_ID_1MONTH>: the variant ID of the original subscription product to be added to the cart when the recipient is redeeming it. See Find a variant ID.
  • <ORIGINAL_SELLING_PLAN_ID_1MONTH>: the selling plan ID of the original subscription product, which ensures it is processed as a subscription. Finding the selling plan ID is a bit tricky - an idea of how to find it is to add the corresponding subscription to the cart, then access <your_store_url>/cart.json and look up for selling_plan.

  • Please note that the URL built does not clear the cart, so if a recipient clicks the link in the email multiple times, it will add more than one subscription to their cart. In that case, the recipient must go back to the cart in order to adjust the subscription quantity.
  • The template presented above is merely a suggestion of how you can make use of the variables sent by the Govalo event in a structured email. If you need further assistance with setting up your email template, we recommend reaching out to Klaviyo support or a Klaviyo expert.

Still need help? Contact Us Contact Us