How can I pull the most recent product the person ordered in an email?

How can I pull the most recent product the person ordered in an email?

ShelHealth
Excursionist
28 0 8

I'm trying to set up a custom liquid in an email template to send the customer a reminder to re-purchased the product that they previously ordered.

 

I've tried using customer.orders, but it comes up blank. In fact, even customer.name/customer.email comes up blank. How can I access the previous order information of the email recipient?

 

Alternatively, if there is no way to do this via Liquid, is there an e-mail API? I tried finding it but the closest thing I found was MarketingEvent but I don't think I can schedule emails through that.

 

Thanks

Replies 5 (5)

ShelHealth
Excursionist
28 0 8

Liam
Shopify Staff
2873 312 821

Hi ShelHealth,

 

Which specific email notification are you looking to customise? As you noted it may not be possible to access previous order data via Liquid - it could be worth seeing if the Orderly Emails app might achieve the effect you're looking for here. 

 

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

ShelHealth
Excursionist
28 0 8

I'm trying to create a flow with a new email notification to re-purchase the same product that the person last purchased. I need to pull which product they purchased and send it in an email.

 

The app you suggested seems to just offer different templates for already existing email options.

Liam
Shopify Staff
2873 312 821

Okay - if it's a net new email then you'd want to explore other options. How are you currently sending this reminder (eg via the Shopify Email app)? There's no method to automate sending emails to previous customers, so if you wanted to leverage our API, you'd need to create a email service that pulls order and customer data via the API. Have you looked at other app solutions such as Omnisend or Automizely Email Marketing

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

gerardm
Shopify Partner
4 0 4

From what I can tell you can only use the variables listed here:

 

https://help.shopify.com/en/manual/promoting-marketing/create-marketing/shopify-email/create-email/c...

 

So something like {{ data.customer.first_name }} -- You will not be able to gather order data. You may want to checkout notification Webhooks:

 

https://help.shopify.com/en/manual/orders/notifications/webhooks