fullfillmentCreate error "Field 'fulfillmentCreate' doesn't exist on type 'Mutation'"

I am stuck and frustrated on this mutation. My queries have been working fine and this is the first mutation I am trying. I am using the shopify python library so all of this is in python.

First thing I want to do is make sure I am going down the correct path. I want to mark an order as fulfilled and notify the customer of the tracking information. From what I have read that means I need to create a new fulfillment.

So I am using the following code to create that new fulfillment:

mutation = """
        mutation fulfillmentCreate($fulfillment: FulfillmentInput!) {
            fulfillmentCreate(fulfillment: $fulfillment) {
                fulfillment {
                    id
                    status
                }
                userErrors {
                    field
                    message
                }
            }
        }"""

variables = {
            "fulfillment": {
                "lineItemsByFulfillmentOrder": [
                    {
                        "fulfillmentOrderId": fulfillment_order_id
                    }
                ],
                "notifyCustomer": True,
                "trackingInfo": {
                    "number": tracking_number,
                    "url": tracking_url,
                    "company": tracking_carrier
                }
            }
            }

response = shopify.GraphQL().execute(mutation, variables)

I am purposefully excluding fulfillmentOrderLineItems because I read that will just make sure all items are included but I have put that in as an empty array with no change in execution. I have tried this call with the $message variable and without it and I basically get the same errors thrown. My error output is:

GraphQL Error: 
[{'message': "Field 'fulfillmentCreate' doesn't exist on type 'Mutation'",
'locations': [{'line': 3, 'column': 13}],
'path': ['mutation fulfillmentCreate', 'fulfillmentCreate'],
'extensions': {'code': 'undefinedField', 'typeName': 'Mutation', 'fieldName': 'fulfillmentCreate'}},

{'message': 'Variable $fulfillment is declared by fulfillmentCreate but not used',
'locations': [{'line': 2, 'column': 9}],
'path': ['mutation fulfillmentCreate'],
'extensions': {'code': 'variableNotUsed', 'variableName': 'fulfillment'}}]

Neither of those errors make sense to me. I am using the variable and fulfillmentCreate should exist as a mutation.

Have you checked your API Version? Maybe using an API version that fulfillmentCreate doesn’t include this mutation?

In 2024-07 and earlier it looks like this api version doesn’t support it: fulfillmentCreate - GraphQL Admin

But 2024-10 does include it: fulfillmentCreate - GraphQL Admin

1 Like

Thank you Drew! It took a while but I found, in my own code, that I am explicitly setting the API version, so I updated that and it now works.

2 Likes

Awesome! Glad I could help!