Shopify PriceRule 创建突变

Shopify PriceRule Create Mutation

我正在尝试创建价格规则以在结账时自动应用折扣。我收到错误:

{
  "errors": [
    {
      "message": "Parse error on \"1\" (INT) at [4, 24]",
      "locations": [
        {
          "line": 4,
          "column": 24
        }
      ]
    }
  ]
}

来自突变:

mutation priceRuleCreate($priceRule: PriceRuleInput!) {
  priceRuleCreate(priceRule: $priceRule) {
    priceRule {
      allocationLimit: 1,
      allocationMethod: "ACROSS",
         customerSelection: {
        customerIdsToAdd: ["gid://shopify/Customer/5476062265403"]
      },
      itemEntitlements: {
        collectionIds: ["gid://shopify/Collection/267286741051"]
      },
      itemPrerequisites: {
        collectionIds: ["gid://shopify/Collection/267286741051"]
      },
      prerequisiteShippingPriceRange: {
        greaterThanOrEqualTo: 0.00
      },
      prerequisiteSubtotalRange: {
        greaterThanOrEqualTo: 0.00
    },
    prerequisiteQuantityRange: {
        greaterThan: 1
    },
    shippingEntitlements: {
      countryCodes: ["US"],
      includeRestOfWorld: true
    },
    usageLimit: 3,
    title: "HB-131",
    target: "LINE_ITEM",
    value: {
      fixedAmountValue: 10.00
    },
    validityPeriod: {
        start: "2019-09-07T15:50:00Z"
      }
  }
    
  }
}

我不确定为什么会收到此错误,因为我遵循的是文档中的格式:https://shopify.dev/api/admin-graphql/2021-04/mutations/priceRuleCreate

对于上下文,我使用的是 Shopify 提供的 GraphQL playground 应用程序。

只需删除值。

变更应该只是简单地指定您需要的字段。

mutation priceRuleCreate($priceRule: PriceRuleInput!) {
  priceRuleCreate(priceRule: $priceRule) {
    priceRule {
      allocationLimit
    }
  }
}

请参阅此document如何制作 GraphQL 变更请求