WC_Brands::register_hooks
Register our hooks
Метод класса: WC_Brands{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$WC_Brands = new WC_Brands(); $WC_Brands->register_hooks();
Код WC_Brands::register_hooks() WC Brands::register hooks WC 10.3.5
public function register_hooks() {
add_action( 'woocommerce_register_taxonomy', array( __CLASS__, 'init_taxonomy' ) );
add_action( 'widgets_init', array( $this, 'init_widgets' ) );
if ( ! wp_is_block_theme() ) {
add_filter( 'template_include', array( $this, 'template_loader' ) );
}
add_action( 'wp_enqueue_scripts', array( $this, 'styles' ) );
add_action( 'wp', array( $this, 'body_class' ) );
add_action( 'woocommerce_product_meta_end', array( $this, 'show_brand' ) );
add_filter( 'woocommerce_structured_data_product', array( $this, 'add_structured_data' ), 20 );
// duplicate product brands.
add_action( 'woocommerce_product_duplicate_before_save', array( $this, 'duplicate_store_temporary_brands' ), 10, 2 );
add_action( 'woocommerce_new_product', array( $this, 'duplicate_add_product_brand_terms' ) );
add_action( 'woocommerce_new_product', array( $this, 'invalidate_wc_layered_nav_counts_cache' ), 10, 0 );
add_action( 'woocommerce_update_product', array( $this, 'invalidate_wc_layered_nav_counts_cache' ), 10, 0 );
add_action( 'transition_post_status', array( $this, 'reset_layered_nav_counts_on_status_change' ), 10, 3 );
add_filter( 'post_type_link', array( $this, 'post_type_link' ), 11, 2 );
if ( 'yes' === get_option( 'wc_brands_show_description' ) ) {
add_action( 'woocommerce_archive_description', array( $this, 'brand_description' ) );
}
add_filter( 'woocommerce_product_query_tax_query', array( $this, 'update_product_query_tax_query' ), 10, 1 );
// REST API.
add_action( 'rest_api_init', array( $this, 'rest_api_register_routes' ) );
add_action( 'woocommerce_rest_insert_product', array( $this, 'rest_api_maybe_set_brands' ), 10, 2 );
add_filter( 'woocommerce_rest_prepare_product', array( $this, 'rest_api_prepare_brands_to_product' ), 10, 2 ); // WC 2.6.x.
add_filter( 'woocommerce_rest_prepare_product_object', array( $this, 'rest_api_prepare_brands_to_product' ), 10, 2 ); // WC 3.x.
add_action( 'woocommerce_rest_insert_product', array( $this, 'rest_api_add_brands_to_product' ), 10, 3 ); // WC 2.6.x.
add_action( 'woocommerce_rest_insert_product_object', array( $this, 'rest_api_add_brands_to_product' ), 10, 3 ); // WC 3.x.
add_filter( 'woocommerce_rest_product_object_query', array( $this, 'rest_api_filter_products_by_brand' ), 10, 2 );
add_filter( 'rest_product_collection_params', array( $this, 'rest_api_product_collection_params' ), 10, 2 );
// Layered nav widget compatibility.
add_filter( 'woocommerce_layered_nav_term_html', array( $this, 'woocommerce_brands_update_layered_nav_link' ), 10, 4 );
// Filter the list of taxonomies overridden for the original term count.
add_action( 'woocommerce_product_set_stock_status', array( $this, 'recount_after_stock_change' ) );
add_action( 'woocommerce_update_options_products_inventory', array( $this, 'recount_all_brands' ) );
// Product Editor compatibility.
add_action( 'woocommerce_layout_template_after_instantiation', array( $this, 'wc_brands_on_block_template_register' ), 10, 3 );
// Block theme integration.
add_filter( 'hooked_block_types', array( $this, 'hook_product_brand_block' ), 10, 4 );
add_filter( 'hooked_block_core/post-terms', array( $this, 'configure_product_brand_block' ), 10, 5 );
}