Automattic\WooCommerce\StoreApi\Schemas\V1\Agentic
CheckoutSessionSchema::get_selected_fulfillment_option_id_from_order
Get selected fulfillment option ID from order.
Method of the class: CheckoutSessionSchema{}
No Hooks.
Returns
String|null. Selected option ID or null.
Usage
// protected - for code of main (parent) or child class $result = $this->get_selected_fulfillment_option_id_from_order( $order );
- $order(WC_Order) (required)
- Order object.
CheckoutSessionSchema::get_selected_fulfillment_option_id_from_order() CheckoutSessionSchema::get selected fulfillment option id from order code WC 10.7.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();
}