--- title: fulfillmentConstraintRuleCreate - GraphQL Admin description: Creates a fulfillment constraint rule and its metafield. api_version: 2024-10 api_name: admin type: mutation api_type: graphql source_url: html: >- https://shopify.dev/docs/api/admin-graphql/2024-10/mutations/fulfillmentConstraintRuleCreate md: >- https://shopify.dev/docs/api/admin-graphql/2024-10/mutations/fulfillmentConstraintRuleCreate.txt --- # fulfillment​Constraint​Rule​Create mutation Requires `write_fulfillment_constraint_rules` access scope. Creates a fulfillment constraint rule and its metafield. ## Arguments * delivery​Method​Types [\[Delivery​Method​Type!\]!](https://shopify.dev/docs/api/admin-graphql/2024-10/enums/DeliveryMethodType) required Associate the function with one or multiple delivery method types. * function​Id [String!](https://shopify.dev/docs/api/admin-graphql/2024-10/scalars/String) required The identifier of the function providing the constraint rule. * metafields [\[Metafield​Input!\]](https://shopify.dev/docs/api/admin-graphql/2024-10/input-objects/MetafieldInput) Default:\[] Metafields to associate to the fulfillment constraint rule. *** ## Fulfillment​Constraint​Rule​Create​Payload returns * fulfillment​Constraint​Rule [Fulfillment​Constraint​Rule](https://shopify.dev/docs/api/admin-graphql/2024-10/objects/FulfillmentConstraintRule) The newly created fulfillment constraint rule. * user​Errors [\[Fulfillment​Constraint​Rule​Create​User​Error!\]!](https://shopify.dev/docs/api/admin-graphql/2024-10/objects/FulfillmentConstraintRuleCreateUserError) non-null The list of errors that occurred from executing the mutation. *** ## Examples * ### fulfillmentConstraintRuleCreate reference ## Mutation Reference ```graphql mutation fulfillmentConstraintRuleCreate($functionId: String!, $deliveryMethodTypes: [DeliveryMethodType!]!, $metafields: [MetafieldInput!]) { fulfillmentConstraintRuleCreate(functionId: $functionId, deliveryMethodTypes: $deliveryMethodTypes, metafields: $metafields) { fulfillmentConstraintRule { # FulfillmentConstraintRule fields } userErrors { field message } } } ``` ## Input ```json { "functionId": "", "deliveryMethodTypes": [ "SHIPPING" ], "metafields": [ { "id": "gid://shopify//10079785100", "namespace": "", "key": "", "value": "", "type": "" } ] } ```