Ecommerce Shopify WordPress Discussion

Shopify fulfillment of orders without tracking using JSON (in Javascript)

I’m trying to update an order in Shopify as fulfilled. I’m using Javascript code. I tried using both the order and the filfillment IDs. Each order has multiple line items but I want to update the entire order. And the API documentation says if you update the fulfillment ID and not specify line items it will fulfill the entire order. This is the code I’m using. It runs and doesn’t return an error, but the order isn’t fulfilled. (Oh, I added the output because the tools I am using requires it, but I really don’t need it) Help…. const fulfillmentOrderId = 'f_ID'; const newStatus = 'FULFILLED'; // or 'partial' const updateFulfillmentStatus = async () => { const response = await fetch( `https://******${fulfillmentOrderId}.json`, { method: 'PUT', headers: { 'Content-Type': 'application/json', 'X-Shopify-Access-Token': 's****_******' }, body: JSON.stringify({ "fulfillment_order": { "location_id": "123456789", "id": fulfillmentOrderId, "status": newStatus } }) } ); const data = await response.json(); console.log(data); // Handle the response as per your requirements }; updateFulfillmentStatus(); output=updateFulfillmentStatus()
There is no such thing as fulfillment order updates like that. If you want to make a fulfillment, use the mutation fulfillmentCreateV2 where you provide the fulfillment order ID and anything else of any interest. Not sure where you got your ideas from here, but there is nothing matching in the docs far as I can tell. I have fulfilled a few million orders using fulfillmentCreateV2, so I can attest to the fact that it is simple and just works.

January 27, 2024

Here's the code I'm using. It works in theory, only I keep getting a response of OrderID not found // Replace YOUR_SHOPIFY_STORE, ACCESS_TOKEN, ORDER_ID, and LOCATION_ID with your actual values const shopifyStore = '******'; const accessToken = 's****_********'; const orderId = '123456789'; // Replace with the order ID const locationId = '123456789'; // Replace with the actual location ID // Endpoint const endpoint = `https://${shopifyStore}${orderId}/fulfillments.json`; // Replace with the necessary data for fulfillment const fulfillmentData = { fulfillment: { // Add fulfillment details here location_id: locationId, // other fulfillment details... } }; // Make the API request fetch(endpoint, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Shopify-Access-Token': accessToken, }, body: JSON.stringify(fulfillmentData), }) .then(response => { console.log('Order ID:', orderId); // Log the order ID console.log('Endpoint:', endpoint); // Log the endpoint console.log('Response Status:', response.status); console.log('Response Headers:', response.headers); if (response.status === 404) { console.error('Order not found. Check the order ID.'); return Promise.reject(new Error('Order not found.')); } // Check if the response status is okay before attempting to parse JSON if (response.ok) { return response.json(); } else { throw new Error(`HTTP error! Status: ${response.status}`); } }) .then(data => { console.log('Fulfillment created:', data); // Call the Zapier callback with the result callback(null, data); }) .catch(error => { console.error('Error creating fulfillment:', error); // Call the Zapier callback with the error callback(error); });

January 27, 2024

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.