简体   繁体   English

从 Shopify 中的特定日期范围获取订单

[英]Get Orders from Specific Date Range in Shopify

I'm trying to get all orders processed in one day (previous day) shown in the code below.我试图在下面的代码中显示的一天(前一天)处理所有订单。

date = datetime.strftime(datetime.now() - timedelta(1), '%Y-%m-%d')

response = requests.get(url="https://shopname.myshopify.com/admin/orders.json?processed_at_min=" + date + "&processed_at_max=" + date + "&fulfillment_status=shipped")

print(response.text)

The output gives me the following输出给了我以下内容

{"orders":[]}

Any ideas?有任何想法吗?

First off, you have no idea if any of those orders are actually fulfilled and marked as shipped, so that empty set could be perfectly correct.首先,您不知道这些订单中是否有任何订单实际上已完成并标记为已发货,因此空集可能是完全正确的。

Second, check for the filter as created_at and not processed_at.其次,检查过滤器是否为created_at 而不是processed_at。 I believe from my years of use that it has always been created_at and never processed_at, but of course, Shopify changes all the time, so that could work too.我相信从我多年的使用来看,它一直是 created_at 并且从未处理过,但当然,Shopify 一直在变化,所以它也可以工作。

Alos be aware that if there were > 50 orders that did fit the filter, you would not see them with this code, as it has no paging capability built in.另外请注意,如果有超过 50 个订单符合过滤器,您将不会在此代码中看到它们,因为它没有内置分页功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM