Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Hi Everyone, I'm developing a react-native application and am creating customers through my application, we need to add the products from different vendors and order them in the application.
I have used AJAX API but couldn't able to add items to the cart as a customer with customer ID of the Shopify,
Can anyone help me how to add items to the cart and order them as a customer because in our application different customer will log in and need to order the items.
Thanks in advance, Any help or suggestion will be appreciated and glad.
did you tried `js-buy-sdk`
https://shopify.github.io/js-buy-sdk/
I need to create a cart with items ,not checkout.
If you have done create cart can you please tell me how to create a cart which is specific to the particular customer.
Thanks in advance
Michael,
Not sure if this would be the same thing or not. I would like to create a shopping cart for a customer and fill it with products from a CSV file. Then hopefully with the customer logs on, they can go to their cart and make changes or order the products. Have you had any experience with this? Thanks in advance.
That's bad ux. Why would you add products for them and have them remove what they don't need. Import your csv items in Shopify and use the Storefront Api to pull them and let the customer decide what they want.
Okay.
Since there are special considerations I would suggest creating a base product with variants.
Oh okay. Got a better idea now.
If you have the products in a csv file you need their variant ids to add to cart.
That is why I'm insisting on using the admin api to create products with information from the csv file.
Other than that I can't think of anything else that you could try, if you still want to use Shopify as a platform.
There are other things like Stripe and you can use it with some sort of js code that reads from csv files and in that sense you can customize your checkout to your heart's content.
Good luck.
If you use the graphQL storefront api, treat the "checkout" as a cart, just assume it is the same until the checkout received the customer data.
If you store the checkout ID you can even retrieve it down the line to continue a user session (localstore, session store... or DB) that is the simplest way. The Storefront API doesn't have a "cart" mutation, only checkout.
Cheers
Hello
I am also a React native developer but I am stuck in Shopify Ajax cart api So can you please tell me its base url(Shopify Ajax cart api), I am not able to understand which base url I should use. Thanks
@lockybanna123 The AJAX cart api is for use in themes. You can use the Storefront API for what you're trying to do.
Storefront API is a post request to https://{shop}.myshopify.com/api/2021-04/graphql.json.
As the comment above mentioned you can consider a 'checkout' the same as a cart. You can either manage your cart state locally then create a checkout once a customer is ready to check out, or run a checkout mutation on every relevant action (add item to cart, remove item from cart, etc.)
Shopify has the js-buy-sdk if you don't want to use GraphQL directly.