MODULES
...
eCommerce
Products

Detail Layouts

10min
customise the way products look on their automatically generated detail pages and add functionality for adding the product to the cart prerequisites you have created products in the admin getting started this tutorial will show you how to output information about a product on its automatically generated detail page it will cover how to find where product layouts are stored on code editor develop a wrapper liquid file include an item liquid file add functionality for a user to add the product to cart file structure in site manager/code editor , the folder structure for ecommerce layouts is as below layouts modules module 14 product name of my layout list wrapper liquid item liquid detail wrapper liquid item liquid product attributes my attribute layout liquid creating a new set of product layouts to create a new set of product layouts create your folder at the level of "name of my layout" inside that, the folders and files should be created as shown above detail layout development as with list views, the detail folder inside your new layout folder should contain a wrapper liquid and an item liquid file refer to the folder structure at top of the document for reference you also have the option of creating an attribute layout which can be included inside your item liquid file to show product variations wrapper liquid wrapper liquid detail view example {% include 'modules/siteglide ecommerce/ecommerce/get/get products' item layout 'item' %} this is the file for the main section code e g a section title or padding you will need to use the following liquid to include your item liquid file inside the wrapper and give it access to information about the product {% include 'modules/siteglide ecommerce/ecommerce/get/get products' item layout 'item' %} item liquid item liquid detail view example {{this\['name']}} quantity {% if this\['description'] %} product description {{this\['description']}} {% endif %} {% include 'ecommerce/cart add' %} view my cart unlike the list view, the code in the item liquid file in the detail folder will only be displayed once instead of looped inside the item liquid file, you'll have access to the "this" object, which contains the fields you'll need see reference for available fields or output {{this | json}} in the item liquid file to see the exact data available to you add to cart to create a button to add the current product to the cart use the following liquid code {% include 'ecommerce/cart add' %} quantity to add to cart in order to use the "add to cart" button, you'll also need to have an input element where users can select the quantity they'd like to add make sure it has the correct data attribute quantity