Get the order total shipping in Woocommerce 3 Get the order total shipping in Woocommerce 3 wordpress wordpress

Get the order total shipping in Woocommerce 3


Since Woocommerce 3 get_total_shipping() method is replaced by get_shipping_total() .

So there is actually 2 available CRUD getters methods for shipping totals in WC_Abstract_Order Class that can be used on the WC_Order instance object:

  • get_shipping_total() that is the shipping total excluding taxes
  • get_shipping_tax() that is the shipping taxes total

So you will use them with the $order variable object simply this way:

$shipping_total = $order->get_shipping_total();$shipping_tax   = $order->get_shipping_tax();

There is also get_shipping_to_display() method that will output the formatted shipping total.