Need some help with tweaking a code for woocommerce [closed]

try this $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); // current term $parent_slug = ”; // default slug param if( $term->parent ){ // if current term has parent then get it’s slug $parent = get_term( $term->parent, get_query_var(‘taxonomy’) ); // term’s parent $parent_slug = $parent->slug; // slug of parent term } // … Read more

Thumb doubles the image file size

What you need to do is to compress the image. WordPress offers a filter to set the compression ratio. function my_jpg_compression($args) { return 75; } add_filter(‘jpeg_quality’, ‘my_jpg_compression’); NOTE: What you are returning is the compression ratio. 70-80% is manageable and you will not notice much reduced image quality. Also, after applying this filter only future … Read more

Category menu that filters out empty categories

I had an error in the above code. $key used in both for loops. Working code for filtering empty product categories out of menu items: function exclude_empty_cat_menu_items( $items, $menu, $args ) { // Get a list of product categories that excludes empty categories $non_empty_categories = get_categories(array(‘taxonomy’ => ‘product_cat’)); // Iterate over the menu items foreach … Read more

Hide cart when empty [closed]

Just add another AND (&&) clause to the end of it. <?php if ( is_woocommerce_activated() && isset( $woo_options[‘woocommerce_header_cart_link’] ) && ‘true’ == $woo_options[‘woocommerce_header_cart_link’] && sizeof( $woocommerce->cart->cart_contents ) !== 0) {…} Probably best to take a look at some of the PHP tutorials or documentation around as you will be coming up against this type of … Read more