Automattic\WooCommerce\Internal\ProductAttributesLookup
LookupDataStore::run_update_callback()
Perform an update of the lookup table for a specific product.
Метод класса: LookupDataStore{}
Хуков нет.
Возвращает
null
. Ничего.
Использование
// private - только в коде основоного (родительского) класса $result = $this->run_update_callback( $product_id, $action );
- $product_id(int) (обязательный)
- The product id to perform the update for.
- $action(int) (обязательный)
- The action to perform, one of the ACTION_ constants.
Код LookupDataStore::run_update_callback() LookupDataStore::run update callback WC 7.5.1
private function run_update_callback( int $product_id, int $action ) { if ( ! $this->check_lookup_table_exists() ) { return; } $product = WC()->call_function( 'wc_get_product', $product_id ); if ( ! $product ) { $action = self::ACTION_DELETE; } switch ( $action ) { case self::ACTION_INSERT: $this->delete_data_for( $product_id ); $this->create_data_for( $product ); break; case self::ACTION_UPDATE_STOCK: $this->update_stock_status_for( $product ); break; case self::ACTION_DELETE: $this->delete_data_for( $product_id ); break; } }