Install the Merchant Switcher + Customer Account Management feature

Edit on GitHub

This document describes how to install the Merchant Switcher + Customer Account Management feature.

Install feature frontend

Follow the steps below to install the Marketplace Order Management + Customer Account Management feature frontend.

Prerequisites

Install the required features:

NAME VERSION INSTALLATION GUIDE
Merchant Switcher 202404.0 Install the Merchant Switcher feature
Customer Account Management 202404.0 Install the Customer Account Management feature

1) Set up the transfer objects

Generate transfer changes:

console transfer:generate
Verification

Make sure that the following changes were applied in transfer objects.

TRANSFER TYPE EVENT PATH
ShopContext.merchantReference attribute created src/Generated/Shared/Transfer/ShopContextTransfer

2) Set up behavior

Enable the following behaviors by registering the plugins:

PLUGIN SPECIFICATION PREREQUISITES NAMESPACE
MerchantSwitchCartAfterCustomerAuthenticationSuccessPlugin Sets merchant reference value to cookies if a customer’s quote contains it, and the quote is not empty. SprykerShop\Yves\MerchantSwitcherWidget\Plugin\CustomerPage
<?php

namespace Pyz\Yves\CustomerPage;

use SprykerShop\Yves\CustomerPage\CustomerPageDependencyProvider as SprykerShopCustomerPageDependencyProvider;
use SprykerShop\Yves\MerchantSwitcherWidget\Plugin\CustomerPage\MerchantSwitchCartAfterCustomerAuthenticationSuccessPlugin;

class CustomerPageDependencyProvider extends SprykerShopCustomerPageDependencyProvider
{
    /**
     * @return array<\SprykerShop\Yves\CustomerPageExtension\Dependency\Plugin\AfterCustomerAuthenticationSuccessPluginInterface>
     */
    protected function getAfterCustomerAuthenticationSuccessPlugins(): array
    {
        return [
            new MerchantSwitchCartAfterCustomerAuthenticationSuccessPlugin(),
        ];
    }
}
Verification

Make sure that after customers log in, their selected merchant is not changed and set correctly.