By default the Shipping Method is pulled from the shipping_description field in the data located via the path: order.shipping_description. 


In order to change the path used to get the Shipping Method, you will need to enter a new path to direct Shiptheory to where it can find this data in your shipments or orders.



Path syntax

The Shipping Method path uses dot notation to dictate how to navigate through the JSON data Shiptheory downloads from Magento 2 when processing your orders and shipments.


For example:

order.base_currency_code


Would extract "GBP" from the order data below:


{
  "order": {
    "base_currency_code": "GBP",
    "base_discount_amount": 0,
    "base_discount_invoiced": 0,
    "base_grand_total": 463.31,
    "base_discount_tax_compensation_amount": 0,
    "base_discount_tax_compensation_invoiced": 0,
    "base_shipping_amount": 4.5
    }
}



  • Depending on where you have chosen to get your shipping method from, the path can guide Shiptheory to download the message from either your Magento 2 order or shipment data. As such, the path should always start with the word "orderor "shipment".

  • The path is Case Sensitive. For example, "name" will match "name" but not "Name" or "NAME".


  • {n} can be used to match any unordered elements, such as multiple line items or notes.

  • If multiple matches can be made, only the first match is returned.

  • If you need to match an element where an attribute matches a certain value, you can add a match condition to the path in square brackets. For example, if you had an unordered list of products and you wanted to return the name of a product with a certain SKU, you could use something like the example below:

    order.items.{n}[sku=AB123].name



Data Path testing tool

We have a tool to help you build and test your data path, available here: https://helm.shiptheory.com/sandbox/find_data_path.


Simply copy-and-paste the JSON data from a Magento 2 order or shipment into the tool and you will be able to enter and test your data path before saving to your Magento 2 settings.



More examples


{
    "order": {
        "entity_id": 2048,
        "extension_attributes": {
            "notes": [
                {
                    "name": "note",
                    "value": "Note A"
                },
                {
                    "name": "note",
                    "value": "Note B"
                }
            ]
        },
        "increment_id": "000140283",
        "items": [
            {
                "item_id": 5756501196957,
                "name": "White T-Shirt",
                "notes": [
                    {
                        "name": "gift_message",
                        "value": "Happy Birthday Jack!"
                    }
                ],
                "price": 13.95,
                "product_type": "simple",
                "qty_ordered": 1,
                "sku": "tshirt-w"
            },
            {
                "item_id": 5756501196235,
                "name": "Blue T-Shirt",
                "notes": [
                    {
                        "name": "gift_message",
                        "value": "Merry Christmas Sophie!"
                    }
                ],
                "price": 13.95,
                "product_type": "simple",
                "qty_ordered": 1,
                "sku": "tshirt-b"
            }
        ],
        "note": "This is an order note"
    }
}


  • order.note
    Returns: This is an order note

  • order.extension_attributes.notes.{n}.value
    Since this has multiple matches (Note A and Note B), the first match is returned
    Returns: Note A

  • order.items.{n}[sku=tshirt-b].name
    Returns: Blue T-Shirt



If you have any questions regarding this or anything else, please don't hesitate to get in touch with the Shiptheory support team!