Question

Is it possible to add cross sell products on the checkout page? How can we do that? Any help will be appreciated. Thank you.

Était-ce utile?

La solution

You can show cross-sell products on checkout page by add below code to checkout_index_index.xml

app/design/frontend/YourVendorName/YourTheme/Magento_Checkout

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="content">
            <block class="Magento\Checkout\Block\Cart\Crosssell" name="checkout.cart.crosssell" template="Magento_Catalog::product/list/items.phtml" after="-">
                <arguments>
                    <argument name="type" xsi:type="string">crosssell</argument>
                </arguments>
                <block class="Magento\Catalog\Block\Product\ProductList\Item\Container" name="crosssell.product.addto" as="addto">
                    <block class="Magento\Catalog\Block\Product\ProductList\Item\AddTo\Compare"
                           name="crosssell.product.addto.compare" as="compare"
                           template="Magento_Catalog::product/list/addto/compare.phtml"/>
                </block>
            </block>
        </referenceBlock>
    </body>
</page>
Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top