Skip to content

fix(checkout): recover option value prices from the catalog - #53

Merged
mekedron merged 4 commits into
mekedron:mainfrom
zom-2018:fix/checkout-option-value-prices
Oct 12, 2026
Merged

mekedron merged 4 commits into
mekedron:mainfrom
zom-2018:fix/checkout-option-value-prices

Conversation

@zom-2018

@zom-2018 zom-2018 commented Oct 12, 2026 •

Copy link
Copy Markdown

Fixes #51

What

Recover missing option value prices from the catalog payloads checkoutpayload.Build already loads, before BuildBasketUpsertItem validates the line. Values with no known price anywhere are still rejected, so nothing is guessed.

Why

The basket response lists chosen option values by id and count only, so every basket with options failed checkout preview with "has no current price".

Test

  • New TestBuildRecoversOptionValuePricesFromCatalog (fails before, passes after) and TestBuildStillRejectsOptionValueWithoutAnyPrice.
  • go build ./..., golangci-lint run, go test ./..., go test -race ./internal/service/checkoutpayload.
  • Manually verified: wolt checkout on a basket with options now returns a preview instead of the error.

Also

cart add saved the line price as the dish base price only, so paid option values were missing from the cart and from the preview subtotal. The line price is now base price + selected option values (weighted lines unchanged), so wolt cart and wolt checkout agree. TestCartAddKeepsFallbackCountsConfiguredTotalAndNestedPrices is updated to expect this (500 + 2 x 100 = 700) and TestBasketOptionsTotalSumsPaidValues is new.

Wolt keys a dish's options by an item-level "id" and references the shared
option-library group through "option_id". buildItemPayloadFromAssortment
replaced the item-level group with the library group, so the basket was
written with library ids. The basket API accepts that, but the Wolt app only
recognises item-level ids and silently shows the default choices instead.

Rewrite the resolved group to carry the item-level id (keeping the library id
as option_id) and let --option accept either id.
Wolt's basket response lists chosen option values by id and count only, so
BuildBasketUpsertItem rejected any basket with options as having no current
price, and checkout preview failed. Fill missing value prices from the catalog
payloads Build already loads; values with no known price are still rejected.
The basket line price was saved as the dish's base price only, so a basket with
paid option values (for example a +4.50 protein) showed and previewed the base
price while the dish costs more. Save base price plus the selected option
values, which also keeps cart and checkout preview consistent. Weighted lines
keep their weight-based pricing.
zom-2018 pushed a commit to zom-2018/wolt-cli that referenced this pull request Oct 12, 2026
# Conflicts:
#	internal/cli/cart_helpers_test.go
…ion-value-prices

Both branches add a test to internal/cli/cart_helpers_test.go at the same
spot; the resolution keeps TestBuildBasketOptionsUsesItemLevelOptionGroupID
from mekedron#52 and TestBasketOptionsTotalSumsPaidValues from mekedron#53. With this merge
mekedron#53 applies cleanly on main once mekedron#52 is merged.
@mekedron
mekedron merged commit 9f4a369 into mekedron:main Oct 12, 2026
3 checks passed
@mekedron

Copy link
Copy Markdown
Owner

@zom-2018 thank you for #52 and #53, and for the clear issues (#50, #51) with live repro steps. Both fixes are verified against the live API and shipped in v2.4.2.

A couple of notes:

If you spot anything else, issues and PRs are very welcome. I'll be happy to merge them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

checkout preview fails with 'has no current price' for baskets with options

3 participants