Solved

Problemas with FulfillmentOrder

JuanGrasso
Shopify Partner
20 3 4

Hi there.

Im developing a shipping app and im having problemas with the FulfillmentOrder API.

My situation: when the store get a new order such as de following:

{
    "order": {
        "id": 4071883210920,
        "admin_graphql_api_id": "gid://shopify/Order/4071883210920",
        "app_id": 580111,
        "browser_ip": "190.244.174.115",
        "buyer_accepts_marketing": true,
        "cancel_reason": null,
        "cancelled_at": null,
        "cart_token": "85f6f1a6bf07b7623427311df7e05c65",
        "checkout_id": 21659682111656,
        "checkout_token": "1fe4ba4afa1d10ce288f0f3e4da9feaa",
        "client_details": {
            "accept_language": "en",
            "browser_height": 937,
            "browser_ip": "190.244.174.115",
            "browser_width": 1903,
            "session_hash": null,
            "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36"
        },
        "closed_at": null,
        "confirmed": true,
        "contact_email": "juan@gmail.com",
        "created_at": "2021-08-13T12:45:35-03:00",
        "currency": "ARS",
        "current_subtotal_price": "3734.00",
        "current_subtotal_price_set": {
            "shop_money": {
                "amount": "3734.00",
                "currency_code": "ARS"
            },
            "presentment_money": {
                "amount": "3734.00",
                "currency_code": "ARS"
            }
        },
        "current_total_discounts": "0.00",
        "current_total_discounts_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "ARS"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "ARS"
            }
        },
        "current_total_duties_set": null,
        "current_total_price": "5039.65",
        "current_total_price_set": {
            "shop_money": {
                "amount": "5039.65",
                "currency_code": "ARS"
            },
            "presentment_money": {
                "amount": "5039.65",
                "currency_code": "ARS"
            }
        },
        "current_total_tax": "784.14",
        "current_total_tax_set": {
            "shop_money": {
                "amount": "784.14",
                "currency_code": "ARS"
            },
            "presentment_money": {
                "amount": "784.14",
                "currency_code": "ARS"
            }
        },
        "customer_locale": "en",
        "device_id": null,
        "discount_codes": [],
        "email": "juan@gmail.com",
        "estimated_taxes": false,
        "financial_status": "paid",
        "fulfillment_status": null,
        "gateway": "bogus",
        "landing_site": "/admin/oauth/request_grant?client_id=bfcddd2d751f543f42c0a263b9a8ac5d",
        "landing_site_ref": null,
        "location_id": null,
        "name": "#1021",
        "note": null,
        "note_attributes": [],
        "number": 21,
        "order_number": 1021,
        "order_status_url": "https://tiendacon.myshopify.com/58454966440/orders/7593c007d927b382160510ef9e21778e/authenticate?key=a5d3e6d697d5cc2d0f76bfc8016046ac",
        "original_total_duties_set": null,
        "payment_gateway_names": [
            "bogus"
        ],
        "phone": null,
        "presentment_currency": "ARS",
        "processed_at": "2021-08-13T12:45:34-03:00",
        "processing_method": "direct",
        "reference": null,
        "referring_site": "",
        "source_identifier": null,
        "source_name": "web",
        "source_url": null,
        "subtotal_price": "3734.00",
        "subtotal_price_set": {
            "shop_money": {
                "amount": "3734.00",
                "currency_code": "ARS"
            },
            "presentment_money": {
                "amount": "3734.00",
                "currency_code": "ARS"
            }
        },
        "tags": "",
        "tax_lines": [
            {
                "price": "784.14",
                "rate": 0.21,
                "title": "VAT",
                "price_set": {
                    "shop_money": {
                        "amount": "784.14",
                        "currency_code": "ARS"
                    },
                    "presentment_money": {
                        "amount": "784.14",
                        "currency_code": "ARS"
                    }
                },
                "channel_liable": false
            }
        ],
        "taxes_included": false,
        "test": true,
        "token": "7593c007d927b382160510ef9e21778e",
        "total_discounts": "0.00",
        "total_discounts_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "ARS"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "ARS"
            }
        },
        "total_line_items_price": "3734.00",
        "total_line_items_price_set": {
            "shop_money": {
                "amount": "3734.00",
                "currency_code": "ARS"
            },
            "presentment_money": {
                "amount": "3734.00",
                "currency_code": "ARS"
            }
        },
        "total_outstanding": "0.00",
        "total_price": "5039.65",
        "total_price_set": {
            "shop_money": {
                "amount": "5039.65",
                "currency_code": "ARS"
            },
            "presentment_money": {
                "amount": "5039.65",
                "currency_code": "ARS"
            }
        },
        "total_price_usd": "51.96",
        "total_shipping_price_set": {
            "shop_money": {
                "amount": "521.51",
                "currency_code": "ARS"
            },
            "presentment_money": {
                "amount": "521.51",
                "currency_code": "ARS"
            }
        },
        "total_tax": "784.14",
        "total_tax_set": {
            "shop_money": {
                "amount": "784.14",
                "currency_code": "ARS"
            },
            "presentment_money": {
                "amount": "784.14",
                "currency_code": "ARS"
            }
        },
        "total_tip_received": "0.00",
        "total_weight": 300,
        "updated_at": "2021-08-13T12:45:37-03:00",
        "user_id": null,
        "billing_address": {
            "first_name": "Juan",
            "address1": "Laprida 1221",
            "phone": null,
            "city": "Buenos Aires",
            "zip": "1414",
            "province": "Buenos Aires",
            "country": "Argentina",
            "last_name": "Grasso",
            "address2": "",
            "company": null,
            "latitude": null,
            "longitude": null,
            "name": "Juan Grasso",
            "country_code": "AR",
            "province_code": "B"
        },
        "customer": {
            "id": 5543315275944,
            "email": "juan@gmail.com",
            "accepts_marketing": true,
            "created_at": "2021-08-13T10:46:13-03:00",
            "updated_at": "2021-08-13T12:45:36-03:00",
            "first_name": "Juan",
            "last_name": "Grasso",
            "orders_count": 0,
            "state": "disabled",
            "total_spent": "0.00",
            "last_order_id": null,
            "note": null,
            "verified_email": true,
            "multipass_identifier": null,
            "tax_exempt": false,
            "phone": null,
            "tags": "",
            "last_order_name": null,
            "currency": "ARS",
            "accepts_marketing_updated_at": "2021-08-13T10:46:13-03:00",
            "marketing_opt_in_level": "single_opt_in",
            "tax_exemptions": [],
            "admin_graphql_api_id": "gid://shopify/Customer/5543315275944",
            "default_address": {
                "id": 6747448180904,
                "customer_id": 5543315275944,
                "first_name": "Juan",
                "last_name": "Grasso",
                "company": null,
                "address1": "Laprida 1221",
                "address2": "",
                "city": "Buenos Aires",
                "province": "Buenos Aires",
                "country": "Argentina",
                "zip": "1414",
                "phone": null,
                "name": "Juan Grasso",
                "province_code": "B",
                "country_code": "AR",
                "country_name": "Argentina",
                "default": true
            }
        },
        "discount_applications": [],
        "fulfillments": [],
        "line_items": [
            {
                "id": 10479499772072,
                "admin_graphql_api_id": "gid://shopify/LineItem/10479499772072",
                "destination_location": {
                    "id": 3088827187368,
                    "country_code": "AR",
                    "province_code": "B",
                    "name": "Juan Grasso",
                    "address1": "Laprida 1241",
                    "address2": "",
                    "city": "Buenos Aires",
                    "zip": "1414"
                },
                "fulfillable_quantity": 1,
                "fulfillment_service": "manual",
                "fulfillment_status": null,
                "gift_card": false,
                "grams": 0,
                "name": "Sucursal B",
                "origin_location": {
                    "id": 3069945708712,
                    "country_code": "AR",
                    "province_code": "B",
                    "name": "tiendacon",
                    "address1": "1450 Fitz Roy",
                    "address2": "",
                    "city": "Buenos Aires",
                    "zip": "1414"
                },
                "price": "1234.00",
                "price_set": {
                    "shop_money": {
                        "amount": "1234.00",
                        "currency_code": "ARS"
                    },
                    "presentment_money": {
                        "amount": "1234.00",
                        "currency_code": "ARS"
                    }
                },
                "product_exists": true,
                "product_id": 6975677300904,
                "properties": [],
                "quantity": 1,
                "requires_shipping": true,
                "sku": "",
                "taxable": true,
                "title": "Sucursal B",
                "total_discount": "0.00",
                "total_discount_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "ARS"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "ARS"
                    }
                },
                "variant_id": 40735447253160,
                "variant_inventory_management": "shopify",
                "variant_title": "",
                "vendor": "tiendacon",
                "tax_lines": [
                    {
                        "channel_liable": false,
                        "price": "259.14",
                        "price_set": {
                            "shop_money": {
                                "amount": "259.14",
                                "currency_code": "ARS"
                            },
                            "presentment_money": {
                                "amount": "259.14",
                                "currency_code": "ARS"
                            }
                        },
                        "rate": 0.21,
                        "title": "VAT"
                    }
                ],
                "duties": [],
                "discount_allocations": []
            },
            {
                "id": 10479499804840,
                "admin_graphql_api_id": "gid://shopify/LineItem/10479499804840",
                "destination_location": {
                    "id": 3088827187368,
                    "country_code": "AR",
                    "province_code": "B",
                    "name": "Juan Grasso",
                    "address1": "Laprida 1241",
                    "address2": "",
                    "city": "Buenos Aires",
                    "zip": "1414"
                },
                "fulfillable_quantity": 1,
                "fulfillment_service": "manual",
                "fulfillment_status": null,
                "gift_card": false,
                "grams": 100,
                "name": "Sucursal A y B",
                "origin_location": {
                    "id": 3069945708712,
                    "country_code": "AR",
                    "province_code": "B",
                    "name": "tiendacon",
                    "address1": "1450 Fitz Roy",
                    "address2": "",
                    "city": "Buenos Aires",
                    "zip": "1414"
                },
                "price": "1000.00",
                "price_set": {
                    "shop_money": {
                        "amount": "1000.00",
                        "currency_code": "ARS"
                    },
                    "presentment_money": {
                        "amount": "1000.00",
                        "currency_code": "ARS"
                    }
                },
                "product_exists": true,
                "product_id": 6975678251176,
                "properties": [],
                "quantity": 1,
                "requires_shipping": true,
                "sku": "",
                "taxable": true,
                "title": "Sucursal A y B",
                "total_discount": "0.00",
                "total_discount_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "ARS"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "ARS"
                    }
                },
                "variant_id": 40735454232744,
                "variant_inventory_management": "shopify",
                "variant_title": "",
                "vendor": "tiendacon",
                "tax_lines": [
                    {
                        "channel_liable": false,
                        "price": "210.00",
                        "price_set": {
                            "shop_money": {
                                "amount": "210.00",
                                "currency_code": "ARS"
                            },
                            "presentment_money": {
                                "amount": "210.00",
                                "currency_code": "ARS"
                            }
                        },
                        "rate": 0.21,
                        "title": "VAT"
                    }
                ],
                "duties": [],
                "discount_allocations": []
            },
            {
                "id": 10479499837608,
                "admin_graphql_api_id": "gid://shopify/LineItem/10479499837608",
                "destination_location": {
                    "id": 3088827187368,
                    "country_code": "AR",
                    "province_code": "B",
                    "name": "Juan Grasso",
                    "address1": "Laprida 1241",
                    "address2": "",
                    "city": "Buenos Aires",
                    "zip": "1414"
                },
                "fulfillable_quantity": 1,
                "fulfillment_service": "manual",
                "fulfillment_status": null,
                "gift_card": false,
                "grams": 200,
                "name": "Sucursal A",
                "origin_location": {
                    "id": 3069945708712,
                    "country_code": "AR",
                    "province_code": "B",
                    "name": "tiendacon",
                    "address1": "1450 Fitz Roy",
                    "address2": "",
                    "city": "Buenos Aires",
                    "zip": "1414"
                },
                "price": "1500.00",
                "price_set": {
                    "shop_money": {
                        "amount": "1500.00",
                        "currency_code": "ARS"
                    },
                    "presentment_money": {
                        "amount": "1500.00",
                        "currency_code": "ARS"
                    }
                },
                "product_exists": true,
                "product_id": 6975676448936,
                "properties": [],
                "quantity": 1,
                "requires_shipping": true,
                "sku": "",
                "taxable": true,
                "title": "Sucursal A",
                "total_discount": "0.00",
                "total_discount_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "ARS"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "ARS"
                    }
                },
                "variant_id": 40735438995624,
                "variant_inventory_management": "shopify",
                "variant_title": "",
                "vendor": "tiendacon",
                "tax_lines": [
                    {
                        "channel_liable": false,
                        "price": "315.00",
                        "price_set": {
                            "shop_money": {
                                "amount": "315.00",
                                "currency_code": "ARS"
                            },
                            "presentment_money": {
                                "amount": "315.00",
                                "currency_code": "ARS"
                            }
                        },
                        "rate": 0.21,
                        "title": "VAT"
                    }
                ],
                "duties": [],
                "discount_allocations": []
            }
        ],
        "payment_details": {
            "credit_card_bin": "1",
            "avs_result_code": null,
            "cvv_result_code": null,
            "credit_card_number": "•••• •••• •••• 1",
            "credit_card_company": "Bogus"
        },
        "refunds": [],
        "shipping_address": {
            "first_name": "Juan",
            "address1": "Laprida 1221",
            "phone": null,
            "city": "Buenos Aires",
            "zip": "1414",
            "province": "Buenos Aires",
            "country": "Argentina",
            "last_name": "Grasso",
            "address2": "",
            "company": null,
            "latitude": null,
            "longitude": null,
            "name": "Juan Grasso",
            "country_code": "AR",
            "province_code": "B"
        },
        "shipping_lines": [
            {
                "id": 3434890789032,
                "carrier_identifier": "bfcddd2d751f543f42c0a263b9a8ac5d",
                "code": "ON",
                "delivery_category": null,
                "discounted_price": "521.51",
                "discounted_price_set": {
                    "shop_money": {
                        "amount": "521.51",
                        "currency_code": "ARS"
                    },
                    "presentment_money": {
                        "amount": "521.51",
                        "currency_code": "ARS"
                    }
                },
                "phone": null,
                "price": "521.51",
                "price_set": {
                    "shop_money": {
                        "amount": "521.51",
                        "currency_code": "ARS"
                    },
                    "presentment_money": {
                        "amount": "521.51",
                        "currency_code": "ARS"
                    }
                },
                "requested_fulfillment_service_id": null,
                "source": "Pedidos YA",
                "title": "Pedidos Ya",
                "tax_lines": [],
                "discount_allocations": []
            }
        ]
    }
}

 

In wich There are 3 items:
- One of them asigned to the location A.

- Two of them asigned to the location B.

As you can see in the following image:

JuanGrasso_0-1628870373325.png

I understand that under this order there ara two FulfillmentOrders, one for each location. When i see the order object, all the items have the same origin_location:

origin_location": {
                    "id": 3069945708712,
                    "country_code": "AR",
                    "province_code": "B",
                    "name": "tiendacon",
                    "address1": "1450 Fitz Roy",
                    "address2": "",
                    "city": "Buenos Aires",
                    "zip": "1414"
                }

 

I need to know in wich location each one of this items was assigned so i can pass that information to my shipping sistem. So i understand  that what i need is to get the two FullfilmentOrders asigned to this particular order (order_id=4071883210920). How ever when i make request to the API:

https://tiendacon.myshopify.com/admin/api/2021-07/orders/4071883210920/fulfillment_orders.json

 

I get the following response with status 200:

{
    "fulfillment_orders": []
}

 

An empty array.

I need to know if im misundertanding some concept. Or what im doing wrong.

I have been using other api endpoints to create a carrier service, get locations, get orders, delete, etc so i thik that its possible that there may a problem with this specific one.

Accepted Solution (1)

GrahamS
Shopify Staff (Retired)
193 36 53

This is an accepted solution.

Hello @JuanGrasso ,

I believe you're running into a permissions issue - please see this thread: https://community.shopify.com/c/Shopify-APIs-SDKs/FulfillmentOrders-always-works-in-GraphiQL-App-but...

Best,

Graham

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Replies 2 (2)

GrahamS
Shopify Staff (Retired)
193 36 53

This is an accepted solution.

Hello @JuanGrasso ,

I believe you're running into a permissions issue - please see this thread: https://community.shopify.com/c/Shopify-APIs-SDKs/FulfillmentOrders-always-works-in-GraphiQL-App-but...

Best,

Graham

To learn more visit the Shopify Help Center or the Community Blog.

HorseCowboy
Shopify Partner
59 0 24

As an aside: OriginLocation is where the Order was made. Don't confuse it with the assigned Location which is about Fulfillment.

Check out why Shopify store owners are switching to Horse for all of their inventory management needs.