Automattic\WooCommerce\Blocks\Shipping
ShippingController::show_local_pickup_details()
Inject collection details onto the order received page.
Метод класса: ShippingController{}
Хуков нет.
Возвращает
Строку
.
Использование
$ShippingController = new ShippingController(); $ShippingController->show_local_pickup_details( $return_value, $order );
- $return_value(строка) (обязательный)
- Return value.
- $order(\WC_Order) (обязательный)
- Order object.
Код ShippingController::show_local_pickup_details() ShippingController::show local pickup details WC 9.3.3
public function show_local_pickup_details( $return_value, $order ) { // Confirm order is valid before proceeding further. if ( ! $order instanceof \WC_Order ) { return $return_value; } $shipping_method_ids = ArrayUtil::select( $order->get_shipping_methods(), 'get_method_id', ArrayUtil::SELECT_BY_OBJECT_METHOD ); $shipping_method_id = current( $shipping_method_ids ); // Ensure order used pickup location method, otherwise bail. if ( 'pickup_location' !== $shipping_method_id ) { return $return_value; } $shipping_method = current( $order->get_shipping_methods() ); $details = $shipping_method->get_meta( 'pickup_details' ); $location = $shipping_method->get_meta( 'pickup_location' ); $address = $shipping_method->get_meta( 'pickup_address' ); if ( ! $address ) { return $return_value; } return sprintf( // Translators: %s location name. __( 'Collection from <strong>%s</strong>:', 'woocommerce' ), $location ) . '<br/><address>' . str_replace( ',', ',<br/>', $address ) . '</address><br/>' . $details; }