This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_after_single_product_summary', 'bbloomer_single_tag_slug' ); | |
function bbloomer_single_tag_slug() { | |
if ( has_term( 'blue', 'product_tag' ) ) { | |
echo 'Something'; | |
} elseif ( has_term( 'red', 'product_tag' ) ) { | |
echo 'Something else'; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_after_single_product_summary', 'bbloomer_single_on_sale' ); | |
function bbloomer_single_on_sale() { | |
if ( $product->is_on_sale() ) { | |
// do something | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_after_single_product_summary', 'bbloomer_single_product_type' ); | |
function bbloomer_single_product_type() { | |
if( $product->is_type( 'simple' ) ){ | |
// do something | |
} elseif( $product->is_type( 'variable' ) ){ | |
// do something | |
} elseif( $product->is_type( 'external' ) ){ | |
// do something |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_after_single_product_summary', 'bbloomer_single_virtual' ); | |
function bbloomer_single_virtual() { | |
if( $product->is_virtual() ){ | |
// do something | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_after_single_product_summary', 'bbloomer_single_downloadable' ); | |
function bbloomer_single_downloadable() { | |
if( $product->is_downloadable() ){ | |
// do something | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_variable_price_html', 'bbloomer_remove_variation_price', 10, 2 ); | |
function bbloomer_remove_variation_price( $price ) { | |
global $woocommerce_loop; | |
if ( is_product() && $woocommerce_loop['name'] == 'related' ) { | |
$price = ''; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_after_shop_loop_item', 'bbloomer_loop_per_product' ); | |
function bbloomer_loop_per_product() { | |
if ( has_term( 'chairs', 'product_cat' ) ) { | |
echo 'Great chairs!'; | |
} elseif ( has_term( 'tables', 'product_cat' ) ) { | |
echo 'Awesome tables!'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_before_main_content', 'bbloomer_loop_cat' ); | |
function bbloomer_loop_cat() { | |
if ( is_product_category() ) { | |
echo 'Это сообщение видно только на страницах категорий'; | |
} else { | |
echo 'Это сообщение видно на всех остальных страницах WooCommerce'; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_before_main_content', 'bbloomer_loop_shop' ); | |
function bbloomer_loop_shop() { | |
if ( is_shop() ) { | |
echo 'Это сообщение видно только на странице магазина'; | |
} else { | |
echo 'Это сообщение видно на всех остальных страницах WooCommerce'; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_before_main_content', 'bbloomer_loop_cat_slug' ); | |
function bbloomer_loop_cat_slug() { | |
if ( is_product_category( 'books' ) ) { | |
echo 'This will show on the Books Cat page'; | |
} elseif ( is_product_category( 'chairs' ) ) { | |
echo 'This will show on the Chairs Cat page'; | |
} | |