Automattic\WooCommerce\Internal\ProductAttributesLookup

LookupDataStore::on_product_created_or_updated_via_rest_api()privateWC 1.0

Handler for the woocommerce_rest_insert_product hook. Needed to update the lookup table when the REST API batch insert/update endpoints are used.

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

Хуков нет.

Возвращает

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

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

// private - только в коде основоного (родительского) класса
$result = $this->on_product_created_or_updated_via_rest_api( $product, $request ): void;
$product(\WP_Post) (обязательный)
The post representing the created or updated product.
$request(\WP_REST_Request) (обязательный)
The REST request that caused the hook to be fired.

Код LookupDataStore::on_product_created_or_updated_via_rest_api() WC 8.7.0

private function on_product_created_or_updated_via_rest_api( \WP_Post $product, \WP_REST_Request $request ): void {
	if ( StringUtil::ends_with( $request->get_route(), '/batch' ) ) {
		$this->on_product_changed( $product->ID );
	}
}