Search Knowledge Base by Keyword

Switch UPS Account Based on Shipping Class with UPS WooCommerce Shipping.

One of our customers, Scott, presented an interesting business case. He ships from two warehouses, located quite far from each other (one located on the East Coast of the US and the other in the West.) He maintains separate UPS accounts for each warehouse and wanted to use them selectively depending on which warehouse was closest to the customer.

Scott asked us if it is possible to connect more than one UPS accounts and choose which one to use for a particular order. In response, we devised a workaround for this case as described below:

When products belonging to shipping class ‘X’ are in the order, the plugin will select UPS Account number ‘A’ for label printing. When the products belonging to shipping class ‘Y’  are in the order, the plugin will select UPS Account number ‘B’. As you might be wondering, when products from both shipping classes (X and Y) are in the cart, the plugin will select UPS Account number ‘A’ again.

We developed a code snippet that enables to switch UPS accounts based on shipping class when using our UPS WooCommerce Shipping Plugin.

After updating your alternate UPS account number into the following code snippet, you can simply add the code snippet to your functions.php:

In the above code, there is an array $alternate_account where you  can configure the UPS account details (B) and a shipping class (Y) in the array.

If a particular order has only products belonging to this shipping class (Y), the alternative account (B) will be used, otherwise use default account (A).

Last Updated On September 24, 2018

4 thoughts on “Switch UPS Account Based on Shipping Class with UPS WooCommerce Shipping.

  1. nickh says:

    Does this snippet for your UPS basic or just the premium? I have it place with the basic and it is not functioning.

    • Anindo
      Anindo says:

      Hi Nick,

      This snippet works with the premium plugin only. Unfortunately, we do not have a similar compatible snippet for the basic version. You can use our premium version to work with this functionality.

  2. Destiny
    Destiny says:

    My client ships wine and merchandise, which must be packaged and shipped separately, under different UPS account numbers. This snippet is almost what we need.

    “As you might be wondering, when products from both shipping classes (X and Y) are in the cart, the plugin will select UPS Account number ‘A’ again.” Can you help me change this so that both UPS Account numbers will be used, instead of defaulting to just one?

    Thanks so much!

    Diane, Destiny’s developer

    • Anindo
      Anindo says:

      Hi Diana,

      We are already in communication with you on this . Our team will get back to you via the ticket as soon as possible.

      Let us know if you have any query.

Comments are closed.