Automattic\WooCommerce\Internal\ProductAttributesLookup
LookupDataStore::on_product_deleted
Delete the lookup table contents related to a given product or variation, if it's a variable product it deletes the information for variations too. This must be invoked after a product or a variation is trashed or deleted.
Method of the class: LookupDataStore{}
No Hooks.
Returns
null. Nothing (null).
Usage
$LookupDataStore = new LookupDataStore(); $LookupDataStore->on_product_deleted( $product );
- $product(int|\WC_Product) (required)
- Product object or product id.
LookupDataStore::on_product_deleted() LookupDataStore::on product deleted code WC 10.3.6
public function on_product_deleted( $product ) {
if ( ! $this->check_lookup_table_exists() ) {
return;
}
if ( is_a( $product, \WC_Product::class ) ) {
$product_id = $product->get_id();
} else {
$product_id = $product;
}
$this->maybe_schedule_update( $product_id, self::ACTION_DELETE );
}