买一送一 支持 买一送二 买一送三,多个id
1
{
"promotions": [{
"name": "Boom Bike Arctic White",
"id": "48566596174110",
"giftIds": ["48566598631710","48566597943582"]
},{
"name": "Lit Bike Aurora Pink",
"id": "48566600597790",
"giftIds": ["48566598631710"]
}, {
"name": "EBIKE1",
"id": "48566589096222",
"giftIds": ["48566570221854","48566570352926","48566568321310"]
},{
"name": "EBIKE2",
"id": "48566589194526",
"giftIds": ["48566570221854","48566570352926","48566568321310"]
},{
"name": "EBIKE3",
"id": "48566589128990",
"giftIds": ["48566570221854","48566570352926","48566568321310"]
},{
"name": "EBIKE4",
"id": "48566589161758",
"giftIds": ["48566570221854","48566570352926","48566568321310"]
},{
"name": "EBIKE5",
"id": "48566589227294",
"giftIds": ["48566570221854","48566570352926","48566568321310"]
},{
"name": "EBIKE6",
"id": "48566589260062",
"giftIds": ["48566570221854","48566570352926","48566568321310"]
}]
}
1.第一步修改上面的id 记住是产品的唯一id值 variantid
2.然后去https://www.sojson.com/ 去这个网址去压缩 再转义 得到
"{\"promotions\":[{\"name\":\"Boom Bike Arctic White\",\"id\":\"48566596174110\",\"giftIds\":[\"48566598631710\",\"48566597943582\"]},{\"name\":\"Lit Bike Aurora Pink\",\"id\":\"48566600597790\",\"giftIds\":[\"48566598631710\"]},{\"name\":\"EBIKE1\",\"id\":\"48566589096222\",\"giftIds\":[\"48566570221854\",\"48566570352926\",\"48566568321310\"]},{\"name\":\"EBIKE2\",\"id\":\"48566589194526\",\"giftIds\":[\"48566570221854\",\"48566570352926\",\"48566568321310\"]},{\"name\":\"EBIKE3\",\"id\":\"48566589128990\",\"giftIds\":[\"48566570221854\",\"48566570352926\",\"48566568321310\"]},{\"name\":\"EBIKE4\",\"id\":\"48566589161758\",\"giftIds\":[\"48566570221854\",\"48566570352926\",\"48566568321310\"]},{\"name\":\"EBIKE5\",\"id\":\"48566589227294\",\"giftIds\":[\"48566570221854\",\"48566570352926\",\"48566568321310\"]},{\"name\":\"EBIKE6\",\"id\":\"48566589260062\",\"giftIds\":[\"48566570221854\",\"48566570352926\",\"48566568321310\"]}]}"
3.打开shopify商店 应用 Shopify GraphiQL App
4.获取商店的functionId 执行下面代码
query {
shopifyFunctions(first: 25) {
nodes {
app {
title
}
apiType
title
id
}
}
}
5.value替换为上面生成的json string
mutation {
discountAutomaticAppCreate(automaticAppDiscount: {
title: "Exclusive Offer",
functionId: "41dba8e6-b085-40e0-bc5b-9af36b147716",
combinesWith: {
orderDiscounts: true,
productDiscounts: true,
shippingDiscounts: true
},
startsAt: "2023-02-02T17:09:21Z",
metafields: [
{
namespace: "exclusive-offer",
key: "exclusive-offer-bike",
type: "json",
value:"{\"promotions\":[{\"name\":\"Boom Bike Arctic White\",\"id\":\"48566596174110\",\"giftIds\":[\"48566598631710\",\"48566597943582\"]},{\"name\":\"Lit Bike Aurora Pink\",\"id\":\"48566600597790\",\"giftIds\":[\"48566598631710\"]},{\"name\":\"EBIKE1\",\"id\":\"48566589096222\",\"giftIds\":[\"48566570221854\",\"48566570352926\",\"48566568321310\"]},{\"name\":\"EBIKE2\",\"id\":\"48566589194526\",\"giftIds\":[\"48566570221854\",\"48566570352926\",\"48566568321310\"]},{\"name\":\"EBIKE3\",\"id\":\"48566589128990\",\"giftIds\":[\"48566570221854\",\"48566570352926\",\"48566568321310\"]},{\"name\":\"EBIKE4\",\"id\":\"48566589161758\",\"giftIds\":[\"48566570221854\",\"48566570352926\",\"48566568321310\"]},{\"name\":\"EBIKE5\",\"id\":\"48566589227294\",\"giftIds\":[\"48566570221854\",\"48566570352926\",\"48566568321310\"]},{\"name\":\"EBIKE6\",\"id\":\"48566589260062\",\"giftIds\":[\"48566570221854\",\"48566570352926\",\"48566568321310\"]}]}"
}
]
},) {
automaticAppDiscount {
title
}
userErrors {
field
message
}
}
}
6.检查商店