Hi,
I'm using this solution:
https://magento.stackexchange.com/q/112858
However it removes "edit" and "remove" buttons on each item.
I would like to use my template (catalog/product/option/type/select.phtml) in my module, on the cart page.
My code is like this below:
in checkout_cart_item_renderers.xml
<referenceBlock name="checkout.cart.item.renderers.override"> <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="Vendor_Module::cart/item/default.phtml" > <block class="Vendor\Module\Block\Rewrite\Catalog\Product\View" name="product.info.options" as="product_options" template="Vendor_Module::product/view/options.phtml"> <block class="Magento\Catalog\Block\Product\View\Options\Type\Select" name="product.info.options.select" as="select" template="Vendor_Module::product/view/options/type/select.phtml"/> </block> <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions" name="checkout.cart.item.renderers.default.actions" as="actions"> <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit" name="checkout.cart.item.renderers.default.actions.edit" template="Vendor_Module::cart/item/renderer/actions/edit.phtml"/> <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Remove" name="checkout.cart.item.renderers.default.actions.remove" template="Vendor_Module::cart/item/renderer/actions/remove.phtml"/> </block> </block> <block class="Magento\Checkout\Block\Cart\Item\Renderer" name="checkout.cart.item.renderers.simple" as="simple" template="Vendor_Module::cart/item/default.phtml" > <block class="Magento\Framework\View\Element\Template" name="product.info.form.options" as="options_container"> <block class="Magento\Catalog\Block\Product\View\Options" name="product.info.options" as="product_options" template="Vendor_Module::product/view/options.phtml"> <block class="Magento\Catalog\Block\Product\View\Options\Type\Select" name="product.info.options.select" as="select" template="Vendor_Module::product/view/options/type/select.phtml"/> </block> <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions" name="checkout.cart.item.renderers.simple.actions" as="simple.actions"> <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit" name="checkout.cart.item.renderers.simple.actions.edit" template="Vendor_Module::cart/item/renderer/actions/edit.phtml"/> <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Remove" name="checkout.cart.item.renderers.simple.actions.remove" template="Vendor_Module::cart/item/renderer/actions/remove.phtml"/> </block> </block> </block> </referenceBlock>
in checkout_cart_index.xml
<referenceBlock name="checkout.cart.form"> <block class="Magento\Framework\View\Element\RendererList" name="checkout.cart.item.renderers.override" as="renderer.list.custom"/> <arguments> <argument name="renderer_list_name" xsi:type="string">checkout.cart.item.renderers.override</argument> </arguments> </referenceBlock>
However this one don't display "edit" and "remove" buttons, which are important for this page.
Solved! Go to Solution.
I have fixed this issue myself.
It was missing "override" in names.
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions" name="checkout.cart.item.renderers.override.default.actions" as="actions"> <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit" name="checkout.cart.item.renderers.override.default.actions.edit" template="Magento_Checkout::cart/item/renderer/actions/edit.phtml"/> <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Remove" name="checkout.cart.item.renderers.override.default.actions.remove" template="Magento_Checkout::cart/item/renderer/actions/remove.phtml"/> </block>
I have fixed this issue myself.
It was missing "override" in names.
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions" name="checkout.cart.item.renderers.override.default.actions" as="actions"> <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit" name="checkout.cart.item.renderers.override.default.actions.edit" template="Magento_Checkout::cart/item/renderer/actions/edit.phtml"/> <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Remove" name="checkout.cart.item.renderers.override.default.actions.remove" template="Magento_Checkout::cart/item/renderer/actions/remove.phtml"/> </block>