Action executed upon entering a CheckoutStep
I would like something to be prepared at checkout in my Spryker project. At first I thought about implementing this as CheckoutPaymentStepEnterPreCheckPlugin. Unfortunately, I have noticed that this plugin stack is executed every time ‘requireInput’ is queried, which is also called when e.g. generating breadcrumbs. This means that my plugin would be executed at every single step during the checkout again and again. Of course I could still do it and add some condition which prevents it from doing the same thing again and again but I don't really like that workaround.
Do you have any suggestions how to improve this? IMO it would be great to have something like a CheckoutPaymentStepEnterPlugin-stack which would be executed within \SprykerShop\Yves\CheckoutPage\Process\Steps\PaymentStep::execute (right after the PreCheckPlugin-stack) and similar for other steps. What do you think?
Best Answer
-
In that case, if if want to execute the plugin just once, you could extend the quoteTransfer to set that flag and verify before executing the plugin. Otherwise you´d have to override the StepFactory to either add a fake step or override the ones you´d like to customize.
0
Answers
-
Hi David!
Would you like to prepare something before placing the order or before a certain checkout step?
Before placing the order, you have the PreConditionCheckerInterface,src/Spryker/Zed/Checkout/Business/Workflow/CheckoutWorkflow.php, and would be execute just once before placing the order1 -
Hi Hidran,
thanks for your response. In my case, I'd like to select the payment method (in the Quote) based on all other information I have at this point. A similar need will occur for the ShipmentStep as well. Therefore the CheckoutWorkflow unfortunately is too late.
0 -
In that case, if if want to execute the plugin just once, you could extend the quoteTransfer to set that flag and verify before executing the plugin. Otherwise you´d have to override the StepFactory to either add a fake step or override the ones you´d like to customize.
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 92 Spryker News
- 1K Developer Corner
- 855 Spryker Development
- 93 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 36 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 35 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 34 Product & Business Questions
- 70 Spryker Safari Questions
- 51 Random