Need help with Plattform Integration and five API Methods

Hey,

I need a little help.

So a company wants to cooperate with my shop on Shopify and me.

All they need from me are five simple methods.
But we can’t bring it online because neither of us knows how to get these methods out of Shopify in the right way

Create order

Get stock

Status order/Get shipping status

Get tracking

Cancel order

Does anyone know how to do it or how we can do it?

Or is there someone out there who would do it for us even for a small payment

Thanks
Max

Hi Max,

these are different calls to the Shopify API, for itself they are not very complicated.

Please send me a private message and I will provide you with examples.

Schöne Grüße aus Heidelberg

Thomas

HI @WhiteAki ,

ad 1: see https://shopify.dev/api/admin-graphql/2022-01/mutations/draftordercreate

The query is:

mutation draftOrderCreate($input: DraftOrderInput!) {
  draftOrderCreate(input: $input) {
    draftOrder {
      id
    }
  }
}

Sample variables

{
     "input": {
        "customerId": "gid://shopify/Customer/5524208418981",
        "note": "Test draft order",
        "email": "max.mustermann@gmail.com",
        "lineItems": [{"variantId": "gid://shopify/ProductVariant/39316904444069", "quantity": 10}]
      }      
}

I.e.: To get there a customer must exist and you have to retrieve the customer id. Also the order consists of lineItems which point to the productVariant id.

To have an order you have to complete the draftOrder:

mutation draftOrderComplete($id: ID!) {
  draftOrderComplete(id: $id) {
    draftOrder {
      # DraftOrder fields
      order{
        id
      }
    }
    userErrors {
      field
      message
    }
  }
}

with sample variables as

{
  "id": "gid://shopify/DraftOrder/915626459301"
}

The id comes from the created draftOrder

ad 2: see https://shopify.dev/api/admin-graphql/2022-01/queries/inventoryLevel

From the productVariant you get the inventoryItem.id. With the inventoryItem.id you can ask for the available amounts.

{
  inventoryItem(id: "gid://shopify/InventoryItem/41410924085413") {
    inventoryLevels(first: 10){
      edges {
          node {
            available
            incoming
            location {
              name           
              }
            }
          }
    }
  }
}

ad 3 ad 4.

see https://shopify.dev/api/admin-graphql/2022-04/objects/FulfillmentOrder#queries

ad 5.

The mutation is

mutation orderClose($input: OrderCloseInput!) {
  orderClose(input: $input) {
    order {
      # Order fields
      id
    }
    userErrors {
      field
      message
    }
  }
}

with sample variables:

{
  "input": {
    "id":  "gid://shopify/Order/4438110797989"
  }
}

Hope that helps.

Regards
Thomas