Magento 2,如何在发货步骤中删除订单摘要?

时间:2018-11-20 16:25:13

标签: javascript knockout.js magento2 checkout

我正在尝试自定义Magento 2的结帐。此刻,我想更改“发货”步骤的外观。有人可以提示我如何删除边栏(包括订单摘要)吗?

它应该仅在“付款”步骤中可见,而在“发货”中不可见。

2 个答案:

答案 0 :(得分:1)

Magento 的文档在此处解释了如何禁用项目:https://devdocs.magento.com/guides/v2.4/howdoi/checkout/checkout_customize.html#disable

删除摘要(在这种情况下,在移动设备中)就像将以下内容添加到主题的 checkout_index_index.xml

一样简单
<item name="estimation" xsi:type="array">
      <item name="componentDisabled" xsi:type="boolean">true</item>
</item>

checkout_index_index.xml 应该看起来像这样

<?xml version="1.0" encoding="utf-8"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" 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="estimation" xsi:type="array">
                                    <item name="componentDisabled" xsi:type="boolean">true</item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

答案 1 :(得分:0)

边栏将添加到.Document.getElementById("form_autocomplete_suggestions-1542902425322").Value = "Role: Student"中的布局文件.Document.getElementById("form_autocomplete_suggestions-*").Value = "Role: Student"中。实际上,如果不广泛修改结帐功能,就无法修改它以满足您的要求。

不过,有一种使用CSS的更简单的解决方案。

将此行设置为您的样式:checkout_index_index.xml并修改magento/module-checkout/view/frontend/layout/ 请勿编辑核心文件!在主题或模块中进行复制,然后将以下代码添加到函数.opc-summary-wrapper{display:none;}

magento/module-checkout/view/frontend/web/js/model/step-navigator.js

为我工作。不过不是我的主意 在magento stackexchange上找到了以下答案:https://magento.stackexchange.com/questions/229001/checkout-remove-sidebar-only-in-step-1