/** * Returns true if a calculator is enabled for the given product * * @since 3.0 * @param WC_Product $product the product * @return boolean true if the measurements calculator is enabled and * should be displayed for the product, false otherwise */ public static function calculator_enabled($product) { // basic checks if (!$product || $product->is_virtual() || $product->is_type('grouped') || !WC_Price_Calculator_Product::get_product_meta($product, 'wc_price_calculator')) { return false; } // see whether a calculator is configured for this product $settings = new WC_Price_Calculator_Settings($product); return $settings->is_calculator_enabled(); }