fond-of-oryx / availability-cart-data-extender
Availability Cart Connector module
2.0.0
2023-01-20 14:07 UTC
Requires
- php: >=8.0
- spryker/availability: ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0
- spryker/availability-cart-connector: ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0
- spryker/cart-extension: ^1.2.0 || ^2.0.0 || ^3.0.0 || ^4.0.0
Requires (Dev)
- fond-of-codeception/spryker: ^1.0
- spryker/code-sniffer: ^0.12
README
This package provides
- a plugin to add the availability and the isSellable state to the items in quote
- a plugin for adding the product name to the error message if one or more items are not sellable or available anymore.
It also provides a new
Installation
composer require fond-of-oryx/availability-cart-data-extender
Configuration
Register plugin AddAvailabilityDataToQuoteItemQuoteChangeObserverPlugin
in zed CartDependencyProvider
/**
* @param \Spryker\Zed\Kernel\Container $container
*
* @return \Spryker\Zed\CartExtension\Dependency\Plugin\QuoteChangeObserverPluginInterface[]
*/
protected function getQuoteChangeObserverPlugins(Container $container): array
{
return [
...
new AddAvailabilityDataToQuoteItemQuoteChangeObserverPlugin(),
];
}
If you want the product name in error message too, replace the spryker CheckAvailabilityPlugin
with the delivered plugin with same name in src/Pyz/Client/Checkout/CheckoutDependencyProvider.php
from
use Spryker\Zed\AvailabilityCartConnector\Communication\Plugin\CheckAvailabilityPlugin;
to
use FondOfOryx\Zed\AvailabilityCartDataExtender\Communication\Plugin\CheckAvailabilityPlugin;
/**
* @param \Spryker\Zed\Kernel\Container $container
*
* @return \Spryker\Zed\Cart\Dependency\CartPreCheckPluginInterface[]
*/
protected function getCartPreCheckPlugins(Container $container)
{
return [
...
new CheckAvailabilityPlugin(),
...
];
}