checkout_index_index.xml Breaking when overwriting
-
11-10-2020 - |
Question
I'm trying to overwrite checkout_index_index.xml
under module-checkout
It is currently using the file I have created in my theme but the shipping selection is breaking and now showing prices or reloading on zip code change.
I have copied the whole file from the default theme so it's not my code but maybe something isn't including like I found the discount item wasn't working.
So I had to add that manually but can't seem to find whats breaking the shipping any ideas thanks.
Path is
/theme_name/theme/Magento_Checkout/layout/checkout_index_index.xml
Solution
So I have not found the problem but I have found a solution
in checkout_index_index.xml in your theme, you can't copy all the content from the default theme but if you want to add stuff to the content section you can use
<referenceBlock name="checkout.root">
When using
<referenceContainer name="content">
The shipping table stops working
This is currently my way around it and you can then copy all the info inside
<block class="Magento\Checkout\Block\Onepage" name="checkout.root" template="onepage.phtml" cacheable="false">
....
</block>
From the defult theme and chnage things as you wish i also recomend adding discount to the side bar when overwriting this file as it doenst seem to show the discount if you dont.
<item name="discount" xsi:type="array">
<item name="component" xsi:type="string">Magento_SalesRule/js/view/cart/totals/discount</item>
<item name="config" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Discount</item>
</item>