Home > Shopify Development > Generate a new section file in your theme

How to generate a new section file in your theme in Shopify

Sam Nguyen
Sam Updated: March 22, 2024

Share:

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

If you use Shopify to create your own business page, you are able to create page template that allows you to customize your page content. In page template, you can also create as many sections as you want to modify your page. Section in your theme is the means to diversify the function on your page, you can create section to disable Add to cart button or to delete products price when they are out of stock.

Assume that you know how to create a new page template, then want to customize that template with more sections, you need to change the Liquid tag in the file code and so on. You can also create another section in your same new page template as you need. In this article, you will know how to generate a new section file in your theme in Shopify.

How to generate a new section file in your theme in Shopify

In this tutorial, we assume that you already know how to generate a new template file in your theme. You can refer to the previous article about it. Continue to take the same example of that tutorial, which is to create a template for products that are not for sale, you will practice to generate a new section file in your theme as follows:

Step 1: Add a new section

Click Add a new section in the Sections directory. Name your section exactly the title that you used in the Liquid tag for your new template file which is product-not-for-sale.

image

Step 2: Create section and copy code

Click Create section. After that, in the code editor zone, your new section will be shown, and will be filled with some default code. Empty the file by delete all the default codes.

Step 3: Paste code to new section

Next, open an existing section in your theme then copy the code and paste into your newly created section file. For instance, if you want to add any section to your product template (assume that you already create that template), then you will open that template by clicking at product-template.liquid, and copy the entire code of the file. Go back to your empty section file that you have created previous and paste in the code you have copied.

Step 4: Customize your section

Now you can continue to customize your template as much as you want.

Step 5: Finish

To finish, click Save. For app version, you can do the same process in order to generate a new section file in your theme.

Conclusion

We hope that this tutorial will help you easily customize your own business website by adding new section to your theme, noted that you can create as many section as you want. If you have any trouble while practive this tutorial, you can hire a Shopify expert for help or ask our support team.


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.