Automattic\WooCommerce\Internal\Caches

ProductVersionStringInvalidator::register_hooksprivateWC 1.0

Register all product-related hooks.

Registers ALL hooks (WordPress and WooCommerce) to ensure comprehensive coverage. This handles both standard data stores and custom implementations, as well as third-party plugins that may use direct SQL with manual hook firing.

Метод класса: ProductVersionStringInvalidator{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// private - только в коде основоного (родительского) класса
$result = $this->register_hooks(): void;

Код ProductVersionStringInvalidator::register_hooks() WC 10.5.2

private function register_hooks(): void {
	// WordPress post hooks for products.
	add_action( 'save_post_product', array( $this, 'handle_save_post_product' ), 10, 1 );
	add_action( 'delete_post', array( $this, 'handle_delete_post' ), 10, 2 );
	add_action( 'trashed_post', array( $this, 'handle_trashed_post' ), 10, 1 );
	add_action( 'untrashed_post', array( $this, 'handle_untrashed_post' ), 10, 1 );

	// WooCommerce CRUD hooks for products.
	add_action( 'woocommerce_new_product', array( $this, 'handle_woocommerce_new_product' ), 10, 1 );
	add_action( 'woocommerce_update_product', array( $this, 'handle_woocommerce_update_product' ), 10, 1 );
	add_action( 'woocommerce_before_delete_product', array( $this, 'handle_woocommerce_before_delete_product' ), 10, 1 );
	add_action( 'woocommerce_trash_product', array( $this, 'handle_woocommerce_trash_product' ), 10, 1 );

	// WooCommerce CRUD hooks for variations.
	add_action( 'woocommerce_new_product_variation', array( $this, 'handle_woocommerce_new_product_variation' ), 10, 2 );
	add_action( 'woocommerce_update_product_variation', array( $this, 'handle_woocommerce_update_product_variation' ), 10, 2 );
	add_action( 'woocommerce_before_delete_product_variation', array( $this, 'handle_woocommerce_before_delete_product_variation' ), 10, 1 );
	add_action( 'woocommerce_trash_product_variation', array( $this, 'handle_woocommerce_trash_product_variation' ), 10, 1 );

	// SQL-level operation hooks.
	add_action( 'woocommerce_updated_product_stock', array( $this, 'handle_woocommerce_updated_product_stock' ), 10, 1 );
	add_action( 'woocommerce_updated_product_price', array( $this, 'handle_woocommerce_updated_product_price' ), 10, 1 );
	add_action( 'woocommerce_updated_product_sales', array( $this, 'handle_woocommerce_updated_product_sales' ), 10, 1 );

	// Attribute-related hooks (only for CPT data store).
	// These hooks use direct SQL queries that assume CPT storage.
	if ( $this->is_using_cpt_data_store() ) {
		add_action( 'woocommerce_attribute_updated', array( $this, 'handle_woocommerce_attribute_updated' ), 10, 2 );
		add_action( 'woocommerce_attribute_deleted', array( $this, 'handle_woocommerce_attribute_deleted' ), 10, 3 );
		add_action( 'woocommerce_updated_product_attribute_summary', array( $this, 'handle_woocommerce_updated_product_attribute_summary' ), 10, 1 );
		add_action( 'edited_term', array( $this, 'handle_edited_term' ), 10, 3 );
	}
}