Skip to content

Instantly share code, notes, and snippets.

@Veesibility
Veesibility / woocommerce-category-title-category-page.php
Created June 17, 2015 10:47
Woocommerce - Display Product Category Title on Shop Page
/** This code should be added to functions.php of your theme **/
/* Woocommerce - Display Product Category Title on Shop Page */
add_action( 'woocommerce_before_shop_loop_item_title', 'vee_add_product_cat', 25);
function vee_add_product_cat()
{
global $product;
$product_cats = wp_get_post_terms($product->id, 'product_cat');
$count = count($product_cats);
foreach($product_cats as $key => $cat)
@Veesibility
Veesibility / woocommerce-product-count-view.php
Last active August 29, 2015 14:23
Woocommerce - Add Product Count View in Each Category
/** This code should be added to functions.php of your theme **/
/* Woocommerce - Add Product Count View in Each Category */
add_action( 'woocommerce_before_shop_loop', 'add_product_count_view', 20);
function add_product_count_view() {
$terms = get_the_terms( $post->ID, 'product_cat');
foreach( $terms as $term ) {
if(is_tax('product_cat', $term->name)) {
echo '<span class="count-view">'.$term->count
@Veesibility
Veesibility / woocommerce-tab-product.php
Created June 17, 2015 10:38
Woocommerce - Move Woocommerce Tab Product
/** This code should be added to functions.php of your theme **/
/* Move Woocommerce Tab */
add_action( 'after_setup_theme', 'move_woocommerce_tab' );
function move_woocommerce_tab() {
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 1 );
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
}
@Veesibility
Veesibility / woocommerce-attributes-terms.php
Last active August 29, 2015 14:23
Woocommerce - Display Attributes Terms on Shop Page
/** This code should be added to functions.php of your theme **/
/* Display Attributes Terms on Shop Page */
add_action( 'woocommerce_after_shop_loop_item_title', 'vee_add_attributes_terms', 1);
function vee_add_attributes_terms() {
$attributes_name = get_the_terms( $product->id, 'pa_attribute'); // Replace "pa_attribute" by your attribute
if ( $attributes_name && ! is_wp_error( $$attributes_name )):
foreach ( $attributes_name as $attributes_name )
{
@Veesibility
Veesibility / woocommerce-min-price.php
Last active August 29, 2015 14:13
Woocommerce - Show min price including Tax for variations rather than Min/Max Prices
/** This code should be added to functions.php of your theme **/
/* Woocommerce - Show min price including Tax for variations rather than Min/Max Prices */
add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2);
function custom_variation_price( $price, $product ) {
$price = '';
$price .= woocommerce_price($product->get_price_including_tax());