Hello,
I am looking for a way to "Add Similar" from the cart page. Our store is all simple products with 3 to 10 customizable options for each product. We would like to have a feature for customers to click a button on that product's line item in the cart and be redirected to that product's page with the options filled out from the cart item they clicked on. Then the customer can edit from there, saving them time from having to redo all the configuration steps.
I am trying to see if anyone knows of extensions or could give me some advice to how to achieve this functionality. Could i use existing functionality from the edit cart item?
Thanks in advance!
Solved! Go to Solution.
I have succeeded!
I was able to duplicate \Magento\Checkout\Controller\Cart\Configure into my own new controller \Magento\Checkout\Controller\Cart\Similar.
Very minor changes to my new controller:
(not fully sure if i needed to do this, i didn't notice a difference with it uncommented)
//$params->setConfigureMode(true);
Edit new layout XML
<?xml version="1.0"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <head> <link src="Magento_Checkout::js/view/configure/product-customer-data.js"/> </head> <update handle="catalog_product_view"/> <body> <referenceBlock name="head.components"> <block class="Magento\Framework\View\Element\Js\Components" name="checkout_cart_configure_head_components" template="Magento_Checkout::js/components.phtml"/> </referenceBlock> <!-- <referenceBlock name="product.info"> <block class="Magento\Checkout\Block\Cart\Item\Configure" name="checkout.cart.item.configure.block"/> </referenceBlock> <referenceBlock name="product.info.addtocart"> <action method="setTemplate"> <argument name="template" xsi:type="string">Magento_Checkout::cart/item/configure/updatecart.phtml</argument> </action> </referenceBlock> <referenceBlock name="product.info.addtocart.additional"> <action method="setTemplate"> <argument name="template" xsi:type="string">Magento_Checkout::cart/item/configure/updatecart.phtml</argument> </action> </referenceBlock> --> </body> </page>
I have exactly the functionality i was looking for. I hope this helps anyone else looking to do this. If anyone has input for me about this, please let me know.
I have succeeded!
I was able to duplicate \Magento\Checkout\Controller\Cart\Configure into my own new controller \Magento\Checkout\Controller\Cart\Similar.
Very minor changes to my new controller:
(not fully sure if i needed to do this, i didn't notice a difference with it uncommented)
//$params->setConfigureMode(true);
Edit new layout XML
<?xml version="1.0"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <head> <link src="Magento_Checkout::js/view/configure/product-customer-data.js"/> </head> <update handle="catalog_product_view"/> <body> <referenceBlock name="head.components"> <block class="Magento\Framework\View\Element\Js\Components" name="checkout_cart_configure_head_components" template="Magento_Checkout::js/components.phtml"/> </referenceBlock> <!-- <referenceBlock name="product.info"> <block class="Magento\Checkout\Block\Cart\Item\Configure" name="checkout.cart.item.configure.block"/> </referenceBlock> <referenceBlock name="product.info.addtocart"> <action method="setTemplate"> <argument name="template" xsi:type="string">Magento_Checkout::cart/item/configure/updatecart.phtml</argument> </action> </referenceBlock> <referenceBlock name="product.info.addtocart.additional"> <action method="setTemplate"> <argument name="template" xsi:type="string">Magento_Checkout::cart/item/configure/updatecart.phtml</argument> </action> </referenceBlock> --> </body> </page>
I have exactly the functionality i was looking for. I hope this helps anyone else looking to do this. If anyone has input for me about this, please let me know.