Install the Cart Notes feature
Edit on GitHubThis feature integration guide expects the basic feature to be in place. The current feature integration guide adds the Cart Notes Backend API functionality.
Prerequisites
To start feature integration, integrate the required feature:
NAME | VERSION | INSTALLATION GUIDE |
---|---|---|
Order Management | 202404.0 | Install the Order Management feature |
1) Install the required modules
composer require spryker-feature/cart-notes:"202404.0" --update-with-dependencies
Make sure the following modules have been installed:
MODULE | EXPECTED DIRECTORY |
---|---|
CartNotesBackendApi | vendor/spryker/cart-notes-backend-api |
2) Set up transfer objects
Generate transfers:
console transfer:generate
Verification
Make sure that the following changes have been triggered in transfer objects:
TRANSFER | TYPE | EVENT | PATH |
---|---|---|---|
OrdersBackendApiAttributes.cartNote | property | created | src/Generated/Shared/Transfer/OrdersBackendApiAttributesTransfer |
3) Set up behavior
- Enable the following behaviors by registering the plugins:
PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
---|---|---|---|
CartNoteOrdersBackendApiAttributesMapperPlugin | Expands ApiOrdersAttributes.cartNote with Order.cartNote property. |
Spryker\Glue\CartNotesBackendApi\Plugin\SalesOrdersBackendApi |
src/Pyz/Glue/SalesOrdersBackendApi/SalesOrdersBackendApiDependencyProvider.php
<?php
namespace Pyz\Glue\SalesOrdersBackendApi;
use Spryker\Glue\CartNotesBackendApi\Plugin\SalesOrdersBackendApi\CartNoteOrdersBackendApiAttributesMapperPlugin;
use Spryker\Glue\SalesOrdersBackendApi\SalesOrdersBackendApiDependencyProvider as SprykerSalesOrdersBackendApiDependencyProvider;
class SalesOrdersBackendApiDependencyProvider extends SprykerSalesOrdersBackendApiDependencyProvider
{
/**
* @return list<\Spryker\Glue\SalesOrdersBackendApiExtension\Dependency\Plugin\OrdersBackendApiAttributesMapperPluginInterface>
*/
protected function getOrdersBackendApiAttributesMapperPlugins(): array
{
return [
new CartNoteOrdersBackendApiAttributesMapperPlugin(),
];
}
}
Verification
Make sure that sales-orders
resources from SalesOrdersBackendApiResource::getOrderResourceCollection()
results contain cart note data: OrderResourceCollectionTransfer.orderResources.attributes.cartNote
are set for the orders that have cart notes.
Thank you!
For submitting the form