skip to Main Content

I am trying to fulfill a shopify order using shopify-api-node library.
First I get a list of fulfillment order using
const test = await shopify.order.fulfillmentOrders(5333711388952)
which gives me

[
   {
    id: 6278164939032,
    shop_id: 75510251800,
     order_id: 5333711388952,
     assigned_location_id: 82896257304,
     request_status: 'unsubmitted',
     status: 'open',
     supported_actions: [ 'create_fulfillment', 'hold' ],
     destination: {
      id: 5902918746392,
       address1: '567 CBE street',
       address2: 'D',
       city: 'San Jose',
       company: null,
       country: 'United States',
       email: '[email protected]',
       first_name: null,
       last_name: 'Sharma',
       phone: null,
       province: 'California',
       zip: '43210'
     },
     line_items: [ [Object], [Object] ],
     fulfill_at: '2023-06-14T13:00:00-04:00',
    fulfill_by: null,
     international_duties: null,
     fulfillment_holds: [],
     delivery_method: {
       id: 500168786200,
       method_type: 'shipping',
      min_delivery_date_time: null,
       max_delivery_date_time: null
     },
     assigned_location: {
       address1: '1010 B Street',
      address2: null,
       city: 'San Rafael',
    country_code: 'US',
      location_id: 82896257304,
      name: '1010 B Street',
    phone: null,
      province: 'California',
      zip: '94901'
   },
    merchant_requests: []
  }
]

Now I am trying to create a fulfillment request using

const test = await shopify.fulfillmentRequest.create(6278164939032,{
                 "fulfillment_order_id": 6278164939032,
                 "message":"Please fulfill this"
             })

but I get HTTPError: Response code 422 (Unprocessable Entity)

When I am trying to accept the request I get the same error const test = await shopify.fulfillmentRequest.accept(6278164939032)

I know the 422 means I am not giving invalid data, but I am not sure what else data to provide. I compared my input with https://shopify.dev/docs/api/admin-rest/2023-01/resources/fulfillmentrequest#post-fulfillment-orders-fulfillment-order-id-fulfillment-request-accept and the docs are also giving the same input.

2

Answers


  1. Chosen as BEST ANSWER

    Solved this problem and explained how to set an order's Fulfillment Status as fulfilled here https://github.com/MONEI/Shopify-api-node/issues/609


  2. Hi How did you got the list of fulfillment orders using that line of code ?
    in documentation says another way to get the list of fulfillment orders ?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search