Answer the question
In order to leave comments, you need to log in
How to display text block on specific product pages in Woocommerce?
Hello! Tell the experts how to display a text block through a hook on certain product pages. I am writing such a function for the function.php file
add_action( 'woocommerce_before_add_to_cart_form', 'my_infa' );
function my_infa() {
if (is_product('stedt-dh-150')) {
echo '<div class="contex-cats">Акция!!! подарок</div>';
}
}
Answer the question
In order to leave comments, you need to log in
Hello.
Can be by ID:
add_action( 'woocommerce_before_add_to_cart_form', 'my_infa' );
function my_infa() {
if ( is_product() && get_the_ID() == 10 ) {
echo 'Акция!!! подарок';
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question