Install the Multiple Carts Glue API
Edit on GitHubThis document describes how to install the Multiple Carts Glue API.
Prerequisites
Install the required features:
Name | Version | INSTALLATION GUIDE |
---|---|---|
Spryker Core | 202311.0 | Install the Spryker Core Glue API |
Multiple Carts | 202311.0 | Install the Multiple Carts feature |
Cart | 202311.0 | Install the Cart feature |
1) Install the required modules
Install the required modules using Composer:
composer require spryker/multi-carts-rest-api:"^1.0.0" --update-with-dependencies
“Verification”
Make sure that the following modules have been installed:
MODULE | EXPECTED DIRECTORY |
---|---|
MultiCartsRestApi |
vendor/spryker/multi-carts-rest-api |
2) Set up transfer objects
Generate transfer changes:
console transfer:generate
“Verification”
Make sure the following changes have been applied in transfer objects:
Transfer | Type | Event | Path |
---|---|---|---|
RestCartsAttributesTransfer:name |
property | added | src/Generated/Shared/Transfer/RestCartsAttributesTransfer |
RestCartsAttributesTransfer:isDefault |
property | added | src/Generated/Shared/Transfer/RestCartsAttributesTransfer |
3) Enable resources and relationships
On a project level, install the following plugins:
Plugin | Specification | Prerequisites | Namespace |
---|---|---|---|
QuoteCreatorPlugin |
Creates a quote for a customer. | None | Spryker\Zed\PersistentCart\Communication\Plugin\CartsRestApi |
src/Pyz/Zed/CartsRestApi/CartsRestApiDependencyProvider.php
<?php
namespace Pyz\Zed\CartsRestApi;
use Spryker\Zed\CartsRestApi\CartsRestApiDependencyProvider as SprykerCartsRestApiDependencyProvider;
use Spryker\Zed\CartsRestApiExtension\Dependency\Plugin\QuoteCreatorPluginInterface;
use Spryker\Zed\PersistentCart\Communication\Plugin\CartsRestApi\QuoteCreatorPlugin;
class CartsRestApiDependencyProvider extends SprykerCartsRestApiDependencyProvider
{
/**
* @return \Spryker\Zed\CartsRestApiExtension\Dependency\Plugin\QuoteCreatorPluginInterface
*/
protected function getQuoteCreatorPlugin(): QuoteCreatorPluginInterface
{
return new QuoteCreatorPlugin();
}
}
Verification
Make sure that the following endpoints are available:
https://glue.mysprykershop.com/carts
https://glue.mysprykershop.com/guest-carts
“Verification”
Make sure that it is possible to create more than one cart.
“Verification”
Make sure that after creating several carts, a response from the GET https://glue.mysprykershop.com/carts
request contains data about all created carts.
Thank you!
For submitting the form