From 7dd98c4954629b6aefe9904b09a79e2b978e4467 Mon Sep 17 00:00:00 2001 From: Wender Lima Date: Thu, 6 Aug 2026 11:19:14 -0400 Subject: [PATCH] [B2BTEAM-3748] Request priceToken on the product query Pricing Fallback V2: expose the signed price returned by the search on the product query, so the apps that read the product context can forward it as `priceToken` on add to cart and Checkout can close the cart while the Pricing is unavailable. The field is added through a separate opt-in `PriceTokenFragment` instead of `CommertialOfferFragment`, because that fragment is also spread into `recommendationShelf.gql`, whose provider `vtex.recommendation-graphql` declares its own `Offer` type without the field - adding it there would invalidate that document on every account. Each query now opts in, so no existing consumer changes and no other provider is asked for a field it cannot resolve. Co-Authored-By: Claude Opus 5 --- CHANGELOG.md | 4 ++++ react/fragments/priceToken.graphql | 10 ++++++++++ react/queries/product.gql | 2 ++ 3 files changed, 16 insertions(+) create mode 100644 react/fragments/priceToken.graphql diff --git a/CHANGELOG.md b/CHANGELOG.md index a72848d..0603416 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Added + +- `priceToken` (signed price, Pricing Fallback V2) requested on the product query through the new opt-in `PriceTokenFragment`, exposing data from `vtex.search-graphql@0.72.0` / `vtex.search-resolver@1.106.0` so storefront apps can forward it on add to cart. + ## [0.106.0] - 2026-05-26 ### Added diff --git a/react/fragments/priceToken.graphql b/react/fragments/priceToken.graphql new file mode 100644 index 0000000..f4fcf97 --- /dev/null +++ b/react/fragments/priceToken.graphql @@ -0,0 +1,10 @@ +# Signed price (Pricing Fallback V2), exposed by `vtex.search-graphql` >= 0.72.0. +# +# Kept apart from CommertialOfferFragment on purpose: that fragment is also +# spread into recommendationShelf.gql, whose provider +# (`vtex.recommendation-graphql`) declares its own `Offer` type, without this +# field - adding it there would invalidate that whole document. Queries opt in +# by spreading this fragment, so each provider only gets what it can resolve. +fragment PriceTokenFragment on Offer { + priceToken +} diff --git a/react/queries/product.gql b/react/queries/product.gql index 2d9a568..14e6d47 100644 --- a/react/queries/product.gql +++ b/react/queries/product.gql @@ -3,6 +3,7 @@ #import '../fragments/seller.graphql' #import '../fragments/commertialOffer.graphql' #import '../fragments/installment.graphql' +#import '../fragments/priceToken.graphql' query Product( $slug: String @@ -31,6 +32,7 @@ query Product( sellerDefault commertialOffer { ...CommertialOfferFragment + ...PriceTokenFragment CacheVersionUsedToCallCheckout Installments { ...InstallmentFragment