Hello everyone,
I’m having some problems with my connection from my Angular app to the buy-button-js. It was working for years and we have no problem with it until recently when we noticed the products were not fetching correctly. The error is pasted below from the browser console.
This is my init code:
var client = ShopifyBuy.buildClient({
domain: ‘xxxxxxxxxxxxx.myshopify.com’,
storefrontAccessToken: ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’
});
var ui = ShopifyBuy.UI.init(client);
And here is what I had previously to fetch products:
let query = {
first: 10,
}
client.product.fetchQuery(query).then((products) => {
$scope.productList = products
$scope.displayList();
})
Easy and simple but now I get this very tough to figure out errors.
products:1 Uncaught (in promise)
- (3) [{…}, {…}, {…}]
- 0:
- extensions: {code: ‘selectionMismatch’, nodeName: “field ‘price’”, typeName: ‘MoneyV2’}
- locations: [{…}]
- message: “Field must have selections (field ‘price’ returns MoneyV2 but has no selections. Did you mean ‘price { … }’?)”
- path: (2) [‘fragment VariantFragment’, ‘price’]
- [[Prototype]]: Object1. 1:
- extensions: {code: ‘undefinedField’, typeName: ‘ProductVariant’, fieldName: ‘presentmentPrices’}
- locations: [{…}]
- message: “Field ‘presentmentPrices’ doesn’t exist on type ‘ProductVariant’”
- path: (2) [‘fragment VariantFragment’, ‘presentmentPrices’]
- [[Prototype]]: Object1. 2:
- extensions: {code: ‘selectionMismatch’, nodeName: “field ‘compareAtPrice’”, typeName: ‘MoneyV2’}
- locations: [{…}]
- message: “Field must have selections (field ‘compareAtPrice’ returns MoneyV2 but has no selections. Did you mean ‘compareAtPrice { … }’?)”
- path: (2) [‘fragment VariantFragment’, ‘compareAtPrice’]
- [[Prototype]]: Object1. length: 3