shopify storefront api

Zamknięty Opublikowano 6 mies. temu Płatność przy odbiorze
Zamknięty

const createCartAndAddProduct = async () => {

try {

// Step 1: Create the cart

const createCartResponse = await [login to view URL](

`https://${shopifyDomain}/api/2023-10/[login to view URL]`,

{

query: `

mutation {

cartCreate(input: {}) {

cart {

id

}

userErrors {

field

message

}

}

}

`

},

{

headers: {

'Content-Type': 'application/json',

'X-Shopify-Storefront-Access-Token': storefrontAccessToken,

},

}

);

const { cart, userErrors } = [login to view URL];

if (userErrors && [login to view URL] > 0) {

[login to view URL]("User Errors (Cart Creation):", userErrors);

return;

}

[login to view URL]("Cart created:", [login to view URL]);

// Step 2: Add the product to the cart

const productId = "gid://shopify/ProductVariant/44707067461897";

const addToCartResponse = await [login to view URL](

`https://${shopifyDomain}/api/2023-10/[login to view URL]`,

{

query: `

mutation AddToCart($cartId: ID!, $variantId: ID!) {

cartLinesAdd(cartId: $cartId, lines: [{ quantity: 1, merchandiseId: $variantId}]) {

cart {

lines(first: 100) {

edges {

node {

id

quantity

merchandise {

... on ProductVariant {

product {

title

}

}

}

}

}

}

}

userErrors {

field

message

}

}

}

`,

variables: {

cartId: [login to view URL],

variantId: productId

}

},

{

headers: {

'Content-Type': 'application/json',

'X-Shopify-Storefront-Access-Token': storefrontAccessToken,

},

}

);

const { cart: updatedCart, userErrors: addToCartErrors } = [login to view URL];

if (addToCartErrors && [login to view URL] > 0) {

[login to view URL]("User Errors (Add To Cart):", addToCartErrors);

return;

}

[login to view URL]("Product added to cart:", [login to view URL]);

} catch (error) {

[login to view URL]('Error:', [login to view URL] ? [login to view URL] : [login to view URL]);

}

};

createCartAndAddProduct();

But i just added and had this response :

{

"product": {

"id": 8338361549065,

"title": "tester",

"body_html": "<strong>Good snowboard!</strong>",

"vendor": "Burton",

"product_type": "Snowboard",

"created_at": "2023-11-02T02:11:20+01:00",

"handle": "tester-1",

"updated_at": "2023-11-02T02:11:20+01:00",

"published_at": "2023-11-02T02:11:20+01:00",

"template_suffix": null,

"published_scope": "global",

"tags": "",

"status": "active",

"admin_graphql_api_id": "gid://shopify/Product/8338361549065",

"variants": [

{

"id": 44707067461897,

"product_id": 8338361549065,

"title": "Default Title",

"price": "399.99",

"sku": "",

"position": 1,

"inventory_policy": "deny",

"compare_at_price": null,

"fulfillment_service": "manual",

"inventory_management": null,

"option1": "Default Title",

"option2": null,

"option3": null,

"created_at": "2023-11-02T02:11:20+01:00",

"updated_at": "2023-11-02T02:11:20+01:00",

"taxable": true,

"barcode": null,

"grams": 0,

"image_id": null,

"weight": 0,

"weight_unit": "kg",

"inventory_item_id": 46517911978249,

"inventory_quantity": 0,

"old_inventory_quantity": 0,

"requires_shipping": true,

"admin_graphql_api_id": "gid://shopify/ProductVariant/44707067461897"

}

],

"options": [

{

"id": 10659962061065,

"product_id": 8338361549065,

"name": "Title",

"position": 1,

"values": [

"Default Title"

]

}

],

"images": [],

"image": null

}

}

but i get :

User Errors (Add To Cart): [

{

field: [ 'lines', '0', 'merchandiseId' ],

message: 'The merchandise with id gid://shopify/ProductVariant/44707067461897 does not exist.'

}

]

Shopify Development Shopify Szablony Shopify

Numer ID Projektu: #37383648

O projekcie

54 ofert Zdalny projekt Aktywny 5 mies. temu

54 freelancerów złożyło ofertę na średnią kwotę €16/godzinę w tym projekcie

OutsourceMan

Hello, thank you for your interest in our services. Yes, we have experience with Shopify app development. We are a Shopify preferred partner and we have developed many Shopify apps in the past. We have 10 years of expe Więcej

€15 EUR / godzina
(56 Oceny)
7.2
hirujiyu

I noticed that you are experiencing an issue with adding a product to the cart using the Shopify Storefront API. The error message you received indicates that the merchandise with the specified variant ID does not exis Więcej

€15 EUR / godzina
(64 Oceny)
6.4
webperfection123

Hi There, I can assist you with shopify storefront api. I have read your job description and assure you that I am a perfect fit for the job.I am a senior  Designer & Developer having vast and proven experience in web Więcej

€18 EUR / godzina
(29 Oceny)
5.6
seefattechnologi

Hey, -====SHOPIFY STOREFRONT API====-Let’s get started to Complete this task .I am talented solution oriented API/Full stack developer. -----I will deliver you Quality and Accurate work within the deadline----- Ple Więcej

€15 EUR / godzina
(3 Oceny)
5.6
Lxtech

Hi, you hve pasted the response so wondering what exactly you need. been using Shopify API for years and would love to help you. please see my Freelancer profile for past track history, got sound track record with 60 Więcej

€15 EUR / godzina
(1 Ocena)
4.8
leadconcept

Greetings, I have read initial high level requirements of your project & discussed with my technical team lead. I was wondering, if you can please spare few minutes to discuss requirements thru' chat? I can then also a Więcej

€18 EUR / godzina
(1 Ocena)
5.0
daydreamsofthiru

Hi, So you using API which you want to fix that is it right? If so I am ready to help immediately with this fix. Thanks.

€15 EUR / godzina
(11 Oceny)
4.7
arvindvashi

Hello! I'm an individual Shopify developer, and I'd be happy to help you with your Shopify project store front API. Whether you need assistance with theme customization, app integration, store setup, or any other Shop Więcej

€15 EUR / godzina
(12 Oceny)
4.4
AwaisChaudhry

Hi Good morning , How are you? I just saw your job posting . I see you have been looking for someone experience with these technologies Shopify Development, Shopify Templates and Shopify. I believe this is some thing Więcej

€23 EUR / godzina
(2 Oceny)
4.3
santoshm143

Salutations, The error message you are getting is "The merchandise with id gid://shopify/ProductVariant/44707067461897 does not exist." This means that the product variant with the ID that you are trying to add to the Więcej

€18 EUR / godzina
(6 Oceny)
4.5
danishshoaib

Hello Dyon V., I have read your requirements for shopify storefront api. I am a professional Shopify developer with 7+ years of experience in liquid programming. I can do this project very well. I have done many pa Więcej

€12 EUR / godzina
(3 Oceny)
2.8
augmentedteam

Hello, My company is a certified Shopify Partner with over 8 years of experience in the field. The error message you are getting indicates that the product could not be found in the Shopify store when you tried to add Więcej

€14 EUR / godzina
(1 Ocena)
2.8
Kyrylovilkovskyi

Hello, I just checked your project "shopify storefront api" . I am familiar to Shopify Development, Shopify and Shopify Templates. I have developed a lot of stores based on Shopify. I will also work full time. Let’s ta Więcej

€18 EUR / godzina
(1 Ocena)
2.4
ismailrehman0331

Hello, I understand the issue with the code you're facing and I assure you that I can resolve this. Let's connect over chart to get this done accurately. Best Regards, Ismail H

€15 EUR / godzina
(1 Ocena)
1.4
Gaurav147

Hi Dyon, How are you ? The error message you received, "The merchandise with id gid://shopify/ProductVariant/44707067461897 does not exist," suggests that the product variant you are trying to add to the cart cannot b Więcej

€15 EUR / godzina
(1 Ocena)
1.4
rannasteve

Hi, Hope you are doing great today. > Please read it carefully, this is not a generic proposal < I noticed that you are seeking a shopify storefront api. I would like to take this opportunity to share with you that Więcej

€15 EUR / godzina
(1 Ocena)
2.6
Zonetiks

Hi there, I am a skilled "Shopify Developer" and I'd love to have the opportunity to work on your project. I've taken a look at your project Description and I can do this job. If you are interested in working with me, Więcej

€12 EUR / godzina
(0 Oceny)
0.0
msecon

Hello. My skills are WordPress, Shopify, PHP, Theme customization, Plugin Development, Java Script, HTML, CSS, Laravel. I am confident that my skills and experience make me the best candidate for this project. I look Więcej

€18 EUR / godzina
(0 Oceny)
0.0
nastyalisa83

Hi there, I can do it. ----------------------------------------------------------------------------------------------------------------------------------------------------------- Thanks Rayal

€15 EUR / godzina
(0 Oceny)
0.0
kozaktr

⭐⭐⭐⭐⭐Hello. I can provide the best result. I have read your task description carefully and I am very interested in your project. I am free to start work right now. I would also like to discuss your project in more deta Więcej

€15 EUR / godzina
(0 Oceny)
0.0