setUnitPrice should refresh anything that needs refresh

Created on 31 January 2025, 2 months ago

Describe your bug or feature request.

Coming from πŸ“Œ It's a bad idea to permit alterations to cart order item unit prices outside the refresh process Active
I really think that setUnitPrice should be safe to call, I'm not sure if there is an internal event or service that should be called.

It's available on both the product and orderItem so it seems it should be safe to call.

If a bug, provide steps to reproduce it from a clean install.

πŸ› Bug report
Status

Active

Version

3.0

Component

Order

Created by

πŸ‡ΊπŸ‡ΈUnited States nicxvan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @nicxvan
  • πŸ‡ΊπŸ‡ΈUnited States rszrama

    As discussed in Slack, this is simply not possible. Unit price setting happens in the context of processes that would be subverted and / or potentially recursive should the mere use of the function result in a price change. Additionally, the calling context typically has its own logic for determining how to represent the price change via an adjustment. (See, for example, the manipulation of a unit price by our tax type plugins coordinated with the preparation of adjustments basedon the type of tax or the similar code in our various promotion offer plugins.)

    Ultimately, the function exists because a function must exist for the operation, but its intended use is for the developer to make use of it in conjunction with related systems in Commerce.

  • πŸ‡ΊπŸ‡ΈUnited States freelock Seattle

    As discussed in #ECA slack, I think we could implement a PriceResolver service with a high priority, that would return the desired price. This could then be set through an ECA plugin.

Production build 0.71.5 2024