Is it possible to reset the quote with all calculated discounts?
Hey together 👋
I developed a console command, which is calculating discount percentages for all existing products with given cart rules. At first, I created a big quote and added each concrete product separately as cart item. After that, I'm calling the discount facade, pass the quote and let it calculate all discounts.
After that, I have the discount amount at the cart items and can store them for frontend usage.
But I have one issue now. During calculation of all discounts for all cart items in the quote, Spryker has a really good calculation logic and is remembering the rounding error of each cart item. And if this rounding error sum up is big enough, it will be calculated to the next best item.
I thought, I can solve it with looping through the products and create each time a new quote and add just 1 product and calculate the discount. But this is not working, because there is a kind of caching or I don't know what.
To solve this, I have to run the command for all products separately. It has to be a new php task. And this is much slower than before.
An other solution would be, to have a look, how I can prevent the rounding error sum up calculation during that command. With that, I could use my super big quote again.
Perhaps someone has an idea, how I can solve that issue, because the command is now running instead of a few seconds, 20min 🙈
- All Categories
- 38 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 33 Spryker News
- 565 Developer Corner
- 435 Spryker Development
- 54 Spryker Dev Environment
- 296 Spryker Releases
- 30 Propel ORM
- 47 Community Projects
- 6 Gacela Project
- 3 PHP Bridge
- 21 Hackathon
- 3.2K 📜 Slack Archives
- 115 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random
- 4 Code Testing
- 23 Product & Business Questions
- 46 Spryker Safari Questions
- 36 The Blackhole