App reviews, troubleshooting, and recommendations
Hey everyone,
I'm exploring the Shopify Storefront API to decide whether to leverage it in an upcoming build.
I keep receiving an "invalid id" message after sending cartCreate request via Storefront API.
{ "data": { "cartCreate": null }, "errors": [ { "message": "invalid id", "locations": [ { "line": 2, "column": 3 } ], "path": [ "cartCreate" ] } ] }
My shop is currently in development mode and uses auto-generated CMS data provided by Shopify.
I'm using the code provided by Shopify in their Building with the Storefront API - Cart walkthrough.
I swapped...
merchandiseId: "gid://shopify/ProductVariant/1"
...with the number I found at the end of the product's Admin page URL.
merchandiseId: "gid://shopify/Product/8491982291237"
I'm not sure what to do at this point. Any help will be greatly appreciated.
Here's the entire code from the Building with the Storefront API - Cart walkthrough.
mutation { cartCreate( input: { lines: [ { quantity: 1 merchandiseId: "gid://shopify/ProductVariant/1" } ], # The information about the buyer that's interacting with the cart. buyerIdentity: { email: "example@example.com", countryCode: CA, # An ordered set of delivery addresses associated with the buyer that's interacting with the cart. The rank of the preferences is determined by the order of the addresses in the array. You can use preferences to populate relevant fields in the checkout flow. deliveryAddressPreferences: { deliveryAddress: { address1: "150 Elgin Street", address2: "8th Floor", city: "Ottawa", province: "Ontario", country: "CA", zip: "K2P 1L4" }, } } attributes: { key: "cart_attribute", value: "This is a cart attribute" } } ) { cart { id createdAt updatedAt lines(first: 10) { edges { node { id merchandise { ... on ProductVariant { id } } } } } buyerIdentity { deliveryAddressPreferences { __typename } } attributes { key value } # The estimated total cost of all merchandise that the customer will pay at checkout. cost { totalAmount { amount currencyCode } # The estimated amount, before taxes and discounts, for the customer to pay at checkout. subtotalAmount { amount currencyCode } # The estimated tax amount for the customer to pay at checkout. totalTaxAmount { amount currencyCode } # The estimated duty amount for the customer to pay at checkout. totalDutyAmount { amount currencyCode } } } } }
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024