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.
Метод класса: LookupDataStore{}
Хуков нет.
Возвращает
null
. Ничего.
Использование
$LookupDataStore = new LookupDataStore(); $LookupDataStore->on_product_changed( $product, $changeset );
- $product(int|\WC_Product) (обязательный)
- Product object or product id.
- $changeset(null|массив)
- Changes as provided by 'get_changes' method in the product object, null if it's being created.
По умолчанию: null
Код LookupDataStore::on_product_changed() LookupDataStore::on product changed WC 7.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 ( $action !== self::ACTION_NONE ) { $this->maybe_schedule_update( $product->get_id(), $action ); } }