Created
July 26, 2013 06:38
-
-
Save agusmu/6086763 to your computer and use it in GitHub Desktop.
WooCommerce - Adding product categories (one category per line), excerpt, and SKU to shop page
This file contains hidden or 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
/* Adding category, excerpt, and SKU to shop page */ | |
add_action( 'woocommerce_after_shop_loop_item', 'prima_custom_shop_item', 5); | |
function prima_custom_shop_item() { | |
global $post, $product; | |
/* product categories */ | |
$size = sizeof( get_the_terms( $post->ID, 'product_cat' ) ); | |
echo $product->get_categories( '<br/>', '<p>', '</p>' ); | |
/* product excerpt */ | |
if ( $post->post_excerpt ) { | |
echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ); | |
} | |
/* product sku */ | |
echo '<p>SKU: '.$product->get_sku().'</p>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tutorial: http://www.primathemes.com/documentation/adding-category-excerpt-and-sku-to-shop-page/