Closed princefishthrower closed 4 years ago
Our schema has evolved since these original examples were created so yes they are slightly outdated and use some deprecated fields.
In the case of totalTax
and totalPrice
there are newer "v2" fields: totalTaxV2
and totalPriceV2
. Our reference docs always show the latest schema: https://shopify.dev/docs/storefront-api/reference/object/checkout/?api[version]=2020-07
The JS Buy SDK has also been updated to use these new fields: https://github.com/Shopify/js-buy-sdk/blob/28c85805ee21bdebf9611da6b92c39858b15dc0a/src/graphql/CheckoutFragment.graphql, just not the examples here.
What client you should use really depends on your use case and familiarity with the tools. Apollo is probably the most popular JS GraphQL client so that's always a good starting point.
In the
react-js-buy
example (https://github.com/Shopify/storefront-api-examples/tree/master/react-js-buy), in component Cart (https://github.com/Shopify/storefront-api-examples/blob/master/react-js-buy/src/components/Cart.js) there is usage ofthis.props.checkout.totalTax
andthis.props.checkout.totalPrice
.I've recently done a TypeScript implementation following the code in
react-js-buy
, but I notice in the typing ofthis.props.checkout
, which is ofShopifyBuy.Cart
type, thattotalTax
andtotalPrice
are no longer there. (OnlysubtotalPrice
remains.)I also don't find
totalTax
andtotalPrice
anywhere in the Shopify Buy SDK docs either (https://shopify.github.io/js-buy-sdk/)I'm wondering if the patterns in
react-js-buy
are altogether deprecated, or not the best way of connecting to the Shopify API anymore - I notice this example hasn't been updated in a year, while others example folders like thereact-apollo
,react-graphql-client
, andreact-hooks-apollo
have been updated within the last few months.Any pointers or explanation would be greatly appreciated!