Install the Marketplace Wishlist + Prices Glue API

Edit on GitHub

This document describes how to integrate the Prices + Marketplace Wishlist Glue API feature into a Spryker project.

Install feature core

Follow the steps below to install the Prices + Marketplace Wishlist Glue API feature core.

Prerequisites

Install the required features:

NAME VERSION INSTALLATION GUIDE
Marketplace Wishlist 202212.0 Install Wishlist feature
Product Prices API 202212.0 Install the Product Prices Glue API

1) Set up behavior

Activate the following plugins:

PLUGIN SPECIFICATION PREREQUISITES NAMESPACE
PriceProductWishlistItemExpanderPlugin Expands the WishlistItem transfer object with prices. Spryker\Zed\PriceProduct\Communication\Plugin\Wishlist
ProductPriceRestWishlistItemsAttributesMapperPlugin Maps prices to the RestWishlistItemsAttributes transfer object. Spryker\Glue\ProductPricesRestApi\Plugin\Wishlist

src/Pyz/Zed/Wishlist/WishlistDependencyProvider.php

<?php
namespace Pyz\Zed\Wishlist;

use Spryker\Zed\PriceProduct\Communication\Plugin\Wishlist\PriceProductWishlistItemExpanderPlugin;
use Spryker\Zed\Wishlist\WishlistDependencyProvider as SprykerWishlistDependencyProvider;

class WishlistDependencyProvider extends SprykerWishlistDependencyProvider
{
    /**
     * @return array<\Spryker\Zed\WishlistExtension\Dependency\Plugin\WishlistItemExpanderPluginInterface>
     */
    protected function getWishlistItemExpanderPlugins(): array
    {
        return [
            new PriceProductWishlistItemExpanderPlugin(),
        ];
    }
}

src/Pyz/Glue/WishlistsRestApi/WishlistsRestApiDependencyProvider.php

<?php

namespace Pyz\Glue\WishlistsRestApi;

use Spryker\Glue\ProductPricesRestApi\Plugin\Wishlist\ProductPriceRestWishlistItemsAttributesMapperPlugin;
use Spryker\Glue\WishlistsRestApi\WishlistsRestApiDependencyProvider as SprykerWishlistsRestApiDependencyProvider;

class WishlistsRestApiDependencyProvider extends SprykerWishlistsRestApiDependencyProvider
{
    /**
     * @return array<\Spryker\Glue\WishlistsRestApiExtension\Dependency\Plugin\RestWishlistItemsAttributesMapperPluginInterface>
     */
    protected function getRestWishlistItemsAttributesMapperPlugins(): array
    {
        return [
            new ProductPriceRestWishlistItemsAttributesMapperPlugin(),
        ];
    }
}
Verification

Make sure that PriceProductWishlistItemExpanderPlugin and ProductPriceRestWishlistItemsAttributesMapperPlugin are set up by sending the request GET https://glue.mysprykershop.com/wishlists/{{wishlistId}}?include=wishlist-items. You should get the price product collection within the attributes in the response.