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.

Method of the class: LookupDataStore{}

No Hooks.


null. Nothing (null).


// private - for code of main (parent) class only
$result = $this->on_product_created_or_updated_via_rest_api( $product, $request ): void;
$product(\WP_Post) (required)
The post representing the created or updated product.
$request(\WP_REST_Request) (required)
The REST request that caused the hook to be fired.

LookupDataStore::on_product_created_or_updated_via_rest_api() code WC 8.9.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 );