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.
Метод класса: LookupDataStore{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$LookupDataStore = new LookupDataStore(); $LookupDataStore->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() LookupDataStore::on product created or updated via rest api WC 10.6.2
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 );
}
}