i am trying to customize the checkout of a Magento 2. At the moment, i want to change the appearance of the “shipping”-step. Can anyone give me a hint how to remove the sidebar (including the order summary)?
It should only bei visible on the “payment”-step, not in “shipping”.
4
Answers
The sidebar is added in the layout file
checkout_index_index.xml
inmagento/module-checkout/view/frontend/layout/
. You actually can’t modify that in order to meet your requirements without extensively modding the checkout.There is an easier solution to do it with CSS though.
Put this line to your styles:
.opc-summary-wrapper{display:none;}
and modifymagento/module-checkout/view/frontend/web/js/model/step-navigator.js
do not edit core files! Make a copy in your Theme or Module and add the following code to the functiongetActiveItemIndex
Worked for me. Not my idea though,
found this answer on magento stackexchange: https://magento.stackexchange.com/questions/229001/checkout-remove-sidebar-only-in-step-1
Magento’s docs explain how to disable an item here: https://devdocs.magento.com/guides/v2.4/howdoi/checkout/checkout_customize.html#disable
removing the summary (in this case, in mobile) is as simple as adding the following to your theme’s
checkout_index_index.xml
The
checkout_index_index.xml
should look something like thisCopy
from
folder and find the following line of code
then replace the lines of codes under this item block and place the following line of code
It will remove the order summary as well as the sidebar that contains the order summary block in shipping step of checkout page
Hope you’ll find it helpful.
create
Vendor/Module/view/frontend/web/template/checkout/sidebar.html
file & make copy paste html template fromMagento_Checkout/view/frontend/web/template/sidebar.html
then. create
Vendor/Module/view/frontend/web/js/view/checkout/sidebar-mixin.js
then
Vendor/Module/view/frontend/requirejs-config.js
then create
Vendor/Module/view/frontend/layout/checkout_index_index.xml