[B2BTEAM-3732] Forward priceToken on addToCart (Pricing Fallback V2) - #185
Draft
wender wants to merge 3 commits into
Draft
[B2BTEAM-3732] Forward priceToken on addToCart (Pricing Fallback V2)#185wender wants to merge 3 commits into
wender wants to merge 3 commits into
Conversation
Pricing Fallback V2: fetch the signed price (commertialOffer.PriceToken) in the search-graphql product queries and forward it as priceToken in the addToCart payload, so the Checkout can close the cart while the Pricing is unavailable. Covers AutocompleteBlock and CategoryBlock. TextAreaBlock and UploadBlock resolve SKUs through the app's own skuFromRefIds resolver, which has no access to the token, and are left for a follow-up. The token is only added to the payload when the search actually returns one, keeping the payload unchanged while the field is not exposed yet. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖 Please select which version do you want to release:
And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.
|
|
Beep boop 🤖 I noticed you didn't make any changes at the
In order to keep track, I'll create an issue if you decide now is not a good time
|
The raw Catalog Search API exposes the field as PriceToken, but search-graphql/search-resolver expose it as priceToken. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 6, 2026
.claude/ holds per-developer Claude Code settings (settings.local.json), which should not be versioned. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do? *
Pricing Fallback V2 (B2BTEAM-3732): captures the signed price returned by the search and forwards it as
priceTokenin theaddToCartpayload, so the Checkout can close the cart with that price even while the Pricing is unavailable.react/queries/product.gqlandreact/queries/productsByCategory.gqlnow requestcommertialOffer { priceToken }undersellers.AutocompleteBlockcaptures the token of the default seller both ononSelect(single-SKU product) and onselectSku(SKU switch), and sends it oncallAddUnitToCart.CategoryBlockkeeps apriceTokensmap by SKU, filled when the quantity is set, and sends it oncallAddToCart.Note on the field name: the raw Catalog Search API exposes it as
PriceToken(PascalCase), butsearch-graphql/search-resolverexpose it aspriceToken, which is what this code reads.Two deliberate choices:
CategoryBlockthe seller sent to the cart may be thesellerDefaultor the first one in the list (pre-existing fallback), so the token is looked up by the already resolvedsellerIdinstead of assuming the default. The token signsaccountName + skuId + price + seller + salesChannel, so a token taken from a different seller would not validate against the item we send.priceTokenis only added to the payload when the search returns one (conditional spread), keeping it strictly optional, as agreed in the thread: an add to cart must never be blocked by a missing token, since the token only matters during a Pricing incident.How to test it? *
Requires an account where the price signing feature flag is enabled on the Intelligent Search —
b2bstoreqaalready has it. Confirm with:Depends on the Checkout apps — see Related to / Depends on.
vtex linkthe app and open a page withquickorder.autocomplete.productquery response —sellers[].commertialOffer.priceTokenshould be present.addToCartmutation payload — the item should carrypriceTokenalongsideid,quantityandseller. To tell our request apart from the PDP button in the Network tab: this app sends only{ items }, whilevtex.add-to-cart-buttonalso sendsmarketingDataandallowedOutdatedData.quickorder.category, including a product whose seller comes from the fallback (nosellerDefault), and confirm the token matches the seller that was sent.priceTokenin the payload.End-to-end validation of the fallback itself can only be done by intentionally opening the circuit with the Pricing and checking that orders still close, as pointed out in the thread.
Describe alternatives you've considered, if any. *
search-graphql.Related to / Depends on *
Search side is done:
search-graphql@0.72.0andsearch-resolver@1.106.0were deployed on 2026-07-20, exposingpriceToken. On the Intelligent Search the price signing is still behind a feature flag, enabled only for test accounts.Blocked on vtex-apps/checkout-graphql#219 — do not merge before it ships.
ItemInputonvtex.checkout-graphqlhas nopriceToken, confirmed at runtime: sending it fails the mutation withField "priceToken" is not defined by type ItemInput. Since the search already returns a token on flagged accounts, merging this first would break add to cart. checkout-graphql#219 proposes the field as optional, with the resolver untouched — the rest-spread already forwards it toPATCH /orderForm/{id}/items. The same dependency blocks the equivalent work on Store Framework (store-resources,add-to-cart-button,minicart,store-components) and onvtex-apps/sku-list(B2BTEAM-3748).Out of scope, to be handled in a follow-up:
TextAreaBlockandUploadBlockresolve SKUs through this app's ownskuFromRefIdsresolver (node/resolvers/search/index.ts), which relies onstockkeepingunitidsbyrefids+ Checkout simulation — neither returns the token. Covering them needs a Catalog Search API call innode, a new field onItemsSeller(graphql/types/Refids.graphql), a newoutbound-accesspolicy and propagation throughReviewBlock.Worth confirming with the Checkout team: the token is valid for 30 minutes and cannot be renewed. In
CategoryBlockit is captured when the category is opened, so a user browsing for a long time may send an expired token.