WC_REST_Paypal_Standard_Controller::get_order_shipping_rate_id
Get the shipping rate id from the order.
Метод класса: WC_REST_Paypal_Standard_Controller{}
Хуков нет.
Возвращает
string. The shipping rate id.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_order_shipping_rate_id( $order );
- $order(WC_Order) (обязательный)
- The order object.
Код WC_REST_Paypal_Standard_Controller::get_order_shipping_rate_id() WC REST Paypal Standard Controller::get order shipping rate id WC 11.2.1
private function get_order_shipping_rate_id( $order ) {
$order_shipping_item = current( $order->get_items( 'shipping' ) ) ?? null;
if ( $order_shipping_item ) {
$method_id = $order_shipping_item->get_method_id();
$instance_id = $order_shipping_item->get_instance_id();
$rate_id = ( '' === $instance_id || null === $instance_id ) ? $method_id : "{$method_id}:{$instance_id}";
return $rate_id;
}
return '';
}