作为我的 Shopify 应用程序的一部分,我想保留我的每一个订单的本地导出。我有一个 ruby 脚本,可以实现我在这里需要的大部分功能,但它只获取未履行的订单。
我尝试通过添加这样的参数来调整 ShopifyAPI::Order.all
fullfilled_orders=ShopifyAPI::Order.all(params: { status: 'any',fulfillment_status: 'fulfilled'})
我尝试对这两个字段使用“any”和“fulfilled”的变体,甚至不带参数运行它,但输出保持不变。
应用程序在商店的设置页面拥有所有可能的权限,并且 ruby 中的应用程序范围设置为这样
范围:'read_all_orders read_orders read_customers read_users',
这是该函数的片段
def order_dl()
# Load API credentials from file
config = YAML.load_file('config.yml')
# Shopify API credentials
session = ShopifyAPI::Auth::Session.new(
shop: config['shop'],
access_token: config['access_token'],
)
ShopifyAPI::Context.setup(
api_key: config['api_key'],
api_secret_key: config['api_secret_key'],
api_version: '2024-01', # Example: '2024-01'
scope: 'read_all_orders read_orders read_customers read_users',
is_private: false, # Set to true if you are using a private app
is_embedded: true # Set to true if you are using an embedded app
)
ShopifyAPI::Context.activate_session(session)
client = ShopifyAPI::Clients::Rest::Admin.new(
session: session
)
test_session = ShopifyAPI::Context.active_session
#retrieve order details
orders = ShopifyAPI::Order.all(params: { status: 'any', fulfillment_status: 'any'})
infos=[]