Skip to end of metadata
Go to start of metadata

Mobile wallet passes can be populated with content by appending values onto the Smartlink URL via additional data parameters, using the platforms public APIs, or by uploading CSV batch files using SFTP. 

These processes all utilize Shopify's Liquid Template Language framework for assigning variables, and surfacing their corresponding values onto wallet passes. We often refer to these variables and their outputs as "tokens" in our documentation, but on the backend, these are simply Shopify 'Variable Tags'. 

Although this powers the basics of placing content onto passes, Liquid Template Language also allows the manipulation of the outputs of variable tags. 

Manipulating Outputs

Using Liquid Filters, marketers can edit the variable output's formatting, append additional data, remove data, make calculations (including date manipulation), and much more.  

Within the wallet pass editor, utilizing proper Liquid Filter syntax, you can utilize the following filters supported by Shopify to edit data. 

Each filter is unique, so please follow the syntax provided in Shopify's documentation

In platform, you would place the Liquid Filter into an available text field that supports variables:

Common Use Cases & Examples

User Friendly Date Formats

Say, in your email marketing database, all expiration dates are formatted in yyyy-MM-dd, however, you would like the customer to see something that's easier to digest, like MMMM d, yyyy. 

The email you plan on delivering has a Smartlink URL that looks like:[first_name]=Patrick&data[code]=127856&data[exp_date]=2021-03-20

In the example below, we have placed a Liquid Filter that will reformat the date provided by the exp_date field so that the output is MMMM d, yyyy.

The filter placed into the pass information field is: {{ exp_date | date: "%B %d, %Y" }}

This Liquid Filter was created using Shopify's date manipulation documentation. 

Notice that the date format in the original Smartlink URL was yyyy-MM-dd. The output would appear in our filtered format as:

Formatting for International

Another common use case is editing date formats for specific regions of your audience. 

Let's say you plan on making a unique campaign for each language / country setup. However, you still have the same basic problem - your email marketing database stores the values in yyyy-MM-dd, but that format isn't used in every location you plan to run this offer.

If, for example, you were launching a campaign in Quebec, you might want to adjust the date to be formatted as dd-MM-yyyy instead of yyyy-MM-dd. In the text area, you would place the following Liquid Filter to accomplish this:

{{ exp_date | date: "%d-%m-%Y" }}

On the pass, this would now display the format localized for your particular audience in Quebec, Canada:

Rolling Expiration Dates

Another common Liquid Filter involves a rolling expiration date. 

When making offers, it might make sense for your business to make the lifespan of the offer specific to each customer, so everyone has an equal amount of time to redeem the offer vs. a static timeframe (where late adopters have less time to take utilize the promotion). 

Most businesses will take the date that the offer was activated by the customer (usually based on when the pass was added) and adds a certain amount of time to that date / time. 

Let's run through an example of how to make a campaign like this in platform. 

In this example, your business wants to run an offer campaign. This campaign will offer a free side to any customers who purchase a large burger box. The requirements state that the offer must expire 30 days after the customer 'adds' the wallet pass to their mobile wallet. 

The requirements also state that the date format should be listed as day of the week, month date, year.

Example: Monday, April 21, 1998. 

We can accomplish this utilizing Liquid Filters, just like in the examples above. 

Depending on how you are distributing these passes, you may not be able to pass over a value for what time it is on the day of the pass being added. The customer could be sent something via sms or email, but in all reality, they may not add the pass on the same day it was sent to them. 

In those cases, you can use a Liquid Filter to calculate the date the pass was was added by using the 'now' filter:

{{ "now" | date: "%d-%m-%Y" }} 

This will populate the date value with whenever the pass was actually rendered (when the pass url was clicked on and then added). 

We also need to add a section to this filter to add a predetermined number of days to this value. This will also necessitate adding additional content to this filter so that the filter understands how this value being added should effect the date content that is output. This could be done in a number of ways, in our example, we will be doing a calculation to turn our addition of 30 days into an equivalent number of seconds, then adding those seconds to the date. 

{% assign seconds = 30 | times: 24 | times: 60 | times: 60 %}

{{ "now" | date: "%s" | plus: seconds | date: "%a, %b %d, %Y" }} 

Notice the variables which will output the date format -  "%a, %b %d, %Y". We have adjusted the "%Y" to be capitalized instead of lowercase. A lowercase "%y" would out put the last two digits of the year, but we want to output the entire year value, so we used the uppercase value instead. Manipulating those values will adjust the formatting (more on date formatting can be found on Shopify). 

Pasting in the string above, our pass, added to the phone on Thursday, Feb 20, 2020, will render a date on the pass that displays Sat, Mar 21, 2020. 

Incentive Pools

You can also use these Liquid Filters in conjunction with other tools from Vibes, including our Incentive Pools. 

In platform, go ahead and select an incentive pool you wish to use. The format will look something like the filter below:

{{ incentive_code | pool_id: 104 }}

This Liquid Filter would use the wallet passes UUID value, check to see if that UUID had ever gotten a code from this pool id, and if not, would retrieve a code if there were any left in the pool. 

Let's say that your business wants to issue a thousand codes to the first thousand customers to add the pass, and send a message to the customers who were not fast enough to try again next time. Inside of the Incentive tab, you would upload a CSV containing 1000 unique codes.

You would place a 'default' filter after the pool id content in the liquid filter, so that once the pool was out of codes (returning no code for the given UUID), it would display a particular message. An example of this could look like:

{{ incentive_code | pool_id: 104678 | default: "Better Luck Next Time!" }}

  • No labels