Install the Marketplace Product Offer + Promotions & Discounts feature

Edit on GitHub

This document describes how to install the Marketplace Product Offer + Promotions & Discounts feature.

Prerequisites

Install the required features:

NAME VERSION INSTALLATION GUIDE
Promotions & Discounts 202505.0 Install the Promotions & Discounts feature
Marketplace Product Offer 202505.0 Install the Marketplace Product Offer feature
Spryker Core 202505.0 Install the Spryker Core feature

1) Install the required modules

Install the required modules using Composer:

composer require spryker/product-offer-discount-connector:"^1.0.0" --update-with-dependencies
Verification

Make sure the following modules have been installed:

MODULE EXPECTED DIRECTORY
ProductOfferDiscountConnector vendor/product-offer-discount-connector

2) Set up behavior

Set up the following behaviors:

PLUGIN SPECIFICATION PREREQUISITES NAMESPACE
ProductOfferReferenceDecisionRulePlugin Checks if an item’s product offer reference matches the discount’s condition. Spryker\Zed\ProductOfferDiscountConnector\Communication\Plugin\Discount
ProductOfferReferenceDiscountableItemCollectorPlugin Collects discountable items from the given quote by items’ product offer references. Spryker\Zed\ProductOfferDiscountConnector\Communication\Plugin\Discount

src/Pyz/Zed/Discount/DiscountDependencyProvider.php

<?php

namespace Pyz\Zed\Discount;

use Spryker\Zed\Discount\DiscountDependencyProvider as SprykerDiscountDependencyProvider;
use Spryker\Zed\ProductOfferDiscountConnector\Communication\Plugin\Discount\ProductOfferReferenceDecisionRulePlugin;
use Spryker\Zed\ProductOfferDiscountConnector\Communication\Plugin\Discount\ProductOfferReferenceDiscountableItemCollectorPlugin;

class DiscountDependencyProvider extends SprykerDiscountDependencyProvider
{
    /**
     * @return list<\Spryker\Zed\DiscountExtension\Dependency\Plugin\DecisionRulePluginInterface>
     */
    protected function getDecisionRulePlugins(): array
    {
        return array_merge(parent::getDecisionRulePlugins(), [
            new ProductOfferReferenceDecisionRulePlugin(),
        ]);
    }

    /**
     * @return list<\Spryker\Zed\DiscountExtension\Dependency\Plugin\DiscountableItemCollectorPluginInterface>
     */
    protected function getCollectorPlugins(): array
    {
        return array_merge(parent::getCollectorPlugins(), [
            new ProductOfferReferenceDiscountableItemCollectorPlugin(),
        ]);
    }
}
Verification
  1. Create a discount and define its condition as a query string with a product-offer field.
  2. Add a product offer defined in the discount you’ve created to cart. Make sure that the discount has been applied to the cart.