Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Community contribution: Price adjustments #1437

@arthurlataks

Description

@arthurlataks

I recently have opened this issue (which appeared not to be an issue) due to the fact that there was not enough information how price adjustments do work and what areas these adjustments will influence.

Information from the linked ticket

After the researching in source code and architectural concept, I have found out that the Price Adjustments should not affect item's prices/totals when being added to quote.

Magento uses them separately from total collectors in order to adjust prices before rendering on storefront (similarly to price.html in Magento 1.*).

In order to get these adjustments in quote and quote items, developer needs to move his adjustment's logic to separated service (calculator), implement the quote total collector and use his service from total collector as well as from adjustment.

If you need just to change the item price before totals you can implement your own price model for specific product type (or to the custom one, depends on your needs) and put the logic there. In this case, the price will be changed before being added to the shopping cart and will be also changed before showing on a storefront.

But in case if you want to do some price adjustments (for ex. web-shop fee, etc) you need to implement both - the adjustment model and the total collector. Adjustments are being used for run-time price calculation (when you are showing it on PLP or PDP) while total collectors are being used to make a final price calculation before the item will get added to the quote (and on totals recollection).

For instance, we have a tax calculator which adds the tax value on PDP and PLP using adjustments and adds taxes to quote items when the item gets added to quote using total collector. (the same exist for wee taxes)

With the total collector, you can add a new total row as well as change/modify quote item`s prices (depending on your needs).

Metadata

Metadata

Assignees

No one assigned

    Labels

    New TopicA major update published as an entirely new documentSpecial achievementHigh-value contributions that earn higher rewards and special attention

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions