Solved

Spree integration - where to find cart token?

  • 13 July 2022
  • 1 reply
  • 16 views

Badge

Hello, 

we are running a spree commerce site. We are using the official integration at https://help.klaviyo.com/hc/en-us/articles/115005255448-How-to-Integrate-with-Spree.

Everything works great, except the “Return to your cart” link. Spree requires a token to rebuild the cart, but we could find that variable anywhere. Without the token, cart will be empty, which makes the flow useless.

Can anyone please let me know if that variable exists in current Spree integration or not? If yes, where could i find it?

Thank you

 

icon

Best answer by Dov 13 July 2022, 18:55

View original

1 reply

Userlevel 7
Badge +56

Hi @stevensbooks,

Thanks for sharing this question with our community.

There currently isn’t a cart rebuild token for the Spree integration. Instead, we’ll use the organization URL/cart to direct the user back to their cart page on your site. 

I noticed you had also reached out to our support team on this (they have filed a feature request to expand the integration to include the rebuild token). I’m going to post their reply here in case anyone else is following along and looking for alternative solutions:

OPTION 1: Continue using the default Started Checkout event, but pass the cart token into Klaviyo as a custom profile property via our Identify API. 

Please refer to our guide here for Javascript (frontend) Identify calls: https://developers.klaviyo.com/en/docs/identify-api-reference 

Please refer to our guide here for Server-side Identify calls: https://developers.klaviyo.com/en/reference/identify-post

Either way, you will be able to pass the cart token into Klaviyo as a custom profile property. Once the profile property exists within Klaviyo, you can refer to it via this guide: https://help.klaviyo.com/hc/en-us/articles/115005084927-Guide-to-Template-Tags-and-Variable-Syntax 

The cart URL would look something like this: https://YOURWEBSITE.com/cart?token={{ person|lookup:'CART_PROPERTY' }}

OPTION 2: Record your own custom Started Checkout event and use that as the Flow's trigger instead
Please refer to our guide here: https://developers.klaviyo.com/en/docs/guide-to-integrating-a-platform-without-a-pre-built-klaviyo-integration#started-checkout

You will be in full control of the information you include in the custom event payload. This way, you can include the cart token in the event data and then refer to it in your Flow email. 

I hope that’s helpful.

Reply