What are the Slack Archives?

Itโ€™s a history of our time together in the Slack Community! Thereโ€™s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you wonโ€™t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hello everyone, I recently stumbled over the fact that the net_price in the spy_sales_order_item is

U01660GHSTT
U01660GHSTT Posts: 80 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

Hello everyone,
I recently stumbled over the fact that the net_price in the spy_sales_order_item is 0 for every entry. I tried to follow the code and it seems that the net price is set to 0 in Spryker\Zed\PriceCartConnector\Business\Manager\PriceManager::setOriginUnitGrossPrice() because of the GROSS_MODE and there doesn't seem to be a CalculationPlugin or something like that to recalculate the net price.

I have two questions regarding this:
1. What is the reason to set the net price hard coded to 0 when using the GROSS_MODE?
2. Now, to fix this, I thought about implementing a plugin that calculates the net price when GROSS_MODE is used, to have the correct value in the database, respectively. Is there maybe already a core solution to this problem that I've just missed?

Comments

  • UKJND3A3H
    UKJND3A3H Posts: 123 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    Not fully answering the question (sorry in advance) but I think the behaviour is similar chosing the other way (NET_MODE), leading to empty gross prices. The datastructure is prepared to cover both, the data contained in the data is only actively maintained/calculated/stored for one. Itโ€™s a bit irritatingโ€ฆ

    I am not aware of a core plugin/feature keeping both prices in sync or similar

  • U01660GHSTT
    U01660GHSTT Posts: 80 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    Thanks. That does actually help. ๐Ÿ™‚

  • UKJND3A3H
    UKJND3A3H Posts: 123 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    cool ๐Ÿ™‚

  • Andriy Netseplyayev
    Andriy Netseplyayev Domain Lead Solution Architecture Sprykee Posts: 519 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    thatโ€™s right, you canโ€™t have both price types at the same time, since calculation needs to be done differently (https://documentation.spryker.com/docs/net-gross-prices-management)
    Price mode, however, is defined on quote level, which means you can have carts in different modes.
    Usually on the project you need to find out in which โ€œmodeโ€ you are working

  • Andriy Netseplyayev
    Andriy Netseplyayev Domain Lead Solution Architecture Sprykee Posts: 519 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    From the calculator stack, I can see a NetTotalCalculatorPlugin that is added after the GrandTotal and calculates the total Net price as โ€œgrandTotal - taxTotalโ€

  • Andriy Netseplyayev
    Andriy Netseplyayev Domain Lead Solution Architecture Sprykee Posts: 519 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    if you still need to calculate both prices for your project, I would add missing calculators or remove the ones that you find irrelevant for you

  • U01660GHSTT
    U01660GHSTT Posts: 80 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    Great, thanks again. I was just wondering why the net price is always 0 in the database. It felt a bit strange to always calculate the net price (gross - tax) whenever the net price is required. But if that is intended I have a good basis for discussion and we can decide how we want to do it in the future.