No "status" field for order in webhook for order/update and create

Solved
devdude
Excursionist
20 1 17

In our app we rely heavily on webhooks for performance, using the data they provide directly instead of fetching. However we see a strange omission to the json for an order; it does not contain the "status" field. Is this a bug? Here is an example json received via orders/update webhook:

                                                                              
{'admin_graphql_api_id': 'gid://shopify/Order/XXXXX',
'app_id': 1354745,
'billing_address': {'address1': 'XXXX',
                    'address2': '',
                    'city': 'XXXXX', 
                    'company': '',                                                                                                                              
                    'country': 'XXX',                                                                                                                        
                    'country_code': 'XX',                                                                                                                       
                    'first_name': 'XXX',                                                                                                                    
                    'last_name': 'XXX',                                                                                                                     
                    'latitude': XXX,                                                                                                              
                    'longitude': XXX,                                                                                                             
                    'name': 'XXX',                                                                                                                  
                    'phone': 'XXXX',  
                    'province': None,                                                                                                                           
                    'province_code': None,                                                                                                                      
                    'zip': 'XXX'},                                                                                                                             
'browser_ip': None,                                                                                                                                             
'buyer_accepts_marketing': False,                                                                                                                               
'cancel_reason': None,                                                                                                                                          
'cancelled_at': None,                                                                                                                                           
'cart_token': None,                                                                                                                                             
'checkout_id': 221684277XXXX,                                                                                                                                  
'checkout_token': 'e2d6fa1bdc800e24da6f99ac5cXXXXX',                                                                                                           
'client_details': {'accept_language': None,                                                                                                                     
                   'browser_height': None,                                                                                                                      
                   'browser_ip': None,                                                                                                                          
                   'browser_width': None,                                                                                                                       
                   'session_hash': None,                                                                                                                        
                   'user_agent': None},                                                                                                                         
'closed_at': None,                                                                                                                                              
'confirmed': True,                                                                                                                                              
'contact_email': 'XXXX', 
'created_at': '2021-07-28T14:11:01+02:00',                                                                                                                      
'currency': 'XXX',                                                                                                                                              
'current_subtotal_price': '0.90',                                                                                                                               
'current_subtotal_price_set': {'presentment_money': {'amount': '0.90',                                                                                          
                                                     'currency_code': 'XXX'},                                                                                   
                               'shop_money': {'amount': '0.90',                                                                                                 
                                              'currency_code': 'XXX'}},                                                                                         
'current_total_discounts': '0.00',                                                                                                                              
'current_total_discounts_set': {'presentment_money': {'amount': '0.00',                                                                                         
                                                      'currency_code': 'XXX'},                                                                                  
                                'shop_money': {'amount': '0.00',                                                                                                
                                               'currency_code': 'XXX'}},                                                                                        
'current_total_duties_set': None,                                                                                                                               
'current_total_price': '0.90',                                                                                                                                  
'current_total_price_set': {'presentment_money': {'amount': '0.90',                                                                                             
                                                  'currency_code': 'XXX'},                                                                                      
                            'shop_money': {'amount': '0.90',                                                                                                    
                                           'currency_code': 'XXX'}},                                                                                            
'current_total_tax': '0.00',                                                                                                                                    
'current_total_tax_set': {'presentment_money': {'amount': '0.00',                                                                                               
                                                'currency_code': 'XXX'},                                                                                        
                          'shop_money': {'amount': '0.00',                                                                                                      
                                         'currency_code': 'XXX'}},                                                                                              
'customer': {'accepts_marketing': False,                                                                                                                        
             'accepts_marketing_updated_at': '2021-06-03T22:15:49+02:00',                                                                                       
             'admin_graphql_api_id': 'gid://shopify/Customer/51863XXX', 
             'created_at': '2021-06-03T22:15:49+02:00',                                                                                                         
             'currency': 'XXX',                                                                                                                                 
             'default_address': {'address1': 'XXX', 
                                 'address2': '',                                                                                                                
                                 'city': 'XXX', 
                                 'company': '',                                                                                                                 
                                 'country': 'XXX',                                                                                                           
                                 'country_code': 'XXX',                                                                                                          
                                 'country_name': 'XXX',                                                                                                      
                                 'customer_id': 5186XXXXX,                                                                                                  
                                 'default': True,                                                                                                               
                                 'first_name': 'XXX',                                                                                                       
                                 'id': 6316305XXXXX,                                                                                                           
                                 'last_name': 'XXXX',                                                                                                        
                                 'name': 'XXX',                                                                                                     
                                 'phone': 'XXXXX', 
                                 'province': None,                                                                                                              
                                 'province_code': None,                                                                                                         
                                 'zip': 'XXX'},                                                                                                                
             'email': 'XXXXX', 
             'first_name': 'XXX',                                                                                                                           
             'id': 518639XXXXXX,                                                                                                                               
             'last_name': 'XXXXX',                                                                                                                            
             'last_order_id': 3872045XXXX,                                                                                                                    
             'last_order_name': '#1041',                                                                                                                        
             'marketing_opt_in_level': None,                                                                                                                    
             'multipass_identifier': None,                                                                                                                      
             'note': None,                                                                                                                                      
             'orders_count': 1,                                                                                                                                 
             'phone': None,                                                                                                                                     
             'state': 'enabled',                                                                                                                                
             'tags': '',                                                                                                                                        
             'tax_exempt': False,                                                                                                                               
             'tax_exemptions': [],                                                                                                                              
             'total_spent': '0.90',                                                                                                                             
             'updated_at': '2021-07-28T14:11:02+02:00',                                                                                                         
             'verified_email': False},                                                                                                                          
'customer_locale': 'en',                                                                                                                                        
'device_id': None,                                                                                                                                              
'discount_applications': [],                                                                                                                                    
'discount_codes': [],                                                                                                                                           
'email': 'XXXXX',
'financial_status': 'paid',                                                                                                                                     
'fulfillment_status': None,                                                                                                                                     
'fulfillments': [],                                                                                                                                             
'gateway': 'manual',                                                                                                                                            
'id': 3872045531171,                                                                                                                                            
'landing_site': None,                                                                                                                                           
'landing_site_ref': None,                                                                                                                                       
'line_items': [{'admin_graphql_api_id': 'gid://shopify/LineItem/10101712617507',                                                                                
                'destination_location': {'address1': 'XXX',                                                                                             
                                         'address2': '',                                                                                                        
                                         'city': 'XXXX',                                                                                  
                                         'country_code': 'XX',                                                                                                  
                                         'id': 2882190016547,                                                                                                   
                                         'name': 'XXX XXX',                                                                                             
                                         'province_code': '',                                                                                                   
                                         'zip': 'XXXX'},                                                                                                        
                'discount_allocations': [],                                                                                                                     
                'duties': [],                                                                                                                                   
                'fulfillable_quantity': 1,                                                                                                                      
                'fulfillment_service': 'manual',                                                                                                                
                'fulfillment_status': None,                                                                                                                     
                'gift_card': False,                                                                                                                             
                'grams': 0,                                                                                                                                     
                'id': 10101712617507,                                                                                                                           
                'name': '1Pcs Wear-resistant Keyboard Stickers '                                                                                                
                        'Spanish/English/Russian/Deutsch/Arabic/Italian/Japanese '                                                                              
                        'Letter Replacement For Laptop PC - Black-Arabic',                                                                                      
                'origin_location': {'address1': 'XXX',                                                                                                  
                                    'address2': '',                                                                                                             
                                    'city': 'XXXX',                                                                                                         
                                    'country_code': 'XX',                                                                                                       
                                    'id': 1757991567395,                                                                                                        
                                    'name': 'XXXXX',                                                                                              
                                    'province_code': '',                                                                                                        
                                    'zip': 'XXXX'},                                                                                                             
                'price': '0.90',                                                                                                                                
                'price_set': {'presentment_money': {'amount': '0.90',                                                                                           
                                                    'currency_code': 'XXX'},                                                                                    
                              'shop_money': {'amount': '0.90',                                                                                                  
                                             'currency_code': 'XXX'}},                                                                                          
                'product_exists': True,                                                                                                                         
                'product_id': 4875714854947,                                                                                                                    
                'properties': [],                                                                                                                               
                'quantity': 1,                                                                                                                                  
                'requires_shipping': True,                                                                                                                      
                'sku': '43204476-black-arabic',                                                                                                                 
                'tax_lines': [],                                                                                                                                
                'taxable': False,                                                                                                                               
                'title': '1Pcs Wear-resistant Keyboard Stickers '                                                                                               
                         'Spanish/English/Russian/Deutsch/Arabic/Italian/Japanese '                                                                             
                         'Letter Replacement For Laptop PC',                                                                                                    
                'total_discount': '0.00',                                                                                                                       
                'total_discount_set': {'presentment_money': {'amount': '0.00',                                                                                  
                                                             'currency_code': 'XXX'},                                                                           
                                       'shop_money': {'amount': '0.00',                                                                                         
                                                      'currency_code': 'XXX'}},                                                                                 
                'variant_id': 33042221105187,                                                                                                                   
                'variant_inventory_management': 'shopify',                                                                                                      
                'variant_title': 'Black-Arabic',                                                                                                                
                'vendor': 'XXXXXX'}],                                                                                                              
'location_id': None,                                                                                                                                            
'name': '#1041',                                                                                                                                                
'note': None,                                                                                                                                                   
'note_attributes': [],                                                                                                                                          
'number': 41,                                                                                                                                                   
'order_number': 1041,                                                                                                                                           
'order_status_url': 'https://somestore.myshopify.com/XXXXXX/orders/XXXXX/authenticate?key=XXXX ',                                                                                                                                                            
'original_total_duties_set': None,                                                                                                                              
'payment_gateway_names': ['manual'],                                                                                                                            
'phone': None,                                                                                                                                                  
'presentment_currency': 'XXX',                                                                                                                                  
'processed_at': '2021-07-28T14:11:01+02:00',                                                                                                                    
'processing_method': 'manual',                                                                                                                                  
'reference': None,                                                                                                                                              
'referring_site': None,                                                                                                                                         
'refunds': [],                                                                                                                                                  
'shipping_address': {'address1': 'XXXX',                                                                                                                 
                     'address2': '',                                                                                                                            
                     'city': 'XXXXXX', 
                     'company': '',                                                                                                                             
                     'country': 'XXX',                                                                                                                       
                     'country_code': 'XX',                                                                                                                      
                     'first_name': 'XXX',                                                                                                                   
                     'last_name': 'XXX',                                                                                                                    
                     'latitude': XXX,
                     'longitude': XXX,                                                                                                            
                     'name': 'XXXX',                                                                                                                 
                     'phone': 'XXXX', 
                     'province': None,                                                                                                                          
                     'province_code': None,                                                                                                                     
                     'zip': '5267'},                                                                                                                            
'shipping_lines': [],                                                                                                                                           
'source_identifier': None,                                                                                                                                      
'source_name': 'shopify_draft_order',                                                                                                                           
'source_url': None,                                                                                                                                             
'subtotal_price': '0.90',                                                                                                                                       
'subtotal_price_set': {'presentment_money': {'amount': '0.90',                                                                                                  
                                             'currency_code': 'XXX'},                                                                                           
                       'shop_money': {'amount': '0.90',                                                                                                         
                                      'currency_code': 'XXX'}},                                                                                                 
'tags': '',                                                                                                                                                     
'tax_lines': [],                                                                                                                                                
'taxes_included': True,                                                                                                                                         
'test': False,                                                                                                                                                  
'token': 'cc216b52a35afba1XXXXXXXXX',                                                                                                                    
'total_discounts': '0.00',                                                                                                                                      
'total_discounts_set': {'presentment_money': {'amount': '0.00',                                                                                                 
                                              'currency_code': 'XXX'},                                                                                          
                        'shop_money': {'amount': '0.00',                                                                                                        
                                       'currency_code': 'XXX'}},                                                                                                
'total_line_items_price': '0.90',                                                                                                                               
'total_line_items_price_set': {'presentment_money': {'amount': '0.90',                                                                                          
                                                     'currency_code': 'XXX'},                                                                                   
                               'shop_money': {'amount': '0.90',                                                                                                 
                                              'currency_code': 'XXX'}},                                                                                         
'total_outstanding': '0.00',                                                                                                                                    
'total_price': '0.90',                                                                                                                                          
'total_price_set': {'presentment_money': {'amount': '0.90',                                                                                                     
                                          'currency_code': 'XXX'},                                                                                              
                    'shop_money': {'amount': '0.90', 'currency_code': 'XXX'}},                                                                                  
'total_price_usd': '0.10',                                                                                                                                      
'total_shipping_price_set': {'presentment_money': {'amount': '0.00',                                                                                            
                                                   'currency_code': 'XXX'},                                                                                     
                             'shop_money': {'amount': '0.00',                                                                                                   
                                            'currency_code': 'XXX'}},                                                                                           
'total_tax': '0.00',                                                                                                                                            
'total_tax_set': {'presentment_money': {'amount': '0.00',                                                                                                       
                                        'currency_code': 'XXX'},                                                                                                
                  'shop_money': {'amount': '0.00', 'currency_code': 'XXX'}},                                                                                    
'total_tip_received': '0.00',                                                                                                                                   
'total_weight': 0,                                                                                                                                              
'updated_at': '2021-07-28T14:11:03+02:00',                                                                                                                      
'user_id': 298038XXXX}    

Some data was redacted with "XXX" but all fields received are there, and as you can se there is no sign of the "status" field.

So my questions are: Is it supposed to be there? What can we do to have it? 

It seems kind of wasteful to have to rely on a later fetch to get it.

For reference, we are on Python, receiving the webhook via Python Flask.

 

Thanks!

https://www.merchbot.net
0 Likes
L_J_K
Shopify Staff
Shopify Staff
227 29 33

This is an accepted solution.

Hey @devdude 

I figure you would be wanting to track open, closed and cancelled orders via order webhook perhaps, by the sounds of it? So status is not actually a property on the Order you'll note here - the omission of Order status on the object is that way by design presently. Status is used for example as a filter on the endpoint as it sounds like you've found out.

If it helps, by default the orders would be have an open status on orders/create, and if you wanted to look at the hook directly still,  on orders/update a look could be taken at the "closed_at" value to determine if an order had been closed on order/update. Worth mentioning that the "closed_at" returns null if the order isn't closed too.

Similarly on orders/update hook when order is cancelled there would be "cancel_reason" and "cancelled_at" present within the update hook. Hope some of that helps you if you don't want to fetch - let me know if any further questions - thanks!

 

 

 

 

 

| API Support @ Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!