Right now i put in checkout page both (shipping and paying), on sidebar, firstly cart items after totals of the cart after shipping address and after shipping method(last two only on paying page). Now i want to insert on both pages pages coupon field between totals field and shipping address field. I override from magento checkout layout checkout_index_index.xml and i put the next thing in the referenceContainer <block class="Magento\Checkout\Block\Cart\Coupon" name="checkout.cart.coupon" as="coupon" template="Magento_Checkout::cart/coupon.phtml"/>
. It appear on those pages, but is on the bottom of the page. With other words is the DIV with id "checkout" and after that is the coupon DIV with id "block-discount" is any chance to put the coupon div inside the other one and after to rearrange to be in that place? I am on Magento 2.3
-
You can learn more about customizing checkout page here: devdocs.magento.com/guides/v2.4/howdoi/checkout/…– JimmyMar 26, 2021 at 2:29
1 Answer
I forgot to say that i passed this code, Jimmy
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="billing-step" xsi:type="array">
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="children" xsi:type="array">
<item name="afterMethods" xsi:type="array">
<item name="children" xsi:type="array">
<item name="discount" xsi:type="array">
<item name="config" xsi:type="array">
<item name="componentDisabled" xsi:type="boolean">true </item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
<item name="sidebar" xsi:type="array">
<item name="children" xsi:type="array">
<item name="summary" xsi:type="array">
<item name="children" xsi:type="array">
<item name="discount" xsi:type="array">
<item name="component" xsi:type="string">Magento_SalesRule/js/view/payment/discount</item>
<item name="children" xsi:type="array">
<item name="errors" xsi:type="array">
<item name="sortOrder" xsi:type="string">0</item>
<item name="component" xsi:type="string">Magento_SalesRule/js/view/payment/discount-messages</item>
<item name="displayArea" xsi:type="string">messages</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>
But it is in the summary. I want bellow it. Summary, that contains, cart_items and totals, have a border and i don't want the discount code to be in that border. Is any chance or is the only solution to this?