How can I show related products on bottom section of the product view page?
I want to show 3 related products in bottom part of product view page in Magento 2
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
Adding related product in Magento 2 is very easy. Here are steps
Hope it will help someone.
I presume you are falling back to the blank or Luma theme? If this is the case you need to move the related products using the
<move element="catalog.product.related" destination="block-name-where-you-want-to-place-it" />
And then add the related products to each product through the admin (if you're not using sample data).
Default theme(Luma) will show related products in bottom part of product view page.
If not show, it is possible the Visibility of your related products is Not Visible Individually.
The "Visibility" setting is in the product edit page.
If you are using other theme or your custom theme, you could customize the "related products position" by layout file.
In the directory
app\design\frontend\Vendor\Your_theme_name\Magento_Catalog\layout\, create the file
catalog_product_view.xml, in it write the codes like below, then related products will show in bottom part of product view page.
<?xml version="1.0"?> <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <move element="catalog.product.related" destination="content" /> </body> </page>
<move>, you could add
after | before attribute to assign the element's position relative to siblings. If the attribute is omitted, the element is placed after all siblings.