WC_Cart_Totals::get_shipping_from_cart()
Get shipping methods from the cart and normalise.
Метод класса: WC_Cart_Totals{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_shipping_from_cart();
Список изменений
С версии 3.2.0 | Введена. |
Код WC_Cart_Totals::get_shipping_from_cart() WC Cart Totals::get shipping from cart WC 8.7.0
protected function get_shipping_from_cart() { $this->shipping = array(); if ( ! $this->cart->show_shipping() ) { return; } foreach ( $this->cart->calculate_shipping() as $key => $shipping_object ) { $shipping_line = $this->get_default_shipping_props(); $shipping_line->object = $shipping_object; $shipping_line->tax_class = get_option( 'woocommerce_shipping_tax_class' ); $shipping_line->taxable = true; $shipping_line->total = wc_add_number_precision_deep( $shipping_object->cost ); $shipping_line->taxes = wc_add_number_precision_deep( $shipping_object->taxes, false ); $shipping_line->taxes = array_map( array( $this, 'round_item_subtotal' ), $shipping_line->taxes ); $shipping_line->total_tax = array_sum( $shipping_line->taxes ); $this->shipping[ $key ] = $shipping_line; } }