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.