0

on Magento 2.2.5 I want to move the related products via xml . I have a div with a class of "yotpo yotpo-main-widget yotpo-small" and I want the related products in side this div at the top before any of the divs/content inside this div is loaded.

In the

app/design/frontend/luma/Magento_Catalog/layout/catalog_product_view.xml

I have the below in my xml

<?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="page.main.title" destination="product.info.main" before="-"/>
    <move element="prev_next_products" destination="product.info.main" before="-"/>
    <move element="product.info.stock.sku" destination="product.info.price" after="product.price.final"/>
    <move element="product.info.review" destination="product.info.main" before="product.info.price"/>
    <move element="product.special.price" destination="product.info.main" after="product.info.price"/>

    <move element="product_view_try_on" destination="product.info.media" before="-"/>
    <referenceBlock name="product.attributes" remove="true" />
    <referenceContainer name="content">
          <block class="Magento\Catalog\Block\Product\View" name="product_custom_name" template="Magento_Catalog::product/view/product_custom_name.phtml" before="-"/>
          <block class="Magento\Framework\View\Element\Template" name="product_view_try_on" before="product.info.media" template="Magento_Catalog::product/view/try_on.phtml"/>
    </referenceContainer>
    <move element="product_custom_name" destination="product.info.main" before="-"/>
    <referenceBlock name="page.main.title" display="false"/>
    <move element="product_related" destination="yotpo-main-widget" before="-"/>
</body>

4
  • what is "column.main"? can you please add your XML file and update your question? Aug 14, 2019 at 19:43
  • Where do you want to move your related product block? Aug 14, 2019 at 20:44
  • I think you should create new container after "content" and move related block into it Aug 15, 2019 at 2:13
  • see my updated post info
    – Jayreis
    Aug 15, 2019 at 2:29

1 Answer 1

0
<move element="product_related" destination="content" before="yotpo-main-widget"/>

Try to change before to after.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.