How to get shipping info including product and package weight?

How to get shipping info including product and package weight?

Mia_123
Shopify Partner
2 0 0

Hi guys, I'm working on an app and I'd like to show the shipping information on my order detail page. Is there any any api could help?

This is the information I want to show on my app. I don't find a field in order API to show the shipping details.

截屏2024-09-20 10.37.08.png

Replies 2 (2)

SomeUsernameHe
Shopify Partner
515 57 109

https://shopify.dev/docs/api/admin-rest/2024-07/resources/order

shippingAddress

The mailing address of the customer.


shippingLine

A summary of all shipping costs on the order.

 

or you can use GraphQL:
https://shopify.dev/docs/api/admin-graphql/2024-07/objects/Order

 

Key fields from the Order API for shipping information:
shipping_lines: This contains the details of the shipping method applied to the order, including the title, price, and other details.

shipping_address: This contains the shipping destination, which can help you display where the items are being shipped to.

Here’s an example of how to retrieve this data using the Shopify Admin REST API.

Example API Response (Order API):

 

 

{
  "order": {
    "id": 123456789,
    "email": "[email protected]",
    "shipping_lines": [
      {
        "title": "Standard Delivery (4-7 days)",
        "price": "5.00",
        "code": "Standard",
        "source": "shopify",
        "requested_fulfillment_service_id": null,
        "delivery_category": null,
        "carrier_identifier": null,
        "discounted_price": "5.00",
        "phone": null
      }
    ],
    "shipping_address": {
      "first_name": "John",
      "address1": "123 Shipping St",
      "city": "Cityville",
      "province": "State",
      "country": "United States",
      "zip": "12345"
    },
    "line_items": [
      {
        "name": "Product Name",
        "quantity": 1,
        "grams": 29
      }
    ]
  }
}

 

 

Breakdown:
shipping_lines.title: "Standard Delivery (4-7 days)"
shipping_lines.price: €5.00
line_items.grams: 29 grams
Integration Steps:
Call the Shopify Admin API: Use the order ID to retrieve the necessary information.
Extract the relevant fields: Parse out the shipping lines, shipping address, and weight from the line items.
Display the data in your app: Format and present this data similarly to the receipt shown in your image.

Have I helped? Consider putting coffee in my mouth!
Buy Me a Coffee
Mia_123
Shopify Partner
2 0 0

Thank!I'm using 2024-01 version API. But the thing is I can only retrieve the total weight of my order, I didn't find a field that show the package's weight. In the Shopify console, there's a field in order called financial summery, and it contains the shipping and weight information.

截屏2024-09-20 10.37.08.png