如何移除 Magento 會員中心導覽列內不必要的連結
Magento原生功能中,前台會員中心會顯示大量客戶帳戶相關連結;但想當然,這些連結未必是客戶們實際所需,例如:客戶不具有郵件訂閱服務,那麼,在會員中心上顯示的 Newsletter Subscriptions 連結即是不必要的!本篇文章就要和大家分享,該如何移除 Magento2 會員中心導覽列不必要的連結?
從這篇文章你會知道:
- Magento 2 原生顯示在會員中心的連結
- 如何移除 Magento2 會員中心導覽列不必要的連結
Magento 2 原生顯示在會員中心的連結
- Store credit
- Downloadable product link
- Subscription link
- Billing agreement link
- Product review link
- My credit card link
- Account link
- Account edit link
- Address link
- Orders link
- Wish list link
- Gift card link
- Gift registry
- Reward points
- Order by SKU
如何移除 Magento2 會員中心導覽列不必要的連結
Step 1: 創建自定義 Extension 或 Theme ,覆蓋 layout XML file
app/code/<VendorName>/<ModuleName>/view/frontend/layout/customer_account.xml
or
app/design/frontend/<VendorName>/<Theme>/Magento_Customer/layout/customer_account.xml
Step 2: 使用 remove tag 移除多餘的連結。
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <!-- Remove unwanted account navigation links --> <!-- Put this file in: app/design/frontend/[Namespace]/[Theme]/Magento_Customer/layout/customer_account.xml --> <!-- Store credit --> <referenceBlock name="customer-account-navigation-customer-balance-link" remove="true"/> <!-- Downloadable product link --> <referenceBlock name="customer-account-navigation-downloadable-products-link" remove="true"/> <!-- Subscription link --> <referenceBlock name="customer-account-navigation-newsletter-subscriptions-link" remove="true"/> <!-- Billing agreement link --> <referenceBlock name="customer-account-navigation-billing-agreements-link" remove="true"/> <!-- Product review link --> <referenceBlock name="customer-account-navigation-product-reviews-link" remove="true"/> <!-- My credit card link --> <referenceBlock name="customer-account-navigation-my-credit-cards-link" remove="true"/> <!-- Account link --> <referenceBlock name="customer-account-navigation-account-link" remove="true"/> <!-- Account edit link --> <referenceBlock name="customer-account-navigation-account-edit-link" remove="true"/> <!-- Address link --> <referenceBlock name="customer-account-navigation-address-link" remove="true"/> <!-- Orders link --> <referenceBlock name="customer-account-navigation-orders-link" remove="true"/> <!-- Wish list link --> <referenceBlock name="customer-account-navigation-wish-list-link" remove="true"/> <!-- Gift card link --> <referenceBlock name="customer-account-navigation-gift-card-link" remove="true"/> <!-- Order by SKU --> <referenceBlock name="customer-account-navigation-checkout-sku-link" remove="true"/> <!-- Gift registry --> <referenceBlock name="customer-account-navigation-giftregistry-link" remove="true"/> <!-- Reward points --> <referenceBlock name="customer-account-navigation-reward-link" remove="true"/> </body> </page>
Step 3: 最後只需清除 cache ,再到前台會員中心檢視連結是否已移除。
執行上述步驟後,即能夠從會員中心導覽列中成功刪除所有不需要的連結!
以上為 如何移除 Magento 會員中心導覽列內不必要的連結 文章分享
我要留言