Woocommerce: Remove One of Product Dimensions from Frontend

When using shipping settings and advanced shipping plugins with Woocommerce Shop, you will usually have to set your product dimensions on Woocommerce back-end product setting tabs. These dimensions will be displayed on Additional Information tab in many Woocommerce themes.

You may find many examples of code to remove whole set of dimensions from the tab, but it’s hard to find a code snippet to remove only one of product’s dimensions.

3 dimensions coming from admin shipping settings.

I was requested to remove Height from dimensions set.

I’ve found filters for such dimensions in Woocommerce Documentation. And created a filter for my needs, which removes the height from this set. We put it in child-theme functions.php

// remove product height dimension
function iggy_remove_product_height( $enabled ) {
if ( ! is_admin() ) {
return false;
}
return $enabled;
}
add_filter( 'woocommerce_product_height', 'iggy_remove_product_height' );

Only 2 width and length are displayed.

Now no height is showing on the theme’s front-end of my shop. You may use it with length and width too.

Update (Oct. 2017): for Woocommerce 3 code check this post. These snippets no longer working.

Share:
This entry was posted in WordPress and tagged . Bookmark the permalink.

2 Responses to Woocommerce: Remove One of Product Dimensions from Frontend

  1. Ghalib says:

    not working for me

Leave a Reply

Your email address will not be published. Required fields are marked *