Created
October 27, 2016 03:16
-
-
Save lukecav/26f6e6396c4a9c40d9e9b585dbd3b507 to your computer and use it in GitHub Desktop.
WooCommerce Product Title with SKU
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
/* CREATE the new function, with SKU added */ | |
function woocommerce_template_loop_product_title_with_sku() { | |
global $product; | |
echo '<span class="loop-title-sku">' . $product->get_sku() . '</span>'; | |
echo '<h3 class="loop-title">' . get_the_title() . '</h3>'; | |
} | |
/*REMOVE old loop-title action */ | |
remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 ); | |
/* ADD new loop-title-with sku action */ | |
add_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title_with_sku', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This looks correct, but when adding this my functions.php it had no effect. dangelointernational.com