Marketplace Product Offer + Checkout feature integration

Edit on GitHub

This document describes how to integrate the Marketplace Product Offer + Checkout feature into a Spryker project.

Install feature core

Follow the steps below to install the Marketplace Product Offer + Checkout feature core.

Prerequisites

To start feature integration, integrate the required features:

NAME VERSION INTEGRATION GUIDE
Spryker Core 202108.0 Spryker Core feature integration
Marketplace Product Offer 202108.0 Marketplace Product Offer feature integration
Checkout 202108.0 Checkout feature integration

1) Install the required modules using Composer

Install the required modules:

composer require spryker/product-offer: "^0.6.1" --update-with-dependencies
Verification

Make sure that the following modules were installed:

MODULE EXPECTED DIRECTORY
CheckoutExtension spryker/checkout-extension
ProductOffer spryker/product-offer

2) Set up transfer objects

Generate the transfer changes:

console transfer:generate
Verification

Make sure that the following changes have been applied in transfer objects:

TRANSFER TYPE EVENT PATH
CheckoutErrorTransfer class Created src/Generated/Shared/Transfer/CheckoutErrorTransfer
CheckoutResponseTransfer class Created src/Generated/Shared/Transfer/CheckoutResponseTransfer
ItemTransfer.merchantReference property Created src/Generated/Shared/Transfer/ItemTransfer

3) Configure checkout pre-condition plugins

PLUGIN SPECIFICATION PREREQUISITES NAMESPACE
ProductOfferCheckoutPreConditionPlugin Blocks checkout if at least one quote item transfer has items with inactive or not approved ProductOffer. Spryker/Zed/ProductOffer/Communication/Plugin/Checkout/ProductOfferCheckoutPreConditionPlugin.php

src/Pyz/Zed/Checkout/CheckoutDependencyProvider.php

<?php

namespace Pyz\Zed\Checkout;

use Spryker\Zed\Checkout\CheckoutDependencyProvider as SprykerCheckoutDependencyProvider;
use Spryker\Zed\Kernel\Container;
use Spryker\Zed\ProductOffer\Communication\Plugin\Checkout\ProductOfferCheckoutPreConditionPlugin;

class CheckoutDependencyProvider extends SprykerCheckoutDependencyProvider
{
    /**
     * @param \Spryker\Zed\Kernel\Container $container
     *
     * @return \Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreConditionPluginInterface[]
     */
    protected function getCheckoutPreConditions(Container $container)
    {
        return [
            new ProductOfferCheckoutPreConditionPlugin(),
        ];
    }
}
Verification

Make sure that when refreshing the checkout summary page, after changing the active or approved status of a product offer, the status is reflected accordingly. The checkout button is disabled, and the message is shown at the bottom of the checkout summary page: “Product offer inactive for the product with SKU <SKU>”.

You can toggle the offer’s active status in the Merchant Portal (Offer visibility). There’s no UI to unset the approval status for an offer yet (only via data-importer: edit data/import/common/common/marketplace/merchant_product_offer.csv and execute the console data:import merchant-product-offer command).