Comments (2)
It definitely still exists.
🤔 are you sure you're using the Storefront API and not the Admin API? Only easy explanation I could think of
from storefront-api-examples.
Sorry. That was exactly the issue. I was using the Shopify GraphiQL App, but I didn't realize it only used the Admin API.
Also here is an issue I noticed, that I want to just document in case its helpful for anyone in the future. When using JSON.stringify
, the method applies quotes to both the key and the value causing the string to look like '[{"name": "Size", "value": "King/Cal King" }]'
, this for some reason causes a parsing error in the request, so you have to strip the quotes out of the keys in order for it to look like this '[{name: "Size", value: "King/Cal King" }]'
;
My query looked like this
let selectedOptionParams = [
{ name: "Size", value: "King/Cal King" }
];
selectedOptionParams = JSON.stringify(selectedOptionParams).replace(/"(\w+)"\s*:/g, '$1:');
this.api.post('/',{
query: `{
productByHandle(handle:"${productHandle}") {
variantBySelectedOptions(selectedOptions:${selectedOptionParams}) {
id
}
}
}`,
}).then(res => {
console.debug(res.data);
})
If there's a better way to stringify the object please let me know
from storefront-api-examples.
Related Issues (20)
- How can we modify checkout weburl
- Query Products within collectionByHandle HOT 1
- React-graphql-client HOT 1
- Modifying Shipping Options (Rates, Description, etc)?
- react-js-buy example: checkout.totalTax and checkout.totalPrice do not exist on type 'Cart' HOT 1
- Unable to query checkout after it's created HOT 1
- Angular 9
- Customer Mutate storefront API limitations
- How to Associate Checkout when click login? HOT 20
- Shopify Storefront API returning an empty products array HOT 2
- Is it secure to store API keys on the customer with unauthenticated_read_customers?
- Unable to Generate Storefront Token HOT 1
- How to get CustomerRecover to work? Getting undefined
- CustomerRecover not returning token it returns only userErrors HOT 1
- how to check valid or expired generated token by customerRecover before customerReset HOT 1
- Payment status callback
- How to clear localstorage/cookies (cart/checkout) on custom front-end?
- shopify returning an error indicated that the cart does not exist however fetching the same cart is successful
- Wrong response body when adding cart item to cart
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from storefront-api-examples.