Automattic\WooCommerce\Internal\ProductAttributesLookup
LookupDataStore::on_product_created_or_updated_via_rest_api()
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.
Return
null
. Nothing (null).
Usage
$LookupDataStore = new LookupDataStore(); $LookupDataStore->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() LookupDataStore::on product created or updated via rest api code WC 9.7.1
public 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 ); } }