Multi Origin

Sometimes you ship from multiple places. Below is an example of how to ship USPS from the US, Fedex from Canada.

"origins": [
    {
        "name": [
            "default"
        ],
        "address": {
            "country": "US",
            "postal_code": "90028",
            "province": "CA",
            "city": "Hollywood",
            "address1": "6925 Hollywood Blvd"
        }
    },
    {
        "name": [
            "CA"
        ],
        "address": {
            "country": "CA",
            "postal_code": "M5V 2T6",
            "province": "ON",
            "city": "Toronto",
            "address1": "301 Front St W"
        }
    }
],
"USPS": {
    "enabled": true,
    "config": {
        "plan": "plus"
    },
    "services": [
        {
            "code": "PRIORITY"
        }
    ]
},
"Fedex": {
    "enabled": true,
    "config": {
        "type": "production",
        "key": "",
        "password": "",
        "shipaccount": "",
        "meter": ""
    },
    "default": {
        "origin": ["CA"]
    },
    "services": [
        {
            "code": "STANDARD_OVERNIGHT"
        }
    ]
}

Now let's say you wanted to ship via Fedex from both the US and Canada. In that case, you would need to add a zone and/or condition to the "CA" address so the system knows when it should be used. It will go over each address in sequence, taking the first that has a true zone and/or condition (with the exception of the default which will be selected last, no matter what).

"origins": [
    {
        "name": [
            "default"
        ],
        "address": {
            "country": "US",
            "postal_code": "90028",
            "province": "CA",
            "city": "Hollywood",
            "address1": "6925 Hollywood Blvd"
        }
    },
    {
        "name": [
            "CA"
        ],
        "address": {
            "country": "CA",
            "postal_code": "M5V 2T6",
            "province": "ON",
            "city": "Toronto",
            "address1": "301 Front St W"
        },
        "zone": {
            "country": [
                "CA"
            ]
        },
        "condition": [
            {
                "set": {
                    "type": "ALL",
                    "on": "items"
                },
                "on": "tags",
                "operator": "INCLUDES",
                "value": "CA"
            }
        ]
    }
],
"USPS": {
    "enabled": true,
    "config": {
        "plan": "plus"
    },
    "services": [
        {
            "code": "PRIORITY"
        }
    ]
},
"Fedex": {
    "enabled": true,
    "config": {
        "type": "production",
        "key": "",
        "password": "",
        "shipaccount": "",
        "meter": ""
    },
    "default": {
        "origin": ["default", "CA"]
    },
    "services": [
        {
            "code": "STANDARD_OVERNIGHT"
        },
        {
            "origin": ["default"]
            "code": "INTERNATIONAL_ECONOMY",
            "total_price": 3500,
            "zone": {
                "country": [
                    "CA",
                    "UK"
                ]
            }
        }
    ]
}

In this case, the Fedex origin will be Canada if the destination is Canada and all items in the cart are tagged with "CA". This way if there is only a subset of inventory in the Canada warehouse, other items can still go out of the US warehouse. There is also a new rate for Fedex International Economy which can only go to the US and Canada and can only originate from the US warehouse. This means it will only be present if the items are coming from the "default" origin in the US.

results matching ""

    No results matching ""