After much fighting with my layouts to add a link to my customer account page in a way that matches the design I finally succeeded in making the link show up and link to an actual page that also matches the design.
Of course, now I need to remove the link, but only on certain store views.
I've found this question but that removes it from all stores.
Initially, I tried using an observer as so:
<?php
namespace Vendor\Module\Observer;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
class RemoveBlockForNonWholeSale implements ObserverInterface
{
protected $logger;
protected $store;
public function __construct(
\Magento\Store\Model\StoreManagerInterface $storeManager
)
{
$this->_storeManager = $storeManager;
}
public function execute(Observer $observer)
{
$layout = $observer->getLayout();
$store_code = $this->_storeManager->getStore()->getCode();
$wh_stores = array('wh','wh_b2b');
if (!in_array($store_code, $wh_stores))
{
$layout->unsetElement('customer_account_dashboard_b2b_status');
}
}
}
Here I am attempting to only show the link on the wh and wh_b2b store/account views.
The link still shows up though. If there is a better way to do this let me know, copied below is my layout xml.
<?xml version="1.0"?>
<page layout = "2column-left" xmlns:xsi="httpxsi = "http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urnnoNamespaceSchemaLocation = "urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="customer_account"/>
<body>
<referenceBlock name="page.main.title">name="customer_account_navigation">
<action<block method="setPageTitle">class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-b2b-order-status-link">
<arguments>
<argument translate="true"name="path" name="title"xsi:type="string">b2b/status</argument>
<argument name="label" xsi:type="string">Ordertype="string" translate="true">Check Order Status</argument>
</action>
<<argument name="sortOrder" xsi:type="number">45</referenceBlock>argument>
<referenceContainer name="content">
</arguments>
<block class="Vendor\Module\Block\Status" name="customer_account_dashboard_b2b_status" as="status" template="Vendor_Module::status.phtml" cacheable="false" </>block>
</referenceContainer>referenceBlock>
</body>
</page>