Skip to content

Instantly share code, notes, and snippets.

@agusmu
Created July 24, 2013 08:42
Show Gist options
  • Save agusmu/6068952 to your computer and use it in GitHub Desktop.
Save agusmu/6068952 to your computer and use it in GitHub Desktop.
WooCommerce - Adding category, excerpt, and SKU to shop page
/* 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( ', ', '<p>' . _n( 'Category:', 'Categories:', $size, 'woocommerce' ) . ' ', '.</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>';
}
@agusmu
Copy link
Author

agusmu commented Sep 28, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment