Skip to main content

Liquid default_errors: How to Show Default Errror Messages

Last updated: October 07 2024

Written and researched by experts at Avada Learn more about our methodology
By Sam CEO

Would you like to formulate your default error messages? Would you like to increase your customer journey when customers visit your website? Liquid in Shopify has a filter that can help you to establish message samples. The tutorial today guides you to show default error messages.

Table of content

General information of Liquid

Liquid is one of the open-source template languages in Shopify. Liquid is used as the backbone of Shopify to upload dynamic content on the front page. Liquid has been sold since 2006 and now become a good source for a lot of hosted website application such as Jekyll, salesforce desk, and zendesk.

Liquid codes are divided into objects, tags and filters. Objects tell Liquid where to show the content on a page. Double curly braces denote objects and variable names. Filters change a Liquid object’s output. There are five main types of filters, including string, number, boolean, nil, and array. Tags create logic and control flow for a template. Tags begin with two curly braces and percent signs. Tags are classified into control flow, iteration, and variable assignment.

In addition, Liquid in Shopify has other filters to support you to upload dynamic content or set specific forms on your front page.

Brief introduction to default error messages

Default filter sets a default value for any variable with no assigned value. Default error message is different.

format_address filter is used to print the elements of the address in order based on their location. The filter will only respond to the address that has been provided. This filter is compatible with the address page for customers who have contacts in your store, or on your store’s address.

How to Show Default Error Messages

In the input, you insert the formula of the filter. If your customer’s address is available in your data, then it automatically appears on your front page.

Input


{{ address | format_address }}

Output


<p>
  Elizabeth Gonzalez<br>
  1507 Wayside Lane<br>
  San Francisco<br>
  CA<br>
  94103<br>
  United States
</p>

Input


{{ address | format_address }}

Output


<p>
  Feng Sun<br>
  No. 2094, 1006, Hui Dong Xin Cun<br>
  Nanhui District<br>
  201300, Shanghai<br>
  China
</p>

Conclusion

In a nutshell, if you want to set default error messages on your website, don’t worry. Liquid in Shopify will provide you a filter to show default error messages which print the elements of the address according to their location. We hope that the tutorial is helpful and let us know if you have any difficulties.

Sam
linkedin
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.