Automattic\WooCommerce\StoreApi\Schemas\V1\Agentic
CheckoutSessionSchema::get_selected_fulfillment_option_id_from_order
Get selected fulfillment option ID from order.
Метод класса: CheckoutSessionSchema{}
Хуков нет.
Возвращает
Строку|null. Selected option ID or null.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_selected_fulfillment_option_id_from_order( $order );
- $order(WC_Order) (обязательный)
- Order object.
Код CheckoutSessionSchema::get_selected_fulfillment_option_id_from_order() CheckoutSessionSchema::get selected fulfillment option id from order WC 10.5.0
protected function get_selected_fulfillment_option_id_from_order( $order ) {
$shipping_methods = $order->get_shipping_methods();
if ( empty( $shipping_methods ) ) {
return null;
}
$shipping_method = reset( $shipping_methods );
return $shipping_method->get_method_id() . ':' . $shipping_method->get_instance_id();
}