Answer the question
In order to leave comments, you need to log in
How do I swap blocks on a wordpress product page?
Greetings! I have a store on wordpress + woocommerce, which has 2 blocks: the block with a discount (own function in functions.php) is displayed on the product page using a hook in this way
add_action('woocommerce_single_product_summary', 'woocommerce_template_economy', 13);
class WC_flash_sale_Product {
public function __construct()
{
add_filter( 'woocommerce_grouped_price_html', array(&$this, 'on_price_htmla'), 10, 2 );
add_filter( 'woocommerce_variable_price_html', array(&$this, 'on_price_htmla'), 10, 2 );
add_filter( 'woocommerce_sale_price_html', array(&$this, 'on_price_htmla'), 10, 2 );
add_filter( 'woocommerce_price_html', array(&$this, 'on_price_htmla'), 10, 2 );
add_filter( 'woocommerce_empty_price_html', array(&$this, 'on_price_htmla'), 10, 2 );
add_filter( 'woocommerce_variation_price_html', array(&$this, 'on_price_htmla'), 10, 2 );
add_filter( 'woocommerce_variation_sale_price_html', array(&$this, 'on_price_htmla'), 10, 2 );
add_filter( 'woocommerce_variable_sale_price_html', array(&$this, 'on_price_htmla'), 10, 2 );
}
}
new WC_flash_sale_Product();
Answer the question
In order to leave comments, you need to log in
Nothing is clear.
woocommerce_single_product_summary - displays everything about the product, the following actions are hung on it,
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
//отключить функцию от экшена с текущим приоритетом
remove_action('action','function',priory)
// подключить с неообходимым
add_action('action','function',priory)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question