Accommodate "unknown" adjustments when building the checkout object

Created on 24 July 2025, 22 days ago

We currently serialize promotion, tax, and shipping adjustments into the checkout object, but other modules or custom code on sites may be defining other types of adjustments. We need to accommodate those as well, either via discounts (for negative adjustments) or pseudo line items (for positive adjustments, like fees).

Thanks to @seanmacgillivray for the proposal / patch.

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States rszrama

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

Comments & Activities

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

    Patch attached that upon review likely needs to be improved to support multiple "anonymous" adjustments of the same type. Right now in the promotion adjustments section of the same function we basically sum adjustments with the same array key together. I think we can default to that for unknown adjustment types as well.

    (Note: this isn't a problem for unknown "positive" adjustments, as we don't have to provide an array key for line items.)

  • πŸ‡ΊπŸ‡ΈUnited States rszrama

    Well, I hoped for a fast fix, but unfortunately, I ran into an issue where apparently Affirm will combine our pseudo line items for "positive adjustments" (i.e., fees) if they have the same SKU, even if they have different prices. I installed Commerce Fee to test the patch, had a $25 fee and a $0 fee, and Affirm combined the two adjustments into one line item of $25 with a quantity of 2, charging double as a result.

    I suppose we may need to append an increment value to the adjustment type to avoid this.

Production build 0.71.5 2024