Automattic\WooCommerce\Internal\Fulfillments

OrderFulfillmentsRestController::validate_fulfillmentprivateWC 1.0

Validate the fulfillment.

Метод класса: OrderFulfillmentsRestController{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// private - только в коде основоного (родительского) класса
$result = $this->validate_fulfillment( $fulfillment, $fulfillment_id, $order_id );
$fulfillment(Fulfillment) (обязательный)
The fulfillment object.
$fulfillment_id(int) (обязательный)
The fulfillment ID.
$order_id(int) (обязательный)
The order ID.

Код OrderFulfillmentsRestController::validate_fulfillment() WC 10.3.6

private function validate_fulfillment( Fulfillment $fulfillment, int $fulfillment_id, int $order_id ) {
	if ( $fulfillment->get_id() !== $fulfillment_id || $fulfillment->get_entity_type() !== WC_Order::class || $fulfillment->get_entity_id() !== "$order_id" ) {
		throw new \Exception( esc_html__( 'Invalid fulfillment ID.', 'woocommerce' ) );
	}
}