Issue with unique_gateways Storing Multiple Values in Shopify Staff Notifications

Hello Shopify Community,

I have a question regarding the unique_gateways variable used in Shopify’s staff notification emails.

My company operates multiple online stores, one of which is on Shopify. Orders from Shopify are integrated into a system that centralizes order management for all our stores. This is done by configuring the staff notification emails with a specific template in Shopify.

We are encountering an issue where multiple payment methods are being concatenated into the unique_gateways field, which is causing errors in our centralized system, as it cannot correctly identify the payment method used.

I have two main questions:

  1. Under what conditions does unique_gateways store multiple values in one order? For instance, it appears that this issue may occur when a customer tries Shopify Payments first and then switches to Cash on Delivery, but I do not have definitive evidence, and it is difficult to reproduce the issue consistently.

  2. If unique_gateways contains multiple concatenated values, I would like to use only the last payment method. Based on my understanding, if unique_gateways is treated as an array, does the below code correctly extract the last value?

    {{ unique_gateways | last }}

Any help or guidance would be greatly appreciated. Thank you in advance!