Shopify GraphQL签出创建变异
我无法使用Shopify的Graphql API创建签出 我从中复制了这个页面的示例,并将其粘贴到Shopify的GraphiQL应用程序中,该应用程序安装在我尝试创建结帐的商店中 这是我的变异,我唯一改变的是Shopify GraphQL签出创建变异,graphql,shopify,Graphql,Shopify,我无法使用Shopify的Graphql API创建签出 我从中复制了这个页面的示例,并将其粘贴到Shopify的GraphiQL应用程序中,该应用程序安装在我尝试创建结帐的商店中 这是我的变异,我唯一改变的是variantId,因此它与我商店中的一个匹配: mutation { checkoutCreate(input: { lineItems: [{ variantId: "gid://shopify/ProductVariant/46037988422", quantity:
variantId
,因此它与我商店中的一个匹配:
mutation {
checkoutCreate(input: {
lineItems: [{ variantId: "gid://shopify/ProductVariant/46037988422", quantity: 1 }]
}) {
checkout {
id
webUrl
lineItems(first: 5) {
edges {
node {
title
quantity
}
}
}
}
}
}
这是我从Shopify得到的回应:
{
"errors": [
{
"message": "Field 'checkoutCreate' doesn't exist on type 'Mutation'",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"mutation",
"checkoutCreate"
],
"extensions": {
"code": "undefinedField",
"typeName": "Mutation",
"fieldName": "checkoutCreate"
}
}
根据Shopify的说法,奇怪的是,checkoutCreate
显然是一种变异
然后我注意到,那页上的突变是不同的。所以我正在尝试这个版本,没有像这样的变量
:
mutation checkoutCreate(input: {
lineItems: [{ variantId: "gid://shopify/ProductVariant/46037988422", quantity: 1 }]
}) {
checkout {
id
}
checkoutUserErrors {
code
field
message
}
}
现在我得到的错误是:
{
"errors": [
{
"message": "Parse error on \"input\" (INPUT) at [1, 25]",
"locations": [
{
"line": 1,
"column": 25
}
]
}
]
}
最后,我用一个变量尝试了这个版本,但也失败了:
mutation checkoutCreate($input: CheckoutCreateInput!) {
checkoutCreate(input: $input) {
checkout {
id
}
checkoutUserErrors {
code
field
message
}
}
}
{
"input": {
lineItems: [{ variantId: "gid://shopify/ProductVariant/46037988422", quantity: 1 }]
}
}
这里的错误是:
{
"errors": [
{
"message": "Parse error on \"input\" (STRING) at [15, 3]",
"locations": [
{
"line": 15,
"column": 3
}
]
}
]
}
除此之外,Shopify的GraphiQL应用程序中还有交互式文档。。它也没有将checkoutCreate列为可用的突变。查看此屏幕截图:我相信您的输入被解析为JSON,因此在测试时,请尝试在您的突变变量的嵌套属性周围加引号
{
"input": {
"lineItems": [{ "variantId": "gid://shopify/ProductVariant/46037988422",
"quantity": 1 }]
}
}
我相信您的输入被解析为JSON,所以在测试时,请尝试在您的变异变量的嵌套属性周围加引号
{
"input": {
"lineItems": [{ "variantId": "gid://shopify/ProductVariant/46037988422",
"quantity": 1 }]
}
}
完成结账的突变仅适用于销售渠道。这些应用程序必须是公共的。因此,如果你正在创建一个私人应用程序,它可能不起作用
完成结账的突变仅适用于销售渠道。这些应用程序必须是公共的。因此,如果你正在创建一个私人应用程序,它可能不起作用
我也面临同样的问题。有更新吗?我也面临同样的问题。有更新吗?