Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data fetch has stopped working in latest version #850

Open
dannytrann opened this issue Aug 23, 2023 · 4 comments
Open

Data fetch has stopped working in latest version #850

dannytrann opened this issue Aug 23, 2023 · 4 comments

Comments

@dannytrann
Copy link

dannytrann commented Aug 23, 2023

There are some changes with the buy-button-js library on the latest version with the addition of MoneyV2 and 'presentmentPrices'when fetching data, it's not happy with the values returned.

I'm unsure what else to do.

This has broken my app and I can't find any steps on upgrading the buy-button-js when fetching data to return my products.

How do I rectify this when I've already updated the buy-button-js with npm to the latest version?
"@shopify/buy-button-js": "^2.4.0",

(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 : Array(2) 0 : "fragment VariantFragment" 1 : "price" length : 2 [[Prototype]] : Array(0) [[Prototype]] : Object 1 : extensions : {code: 'undefinedField', typeName: 'ProductVariant', fieldName: 'presentmentPrices'} locations : [{…}] message : "Field 'presentmentPrices' doesn't exist on type 'ProductVariant'" path : Array(2) 0 : "fragment VariantFragment" 1 : "presentmentPrices" length : 2 [[Prototype]] : Array(0) [[Prototype]] : Object 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 : Array(2) 0 : "fragment VariantFragment" 1 : "compareAtPrice" length : 2 [[Prototype]] : Array(0) [[Prototype]] : Object length : 3 [[Prototype]] : Array(0)

@bezin
Copy link

bezin commented Sep 15, 2023

I am having the same issue with price and compareAtPrice. Funnily enough the app is broken, because the buy-button error handler does not handle more than one error message in my case.

@dannytrann
Copy link
Author

I am having the same issue with price and compareAtPrice. Funnily enough the app is broken, because the buy-button error handler does not handle more than one error message in my case.

I fixed it by changing the script tag to version 2.4.0 instead of 1.0.0..... lame fix but that did it for me

@bezin
Copy link

bezin commented Sep 15, 2023

Could you elaborate? You said in your opening comment, that you already upgraded to the latest version and the error still existed?

Nevermind: it was a caching issue in my case 🙈

@dannytrann
Copy link
Author

Sure, in my html file I have a <script> tag for the buy-button-js.

Previously, I assumed I should be using npm or something else like that but silly me didn't think tl change the actual js file from the script tag.

Try using this line

<script src="http://sdks.shopifycdn.com/buy-button/2.4.0/buybutton.js"></script>

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

No branches or pull requests

2 participants