How to use Liquid Filters in Shopify to Parse Global ID's

A handy thing to know when working with Shopify's Liquid language

Rob Johnson

By Rob Johnson

Wed Mar 30 2022

Shopify uses an open source language called, Liquid for it's page and email templating and also logic within Shopify Flow. Liquid enables you to add objects/variables dynamically. It's helpful to learn about the syntax and Shopify has good documentation on what it supports:

Liquid Filter Example

You want to place a HOLD on a fulfillmentOrder when an order contains more than 20 items. This will prevent the order from being automatically fulfilled via Shipstation, or whatever 3PL provider you've connected to your store.

You've created a workflow in Shopify Flow that will send an HTTP request once this condition is met. The problem is that the variable returns as:


However, the endpoint you're trying to hit requires only the integer of the gid.


So you need to somehow return only the number


This is where Liquid Filters come in handy. You can use split and last in the following way to return 1234567890.

{{  | split: "/" | last}}

The above filter splits on / and grabs the last split item which is 1234567890.

There are a lot of applications for this in Shopify as each major object has a unique global identifyer assigned.

# commerce 14 # seo 5 # tools 6 # amazon 1 # sql 4 # shopify 9 # javascript 13 # projects 4 # css 2 # git 2 # php 3 # analytics 4 # monitoring 2 # api 6 # python 2 # aws 2