在Shopify上获取所有单个客户的订单

Edw*_*ing 3 ruby ruby-on-rails shopify

有没有办法在Shopify上获得客户的所有订单?例如:

o = ShopifyAPI::Customer.find(…).orders
Run Code Online (Sandbox Code Playgroud)

Dyl*_*ith 6

目前,没有办法通过该端点过滤客户的订单.

您需要获取所有订单并按其内容(包括客户ID)对其进行过滤.

orders.select{ |o| o.customer.id == customer_id }
Run Code Online (Sandbox Code Playgroud)

如果需要快速完成,那么您可能需要将订单存储在数据库中,并使它们与webhook同步.Shopify Wiki上有一个与商店页面同步,解释了如何执行此操作.