Home > Shopify Development > Liquid append: Merge Two Strings to One

Liquid append: Merge Two Strings to One in Shopify

Sam Nguyen
Sam Updated: April 08, 2024

Share:

Drive 20-40% of your revenue with Avada
avada email marketing

Merging two strings in Shopify using Liquid’s append function is simple. This feature allows online sellers to combine different strings, like URLs or filenames, into one. You can create a smooth result by following a few steps, such as providing input and output values. You can also use append with variables to add even more flexibility. Let’s walk through the steps to understand how it works

Liquid append: Merge Two Strings to One in Shopify

To merge two strings, the online sellers should follow all steps:

Step 1: Input

Input

{{ "/my/fancy/url" | append: ".html" }}

Step 2:Output

The concatenated value is like that Output

/my/fancy/url.html

Step 3: Using with vaiables

Besides, append can also be used with variables:

Input

{% assign filename = "/index.html" %}
{{ "website.com" | append: filename }}

Output

website.com/index.html

Conclusion

In conclusion, using the Liquid append function in Shopify is an easy way to merge two strings, whether working with URLs or variables. You can efficiently create custom outputs for your store by following the steps outlined. It’s a simple but powerful tool for managing content.

For more tips on working with Liquid, check out these helpful articles:


Sam Nguyen is the CEO and founder of Avada Commerce, an e-commerce solution provider headquartered in Singapore. He is an expert on the Shopify e-commerce platform for online stores and retail point-of-sale systems. Sam loves talking about e-commerce and he aims to help over a million online businesses grow and thrive.

Stay in the know

Get special offers on the latest news from AVADA.