/** * Returns the string that indicates the shipping applied with an order. This * method is an almost exact copy of WC_Order::get_shipping_to_display(). * * @param WC_Order order The WooCommerce order. * @param string tax_display Purpose unknown, undocumented in original * file and never passed when method is called. * @return string * * @see WC_Order::get_shipping_to_display(). */ public function get_shipping_to_display($order, $tax_display = '') { if (empty($tax_display)) { $tax_display = $order->tax_display_cart; } $order = new Aelia_Order($order->id); if ($order->order_shipping > 0) { $order_currency = $order->get_order_currency(); $tax_text = ''; if ($tax_display == 'excl') { // Show shipping excluding tax $shipping = $this->format_price($order->order_shipping, $order_currency); if ($order->order_shipping_tax > 0 && $order->prices_include_tax) { $tax_text = $this->wc()->countries->ex_tax_or_vat() . ' '; } } else { // Show shipping including tax $shipping = $this->format_price($order->order_shipping + $order->order_shipping_tax, $order_currency); if ($order->order_shipping_tax > 0 && !$order->prices_include_tax) { $tax_text = $this->wc()->countries->inc_tax_or_vat() . ' '; } } $shipping .= sprintf(__(' <small>%svia %s</small>', 'woocommerce'), $tax_text, $order->get_shipping_method()); } elseif ($order->get_shipping_method()) { $shipping = $order->get_shipping_method(); } else { $shipping = __('Free!', 'woocommerce'); } return $shipping; }