Home Page
To add the recommendation widget to the home page, we can use one of the following options:
- app blocks with Online Store 2.0 themes
- or editing theme files (Advanced).
Note: App blocks can only be used with Online Store 2.0 themes. If your theme is not an Online Store 2.0 theme, please use other options to embed the widget..
- Go to Shopify Admin Panel -> Online Store -> Themes
- Under "Current Theme" section, click on "Customize" to edit the customize the current theme.
- In the Theme Editor, navigate to the home page you want to customize.
- On the home page of the theme editor, add a new block or new section using the left side panel:
Then select the widget you want to add under "Apps":
- Preview the changes on the page.
- Click on "Save" button on the top right to save your changes.
- Now go to the home page of your website that you just edited. VoilĂ , the recommendation widget shows up on the page!
Note: If you are theme developer, skip this tutorial and use your local liquid development environment to insert the widget HTML snippet
- Go to Shopify Admin Panel -> Online Store -> Themes
- Under "Current Theme" section, click on Actions -> Edit code to edit the liquid theme code.
- On the left side of the Theme Editor, click on Sections ->Add a new section to add a new template file for the recommendation widget. Note: the files layout and content may vary based on different themes.
- Give the new template a name and click on create section button. In this example, we named it as "recommendation-widget".
- In the newly created widget liquid template file, add the widget HTML snippet
at the first line, and change the name of the template in the schema. See Shopify official documentation for how to edit the theme file.
- Click on "Save" to save your changes.
- On the left side of the Theme Editor, click on Config ->settings_data.json to declare the newly created recommendation widget template as a section so that we can insert it to the home page.
- In the settings_data.json, under "current" -> "sections", add the new template you just defined. the "type" should match the template name.
- Scroll down to the "content_for_index" section under the same "current" section, and add the new section to the desired place on the home page. For example, if you want to display the recommendation widget between the hero image and the featured collections, then put the new section in between those two sections:
- Click on "Save" to save your changes.
- Now go to the home page of your website that you just edited. VoilĂ , the recommendation widget shows up on the page!