Install the Marketplace Merchant + Promotions & Discounts feature
Edit on GitHubThis document describes how to install the Marketplace Merchant + Promotions & Discounts feature.
Prerequisites
Install the required features:
NAME | VERSION | INSTALLATION GUIDE |
---|---|---|
Marketplace Merchant | 202505.0 | Install the Marketplace Merchant feature |
Promotions & Discounts | 202505.0 | Install the Promotions & Discounts feature |
Spryker Core | 202505.0 | Install the Spryker Core feature |
1) Install the required modules
Install the required modules using Composer:
composer require spryker/merchant-discount-connector:"^1.0.0" --update-with-dependencies
Verification
Make sure the following modules have been installed:
MODULE | EXPECTED DIRECTORY |
---|---|
MerchantDiscountConnector | vendor/spryker/merchant-discount-connector |
2) Set up behavior
Set up the following behaviors:
PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
---|---|---|---|
MerchantReferenceDecisionRulePlugin | Defines if a discount can be applied to a cart item with a merchant reference specified. | Spryker\Zed\MerchantDiscountConnector\Communication\Plugin\Discount | |
MerchantReferenceDiscountableItemCollectorPlugin | Collects cart items with the reference of a merchant to which a discount should be applied. | Spryker\Zed\MerchantDiscountConnector\Communication\Plugin\Discount |
src/Pyz/Zed/Discount/DiscountDependencyProvider.php
<?php
namespace Pyz\Zed\Discount;
use Spryker\Zed\Discount\DiscountDependencyProvider as SprykerDiscountDependencyProvider;
use Spryker\Zed\MerchantDiscountConnector\Communication\Plugin\Discount\MerchantReferenceDecisionRulePlugin;
use Spryker\Zed\MerchantDiscountConnector\Communication\Plugin\Discount\MerchantReferenceDiscountableItemCollectorPlugin;
class DiscountDependencyProvider extends SprykerDiscountDependencyProvider
{
/**
* @return list<\Spryker\Zed\DiscountExtension\Dependency\Plugin\DecisionRulePluginInterface>
*/
protected function getDecisionRulePlugins(): array
{
return array_merge(parent::getDecisionRulePlugins(), [
new MerchantReferenceDecisionRulePlugin(),
]);
}
/**
* @return list<\Spryker\Zed\DiscountExtension\Dependency\Plugin\DiscountableItemCollectorPluginInterface>
*/
protected function getCollectorPlugins(): array
{
return array_merge(parent::getCollectorPlugins(), [
new MerchantReferenceDiscountableItemCollectorPlugin(),
]);
}
}
Verification
- Create a discount and define its condition as a query string with a
merchant-reference
field. - Add a product sold by the merchant you’ve defined in the discount to cart. Make sure the discount has been applied.
Thank you!
For submitting the form