wc_product_enable_dimensions_display

The WooCommerce wc product enable dimensions display hook.

Description

apply_filters( 'wc_product_enable_dimensions_display', (unknown) $product_has_weight_product_has_dimensions ); 

Parameters (1)

0. $product_has_weight_product_has_dimensions (unknown)
The product has weight product has dimensions.

Usage

To run the hook, copy the example below.
  1. $product_has_weight_product_has_dimensions = apply_filters( 'wc_product_enable_dimensions_display', $product_has_weight_product_has_dimensions ); 
  2.  
  3. if ( !empty( $product_has_weight_product_has_dimensions ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the wc_product_enable_dimensions_display callback 
  2. function filter_wc_product_enable_dimensions_display( $product_has_weight_product_has_dimensions ) { 
  3. // make filter magic happen here... 
  4. return $product_has_weight_product_has_dimensions
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'wc_product_enable_dimensions_display', 'filter_wc_product_enable_dimensions_display', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'wc_product_enable_dimensions_display', 'filter_wc_product_enable_dimensions_display', 10, 1 ); 

Defined (3)

The filter is defined in the following location(s).

/includes/wc-template-functions.php  
  1. if ( $product && ( $product->has_attributes() || apply_filters( 'wc_product_enable_dimensions_display', $product->has_weight() || $product->has_dimensions() ) ) ) { 
  1. 'display_dimensions' => apply_filters( 'wc_product_enable_dimensions_display', $product->has_weight() || $product->has_dimensions() ), 
/includes/legacy/abstract-wc-legacy-product.php  
  1. return apply_filters( 'wc_product_enable_dimensions_display', true ) && ( $this->has_dimensions() || $this->has_weight() || $this->child_has_weight() || $this->child_has_dimensions() );