Automattic\WooCommerce\Internal\ProductAttributesLookup
LookupDataStore::on_product_changed()
Insert/update the appropriate lookup table entries for a new or modified product or variation. This must be invoked after a product or a variation is created (including untrashing and duplication) or modified.
Method of the class: LookupDataStore{}
No Hooks.
Return
null
. Nothing (null).
Usage
$LookupDataStore = new LookupDataStore(); $LookupDataStore->on_product_changed( $product, $changeset );
- $product(int|\WC_Product) (required)
- Product object or product id.
- $changeset(null|array)
- Changes as provided by 'get_changes' method in the product object, null if it's being created.
Default: null
LookupDataStore::on_product_changed() LookupDataStore::on product changed code WC 9.5.1
public function on_product_changed( $product, $changeset = null ) { if ( ! $this->check_lookup_table_exists() ) { return; } if ( ! is_a( $product, \WC_Product::class ) ) { $product = WC()->call_function( 'wc_get_product', $product ); } $action = $this->get_update_action( $changeset ); if ( self::ACTION_NONE !== $action ) { $this->maybe_schedule_update( $product->get_id(), $action ); } }