Automattic\WooCommerce\Internal\Fulfillments
FulfillmentsRenderer::maybe_read_fulfillments
Fetches the fulfillments for the given order, caching them to avoid multiple fetches.
Метод класса: FulfillmentsRenderer{}
Хуков нет.
Возвращает
Массив. The fulfillments for the order.
Использование
// private - только в коде основоного (родительского) класса $result = $this->maybe_read_fulfillments( $order ): array;
- $order(WC_Order) (обязательный)
- The order object.
Код FulfillmentsRenderer::maybe_read_fulfillments() FulfillmentsRenderer::maybe read fulfillments WC 10.3.6
private function maybe_read_fulfillments( WC_Order $order ): array {
// Check if we've already fetched the fulfillments for this order.
if ( isset( $this->fulfillments_cache[ $order->get_id() ] ) ) {
return $this->fulfillments_cache[ $order->get_id() ];
}
// If not, fetch them and cache them.
$data_store = wc_get_container()->get( FulfillmentsDataStore::class );
$fulfillments = $data_store->read_fulfillments( WC_Order::class, '' . $order->get_id() );
$this->fulfillments_cache[ $order->get_id() ] = $fulfillments;
return $fulfillments;
}