Have your say in Community Polls: What was/is your greatest motivation to start your own business?
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.

FulfillmentOrders not created automatically for test Orders created via the API

FulfillmentOrders not created automatically for test Orders created via the API

efertsch
Shopify Partner
1 0 1

I am working on a Fulfillment Service app for a client. I need to test the process of creating Orders (and FulfillmentOrders), and managing fulfillment requests on a development store before I release my work to production.

 

I was told by a Shopify staffer that the correct way to test Orders is via the API, so I have been following the documentation for managing test orders. It's worth mentioning that I am unable to test using the online store/bogus gateway because I do not have checkouts enabled. I am able to successfully create the Order and execute a fake Transaction programmatically via the Admin REST API (version 2022-07). However, none of the test Orders I have created have associated fulfillment orders, which are supposed to be created automatically when an Order is created, according to the documentation.  For example, 

 

After successfully creating an order via a POST request with this body:

{
    "order": {
        "email": "test@test.com",
        "financial_status": "pending",
        "line_items": [
            {
                "title": "Test #1",
                "price": 1,
                "grams": "1300",
                "quantity": 1,
                "fulfillment_service": {my_service},
                "fulfillment_status": null,
                "tax_lines": [
                    {
                        "price": 1.0,
                        "rate": 0.06,
                        "title": "State tax"
                    }
                ]
            }
        ],
        "transactions": [
            {
                "kind": "authorization",
                "status": "success",
                "amount": 1
            }
        ]
    }
}

I receive this response (with some values obscured):

{
    "order": {
        "id": {order_id},
        "admin_graphql_api_id": "gid://shopify/Order/{order_id}",
        "app_id": {app_id},
        "browser_ip": null,
        "buyer_accepts_marketing": false,
        "cancel_reason": null,
        "cancelled_at": null,
        "cart_token": null,
        "checkout_id": null,
        "checkout_token": null,
        "closed_at": null,
        "confirmed": true,
        "contact_email": null,
        "created_at": "2022-12-27T13:03:13-05:00",
        "currency": "USD",
        "current_subtotal_price": "1.00",
        "current_subtotal_price_set": {
            "shop_money": {
                "amount": "1.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "1.00",
                "currency_code": "USD"
            }
        },
        "current_total_discounts": "0.00",
        "current_total_discounts_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "USD"
            }
        },
        "current_total_duties_set": null,
        "current_total_price": "2.00",
        "current_total_price_set": {
            "shop_money": {
                "amount": "2.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "2.00",
                "currency_code": "USD"
            }
        },
        "current_total_tax": "1.00",
        "current_total_tax_set": {
            "shop_money": {
                "amount": "1.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "1.00",
                "currency_code": "USD"
            }
        },
        "customer_locale": null,
        "device_id": null,
        "discount_codes": [],
        "email": "",
        "estimated_taxes": false,
        "financial_status": "pending",
        "fulfillment_status": null,
        "gateway": "",
        "landing_site": null,
        "landing_site_ref": null,
        "location_id": null,
        "name": "#1079",
        "note": null,
        "note_attributes": [],
        "number": 79,
        "order_number": 1079,
        "order_status_url": {order_status_url},
        "original_total_duties_set": null,
        "payment_gateway_names": [
            ""
        ],
        "phone": null,
        "presentment_currency": "USD",
        "processed_at": "2022-12-27T13:03:13-05:00",
        "processing_method": "",
        "reference": null,
        "referring_site": null,
        "source_identifier": null,
        "source_name": "8827961345",
        "source_url": null,
        "subtotal_price": "1.00",
        "subtotal_price_set": {
            "shop_money": {
                "amount": "1.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "1.00",
                "currency_code": "USD"
            }
        },
        "tags": "",
        "tax_lines": [
            {
                "price": "1.00",
                "rate": 0.06,
                "title": "State tax",
                "price_set": {
                    "shop_money": {
                        "amount": "1.00",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "1.00",
                        "currency_code": "USD"
                    }
                },
                "channel_liable": null
            }
        ],
        "taxes_included": false,
        "test": false,
        "token": {token},
        "total_discounts": "0.00",
        "total_discounts_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "USD"
            }
        },
        "total_line_items_price": "1.00",
        "total_line_items_price_set": {
            "shop_money": {
                "amount": "1.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "1.00",
                "currency_code": "USD"
            }
        },
        "total_outstanding": "1.00",
        "total_price": "1.00",
        "total_price_set": {
            "shop_money": {
                "amount": "1.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "1.00",
                "currency_code": "USD"
            }
        },
        "total_price_usd": "1.00",
        "total_shipping_price_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "USD"
            }
        },
        "total_tax": "0.00",
        "total_tax_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "USD"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "USD"
            }
        },
        "total_tip_received": "0.00",
        "total_weight": 0,
        "updated_at": "2022-12-27T13:03:13-05:00",
        "user_id": null,
        "discount_applications": [],
        "fulfillments": [],
        "line_items": [
            {
                "id":{line_item_id},
                "admin_graphql_api_id": "gid://shopify/LineItem/{line_item_id}",
                "fulfillable_quantity": 1,
                "fulfillment_service": {my_service},
                "fulfillment_status": null,
                "gift_card": false,
                "grams": 1300,
                "name": "Test #1",
                "price": "1.00",
                "price_set": {
                    "shop_money": {
                        "amount": "1.00",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "1.00",
                        "currency_code": "USD"
                    }
                },
                "product_exists": false,
                "product_id": null,
                "properties": [],
                "quantity": 1,
                "requires_shipping": true,
                "sku": null,
                "taxable": true,
                "title": "Test #1",
                "total_discount": "0.00",
                "total_discount_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "USD"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "USD"
                    }
                },
                "variant_id": null,
                "variant_inventory_management": null,
                "variant_title": null,
                "vendor": null,
                "tax_lines": [
                    {
                        "channel_liable": null,
                        "price": "1.00",
                        "price_set": {
                            "shop_money": {
                                "amount": "1.00",
                                "currency_code": "USD"
                            },
                            "presentment_money": {
                                "amount": "1.00",
                                "currency_code": "USD"
                            }
                        },
                        "rate": 0.06,
                        "title": "State tax"
                    }
                ],
                "duties": [],
                "discount_allocations": []
            }
        ],
        "payment_terms": null,
        "refunds": [],
        "shipping_lines": []
    }
}

 

To get the fulfillment orders, I access this endpoint:

 

GET https://{shop_domain}/admin/api/2022-07/orders/{order_id}/fulfillment_orders.json

 

 

And I get this response:

 

{
    "fulfillment_orders": []
}

 

 

Does anyone have any idea as to what I might be doing wrong? I have come across several similar posts that have either gone completely unanswered or recommend changing the development store's settings to fulfill orders automatically, which I tried to no avail. 

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1453 238 524

Hey @efertsch - thanks for getting in touch. This is definitely odd. I have encountered something similar to this before. Can you try testing the same app on other stores and see if the empty array for "fulfillment_orders" persists? If it doesn't, the best workaround at the moment is to try and install another version of your app on the store (just create a new one via the partner dashboard or as a private app through the shop's admin if you did so that way. 

There's a bit more information on a similar incident here at this link. If the error persists after you try both of those workarounds, just reply back here and I'd be happy to do a deeper dive into this with you. 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog