diff --git a/_includes/pbc/all/install-features/202505.0/marketplace/install-the-marketplace-merchant-promotions-and-discounts-feature.md b/_includes/pbc/all/install-features/202505.0/marketplace/install-the-marketplace-merchant-promotions-and-discounts-feature.md new file mode 100644 index 0000000000..8e418473d1 --- /dev/null +++ b/_includes/pbc/all/install-features/202505.0/marketplace/install-the-marketplace-merchant-promotions-and-discounts-feature.md @@ -0,0 +1,81 @@ +This document describes how to install the Marketplace Merchant + Promotions & Discounts feature. + +## Prerequisites + +Install the required features: + +| NAME | VERSION | INSTALLATION GUIDE | +|------------------------|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Marketplace Merchant | {{page.version}} | [Install the Marketplace Merchant feature](/docs/pbc/all/merchant-management/{{page.version}}/marketplace/install-and-upgrade/install-features/install-the-marketplace-merchant-feature.html) | +| Promotions & Discounts | {{page.version}} | [Install the Promotions & Discounts feature](/docs/pbc/all/discount-management/{{page.version}}/base-shop/install-and-upgrade/install-features/install-the-promotions-and-discounts-feature.html) | +| Spryker Core | {{page.version}} | [Install the Spryker Core feature](/docs/pbc/all/miscellaneous/{{page.version}}/install-and-upgrade/install-features/install-the-spryker-core-feature.html) | + +## 1) Install the required modules + +Install the required modules using Composer: + +```bash +composer require spryker/merchant-discount-connector:"^1.0.0" --update-with-dependencies +``` + +{% info_block warningBox "Verification" %} + +Make sure the following modules have been installed: + +| MODULE | EXPECTED DIRECTORY | +|---------------------------|--------------------------------------------| +| MerchantDiscountConnector | vendor/spryker/merchant-discount-connector | + +{% endinfo_block %} + +## 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 a merchant reference to which a discount should be applied. | | Spryker\Zed\MerchantDiscountConnector\Communication\Plugin\Discount | + +**src/Pyz/Zed/Discount/DiscountDependencyProvider.php** + +```php + + */ + 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(), + ]); + } +} +``` + +{% info_block warningBox "Verification" %} + +1. [Create a discount](/docs/pbc/all/discount-management/{{site.version}}/base-shop/manage-in-the-back-office/create-discounts.html) and define its condition as a query string with a `merchant-reference` field. +2. Add a product sold by the merchant you've defined in the discount to cart. + Make sure the discount has been applied. + +{% endinfo_block %} diff --git a/docs/pbc/all/merchant-management/202505.0/marketplace/install-and-upgrade/install-features/install-the-marketplace-merchant-promotions-and-discounts-feature.md b/docs/pbc/all/merchant-management/202505.0/marketplace/install-and-upgrade/install-features/install-the-marketplace-merchant-promotions-and-discounts-feature.md index fa66fce894..f146f1ad96 100644 --- a/docs/pbc/all/merchant-management/202505.0/marketplace/install-and-upgrade/install-features/install-the-marketplace-merchant-promotions-and-discounts-feature.md +++ b/docs/pbc/all/merchant-management/202505.0/marketplace/install-and-upgrade/install-features/install-the-marketplace-merchant-promotions-and-discounts-feature.md @@ -1,8 +1,8 @@ --- -title: Install the Merchant + Promotions & Discounts feature -description: Learn how to integrate the Merchant + Promotions & Discounts feature into a Spryker project. -last_updated: Dec 16, 2024 +title: Install the Marketplace Merchant + Promotions & Discounts feature +description: Learn how to integrate the Marketplace Merchant + Promotions & Discounts feature into a Spryker project. +last_updated: Dec 19, 2024 template: feature-integration-guide-template --- -{% include pbc/all/install-features/{{page.version}}/marketplace/install-the-merchant-promotions-and-discounts-feature.md %} +{% include pbc/all/install-features/{{page.version}}/marketplace/install-the-marketplace-merchant-promotions-and-discounts-feature.md %}