Happening now | Office Hours: Customizing Your Theme With Moeed | Ask your questions now!
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

OrderRisk always returning empty

OrderRisk always returning empty

JoesIdeas
Shopify Partner
2514 229 677

This API recently stopped working: https://shopify.dev/api/admin-rest/2022-07/resources/order-risk#get-orders-order-id-risks

 

Orders that are high risk are having risk level returned [].

 

Actually in testing, all orders are now returning [] for OrderRisk, Shopify is not returning risk level even on orders that show high risk in the Shopify admin.

 

I've tried in both REST and GraphQL, using the lates 2022-07 (and other versions), and the shopify_api_ruby gem 11.1.0.

 

Here are the requests:

 

# REST
risks = ShopifyAPI::OrderRisk.all(order_id: order_id)
puts risks # []


# GraphQL
query = <<~GQL
  query($items_count: Int, $order: ID!) {
    order(id: $order) {
      risks {
        level
        message
      }
    }
  }
GQL

 

Has anyone experienced this or know how to fix it?

 

• Creator of Order Automator [auto tag, fulfill, connect FBA, daily jobs]
• Co-Creator of Product Automator [suite of features for products / collections]
• Shopify developer for 10+ years, store owner for 7 years
• Blog: Shopify Tips, Guides, and Automation Tactics
Replies 2 (2)

remy727
Shopify Partner
44 2 25

@JoesIdeas have you figured out this? I am having the same issue.

Looking for a Shopify App developer? Please contact me at remy.wang727@gmail.com
JoesIdeas
Shopify Partner
2514 229 677

@remy727 ya we had to change the way API calls were made for certain calls (like order risks).

 

So instead of risks = ShopifyAPI::OrderRisk.all(order_id: order_id), we now do something like this:

 

 

client = ShopifyAPI::Clients::Rest::Admin.new(session: session)
risks = client.get(path: "/admin/api/2022-07/orders/#{order_id}/risks.json")

 

 

• Creator of Order Automator [auto tag, fulfill, connect FBA, daily jobs]
• Co-Creator of Product Automator [suite of features for products / collections]
• Shopify developer for 10+ years, store owner for 7 years
• Blog: Shopify Tips, Guides, and Automation Tactics