Glue API: Prices + Marketplace Wishlist feature integration

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

To start feature integration, integrate the required features:

NAME VERSION LINK
Marketplace Wishlist 202108.0 Wishlist feature integration
Product Prices API 202108.0 Glue API: Product Prices feature integration

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 \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 \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 http://glue.mysprykershop.com/wishlists/{{wishlistId}}?include=wishlist-items. You should get the price product collection within the attributes in the response.