我一直在尝试开发一个应用程序,在另一个频道上接受Shopify的订单。我成功地通过API下了订单,但我无法将折扣代码与订单一起包括在内。POST数据的JSON对象如下所示:
{
order: {
email : request.params.order.email, // string
financial_status : 'pending', // string
send_receipt : true, // boolean
send_fulfillment_receipt : false, // boolean
note : request.params.order.note, // string
discount_codes : [], // supposed to be an array of Object| Problem here,
line_items : request.params.order.line_items, // array
customer : request.params.customer, // JSON object
billing_address : request.params.order.billing_address, // JSON object
shipping_address : request.params.order.shipping_address // JSON object
}
}
根据文件,discount_codes是这样的-
Applicable discount codes that can be applied to the order. If no codes exist the value will default to blank. A Discount code will include the following fields:
amount: The amount of the discount.
code: The discount code.
type: The type of discount. Can be one of : "percentage", "shipping", "fixed_amount" (default).
我做错了什么?我的discount_codes是这个
[{amount: 100,code:'WELCOME10',type:'percentage'}]
以前有人这样做过吗?
发布于 2018-09-10 17:00:45
根据这个Shopify的答复,您想要做的事情只有在您通过total_discounts
字段以及您想申请的折扣总额的时候才是可能的。
正如您将在另一个回答中看到的,您通过Shopify创建的任何代码都无法与该API一起使用,并且它们的使用将不会被记录下来。
我试图使用这个API来测试我正在生成的不同优惠券代码的应用程序,但这似乎是不可能的。显然,API的目的是应用定制的折扣,而不是Shopify中已经存在的折扣。这对我来说是个令人沮丧的限制。
发布于 2016-10-15 19:04:05
我一直在用折扣成功地创建订单,没有ShopifyPlus,因为这是不相关的。为我工作的数据结构如下所示:
[ { "code": "Shop By PizzleFuzzle 10%", amount: "10", "type": "percentage" } ]
发布于 2016-10-15 06:24:44
折扣对象仅适用于Shopify Plus商户。
一旦你是一个Shopify Plus的商人,你将能够创建这样的折扣代码:
POST /admin/discounts.json
{
"discount": {
"discount_type": "percentage",
"value": "15.0",
"code": "balderdash"
}
}
请参阅Shopify API:https://help.shopify.com/api/reference/discount贴现对象中更详细的文档
https://stackoverflow.com/questions/40055686
复制相似问题