Shopify订单API-传递折扣
我从Shopify API得到了一些非常奇怪的结果,我希望有人能帮助我 我正在尝试创建一个有折扣的订单。它实际上是保存订单,带有折扣信息。。。然而,金额总是错误的Shopify订单API-传递折扣,shopify,Shopify,我从Shopify API得到了一些非常奇怪的结果,我希望有人能帮助我 我正在尝试创建一个有折扣的订单。它实际上是保存订单,带有折扣信息。。。然而,金额总是错误的 order_params = { :browser_ip => webhook[:browser_ip], :buyer_accepts_marketing => webhook[:buyer_accepts_marketing], :currency => webhook[:currency
order_params = {
:browser_ip => webhook[:browser_ip],
:buyer_accepts_marketing => webhook[:buyer_accepts_marketing],
:currency => webhook[:currency],
:email => webhook[:email],
:financial_status => webhook[:financial_status],
:landing_site => webhook[:landing_site],
:note => webhook[:note],
:referring_site => webhook[:referring_site],
:line_items => line_items,
:tag => tags,
:transactions => transactions,
:discount_codes => webhook[:discount_codes],
:total_discounts => webhook[:total_discounts],
:shipping_address => webhook[:shipping_address],
:shipping_lines => webhook[:shipping_lines],
:customer_id => @options[:customer_id],
:billing_address => webhook[:billing_address]
}
@shopify_order = ShopifyAPI::Order.create(order_params)
正如您所看到的,它是从webhook数据创建的。这是给我的回报…(截短)
“reference”=>无,
“用户id”=>nil,
“小计价格”=>“55.00”,
“总折扣”=>“55.00”,
“位置标识”=>nil,
“源_标识符”=>nil,
“source_url”=>nil,
“处理时间”=>“2017-05-31T15:53:03-04:00”,
“设备id”=>无,
“电话”=>零,
“浏览器ip”=>无,
“着陆地点参考”=>无,
“订单号”=>1140,
“折扣码”=>
[#“五折”、“金额”=>“55.00”、“键入”=>“},
@持续=真,
@前缀_选项={}>]
到目前为止,所有数据都是正确的。。然后我保存,这就发生了。。折扣金额不正确。。。应该是55英镑
我还没有深入研究这个问题,但我非常确定代码必须是唯一的 i、 e.您可能已经在该商店的其他地方定义了折扣代码,该代码与
金额为60.50的折扣代码相同
尝试使用新的、独特的折扣代码并进行测试
我建议创建一个新的折扣代码,如50OFF
,它的amount:50
和type:percentage
,然后您可以将其重新用于具有50%折扣的订单
"reference"=>nil,
"user_id"=>nil,
"subtotal_price"=>"55.00",
"total_discounts"=>"55.00",
"location_id"=>nil,
"source_identifier"=>nil,
"source_url"=>nil,
"processed_at"=>"2017-05-31T15:53:03-04:00",
"device_id"=>nil,
"phone"=>nil,
"browser_ip"=>nil,
"landing_site_ref"=>nil,
"order_number"=>1140,
"discount_codes"=>
[#<ShopifyAPI::Order::DiscountCode:0x007ffbec42ccb0
@attributes={"code"=>"50% OFF", "amount"=>"55.00", "type"=>""},
@persisted=true,
@prefix_options={}>]