How to preview liquid variables in email notification templates

Does anyone have suggestions on how to preview liquid variables in order notification templates when the preview does not make use of them?

As an example, I am trying to see if the {{ buyer_pending_payment_instructions }} variable can output payment instructions for manual payment methods that have been added to a dev store. According to the Payment status properties in the API, this variable should ‘provide details that the buyer can use to complete their purchase offline.’

But I can’t seem to verify this by testing because (1) the preview just uses a fake gateway that I don’t actually have and the payment status is paid, and (2) the store is a development store so I can’t even place a test order using one of the manual payment gateways.

Any suggestions or advice would be hugely appreciated!

Hi Lesterdefreitas,

Totally understand the issue here - it doesn’t look like there’s an easy way to preview {{ buyer_pending_payment_instructions }} especially with a dev store that can’t process a manual payment. What you could try is on a paid store if you process a checkout that uses a manual payment as the gateway?

Hi @Liam-Shopify,

Thanks so much for the input. Are you suggesting I ask one of our clients if I can test some stuff on their live storefront? Of course I could, but that is a very messy and unprofessional approach. Is there really no other way?

If so, would it be possible to make it a feature request that the “preview” feature for email notifications can be configured, eg: what is in the cart, who the customer is, the payment method used, the payment status, the fulfillment status, discounts applied etc. Sort of like how the (now deprecated) Script Editor app lets you preview how your scripts will behave based on parameters you can control?

Theres unfortunately not really any good ways of developing and previewing Shopify email templates, since the “Preview”-button at the template level uses a static placeholder order. Thus not possible to test custom data.

I use to do something like this:

  1. Create a test order with relevant info/data
  2. Grab the order ID
  3. Go the the email template and wrap the new code/logic in a conditional based off the order id
{% if order.id == 'MY_ORDER_ID' %}
   # custom code
{% endif %}
  1. Go the the order status log and find the already sent email
  2. Click ‘Resend’ and pick your own email (last is only relevant if you used an existing customer order).

Very annoying, but it works.

1 Like

Hi @curzey,

Thank you for taking the time to share this.

This still requires being on a paid plan though, to place the test order in the first place, right? If so that is still the issue. If we were on a paid plan here we could just run test orders to see the results anyway. But in this case the merchant’s store is not yet live. So we can’t place a test order. :confused:

You’re right. This is a way of testing on paid plans with shops that’s running with real orders.

But it somewhat allows for “private” testing without any customer seeing it until you remove the order.id conditional :blush:

Can you not test it with the bogus gateway? Sorry if I’m misunderstanding.

@curzey good point, and that is useful to note, thank you!

Using the bogus gateway though would defeat the point as we are trying to test the output of the {{ buyer_pending_payment_instructions }} variable when using manual payment methods. We want to pull the payment instructions into the email template, basically.

Sorry - I totally missed that. Just instantly thought to share my way of testing email templates.

You’re right. That cannot be tested on a development store. But if you have access to a running store with applicable data, you can safely test it that way.

1 Like

@curzey sure, but that’s so bad. We would have to basically ask one of our clients if we can use their store to do some test orders. Just seems insane that there is still no easy way to test email notifications properly. And I’ve been working on Shopify stores for about 10 years now.

@Liam-Shopify any chance we get this feedback to Shopify?

I could’nt agree more.

I’ve never needed this exact case, but any better previewing experience for email templates would be very nice. Basically any “editor”, or something along those lines, to be able to set specific data for the order we are previewing.

Could be as simple as just letting us edit the order.json we are previewing, for starters.

1 Like