WC_Product::has_dimensions PHP Method

has_dimensions() public method

Returns whether or not the product has dimensions set.
public has_dimensions ( ) : boolean
return boolean
    public function has_dimensions()
    {
        return ($this->get_length() || $this->get_height() || $this->get_width()) && !$this->get_virtual();
    }

Usage Example

/**
 * Outputs a list of product attributes for a product.
 * @since  2.7.0
 * @param  WC_Product $product
 */
function wc_display_product_attributes($product)
{
    wc_get_template('single-product/product-attributes.php', array('product' => $product, 'attributes' => array_filter($product->get_attributes(), 'wc_attributes_array_filter_visible'), 'display_dimensions' => apply_filters('wc_product_enable_dimensions_display', $product->has_weight() || $product->has_dimensions())));
}
All Usage Examples Of WC_Product::has_dimensions
WC_Product