How to edit string variables in Liquid in Shopify

Considered as useful tool for Website designers, template language can combine static content on multiple pages. Furthermore, with this amazing invention, it is possible for the developers to re-use the static data defining page’s layout. Instead of being writing in HTML as static elements, the dynamic ones will be written in Liquid.

Developed by Shopify as an open-source since 2006, Liquid which is an opern-source template language plays a role as the backbone of Shopify themes. With syntax, Liquid can interact with variables; moreover, it also has constructs inlcuding output and logic. With these efficiency of Liquid, it is now used by multiple hosted web applications such as Jekyll websites.

Used on GitHub and many software projects, Liquid is en effective tool to load dynamic content of the website in any online stores. Its code including 3 main categories is objects, tags, and filters. All of them will be used in template files inside Liquid. Eventually, those files will create a To make a theme.

The variations of the Liquid is getting more and more because it is very easy for the users to add their own significant number of codes in both Shopify and Jekyll. Besides, there are 5 types of Liquid are String, Number, Boolean, Nil, Array. String is the texts which will be presented by wrapping a variable’s value in single or double quotes.

The Shopify store owners can use string filters to manipulate outputs and variables in Shopify. This article How to edit string variables in Liquid guides the Shopify store owners to modify their string variables such as replacing or uppercasing.

How to edit string variables in Liquid in Shopify

Step 1: Replace the string variables

By using case for Liquid filters, the admins can change the heading baked goods* to **baked bread Firstly, after the variable, admins can add a | then pass it a filter to replace in this case.

...
<h2></h2>
...

replace the string variables 1

replace the string variables 1

Step 2: Upcase the string variables

Besides, the users can chain filters like making the heading uppercase by | upcase

...
<h2></h2>
...

upcase the string variables

Conclusion

Base on the latest version of Liquid, the storefront will have the optimal performances. We hope that admins can manage their output easily with the guide from this tutorial How to edit string variables in Liquid in Shopify. Furthermore, with the expansion to other applications, Jekyll also an effective tool for the Shopify store owners and they can discover more through another blog How to use Liquid in Jekyll static site generator.