Install the Service Points Cart + Checkout feature
Edit on GitHubThis document describes how to install the Service Points Cart + Checkout feature.
Prerequisites
Install the required features:
NAME | VERSION | INSTALLATION GUIDE |
---|---|---|
Service Points Cart | 202311.0 | Install the Service Points Cart feature |
Checkout | 202311.0 | Install the Checkout feature |
1) Install the required modules
We offer an example of Click & Collect service point cart replacement strategies. To use them, install the following module:
composer require spryker/click-and-collect-example: "^0.3.0" --update-with-dependencies
Verification
Make sure the following module has been installed:
MODULE | EXPECTED DIRECTORY |
---|---|
ClickAndCollectExample | vendor/spryker/click-and-collect-example |
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 |
---|---|---|---|
QuoteError | class | created | src/Generated/Shared/Transfer/QuoteErrorTransfer |
QuoteResponse | class | created | src/Generated/Shared/Transfer/QuoteResponseTransfer |
Quote | class | created | src/Generated/Shared/Transfer/QuoteTransfer |
Item | class | created | src/Generated/Shared/Transfer/ItemTransfer |
Currency | class | created | src/Generated/Shared/Transfer/CurrencyTransfer |
Store | class | created | src/Generated/Shared/Transfer/StoreTransfer |
ServicePoint | class | created | src/Generated/Shared/Transfer/ServicePointTransfer |
ShipmentType | class | created | src/Generated/Shared/Transfer/ShipmentTypeTransfer |
Shipment | class | created | src/Generated/Shared/Transfer/ShipmentTransfer |
ProductOffer | class | created | src/Generated/Shared/Transfer/ProductOfferTransfer |
ProductOfferServicePoint | class | created | src/Generated/Shared/Transfer/ProductOfferServicePointTransfer |
ProductOfferServicePointCriteria | class | created | src/Generated/Shared/Transfer/ProductOfferServicePointCriteriaTransfer |
ProductOfferPrice | class | created | src/Generated/Shared/Transfer/ProductOfferPriceTransfer |
ProductOfferStock | class | created | src/Generated/Shared/Transfer/ProductOfferStockTransfer |
2) Set up behavior
- Register the plugins:
PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
---|---|---|---|
ServicePointCheckoutAddressStepPostExecutePlugin | Replaces quote items using an applicable strategy. | SprykerShop\Yves\ServicePointCartPage\Plugin\CartPage |
src/Pyz/Yves/CheckoutPage/CheckoutPageDependencyProvider.php
<?php
/**
* This file is part of the Spryker Suite.
* For full license information, please view the LICENSE file that was distributed with this source code.
*/
namespace Pyz\Yves\CheckoutPage;
use SprykerShop\Yves\CheckoutPage\CheckoutPageDependencyProvider as SprykerShopCheckoutPageDependencyProvider;
use SprykerShop\Yves\ServicePointCartPage\Plugin\CartPage\ServicePointCheckoutAddressStepPostExecutePlugin;
class CheckoutPageDependencyProvider extends SprykerShopCheckoutPageDependencyProvider
{
/**
* @return list<\SprykerShop\Yves\CheckoutPageExtension\Dependency\Plugin\CheckoutAddressStepPostExecutePluginInterface>
*/
protected function getCheckoutAddressStepPostExecutePlugins(): array
{
return [
new ServicePointCheckoutAddressStepPostExecutePlugin(),
];
}
}
- Enable the demo Click & Collect replacement strategy plugins:
PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
---|---|---|---|
ClickAndCollectExampleDeliveryServicePointQuoteItemReplaceStrategyPlugin | Replaces product offers in quote items that have the delivery shipment type with suitable product offer replacements. |
Spryker\Zed\ClickAndCollectExample\Communication\Plugin\ServicePointCart | |
ClickAndCollectExamplePickupServicePointQuoteItemReplaceStrategyPlugin | Replaces product offers in quote items that have the pickup shipment type with suitable product offer replacements. |
Spryker\Zed\ClickAndCollectExample\Communication\Plugin\ServicePointCart |
src/Pyz/Zed/ServicePointCart/ServicePointCartDependencyProvider.php
<?php
/**
* This file is part of the Spryker Suite.
* For full license information, please view the LICENSE file that was distributed with this source code.
*/
namespace Pyz\Zed\ServicePointCart;
use Spryker\Zed\ClickAndCollectExample\Communication\Plugin\ServicePointCart\ClickAndCollectExampleDeliveryServicePointQuoteItemReplaceStrategyPlugin;
use Spryker\Zed\ClickAndCollectExample\Communication\Plugin\ServicePointCart\ClickAndCollectExamplePickupServicePointQuoteItemReplaceStrategyPlugin;
use Spryker\Zed\ServicePointCart\ServicePointCartDependencyProvider as SprykerServicePointCartDependencyProvider;
class ServicePointCartDependencyProvider extends SprykerServicePointCartDependencyProvider
{
/**
* @return list<\Spryker\Zed\ServicePointCartExtension\Dependency\Plugin\ServicePointQuoteItemReplaceStrategyPluginInterface>
*/
protected function getServicePointQuoteItemReplaceStrategyPlugins(): array
{
return [
new ClickAndCollectExampleDeliveryServicePointQuoteItemReplaceStrategyPlugin(),
new ClickAndCollectExamplePickupServicePointQuoteItemReplaceStrategyPlugin(),
];
}
}
Verification
- Create two product offers with the
delivery
andpickup
shipment types for the same product. - Add the product offer with
delivery
shipment type to cart. - Proceed to checkout.
- Go to the Address step.
- Choose the
pickup
shipment type. - Go to the next step.
- Check that the product offer with the
delivery
type is replaced with the product offer withpickup
type.
Thank you!
For submitting the form