/** * Used throughout the extension instead of 'wc_price'. * * @param double $price * @return string */ public function get_composited_item_price_string_price($price, $args = array()) { $return = ''; $num_decimals = wc_cp_price_num_decimals(); $currency = isset($args['currency']) ? $args['currency'] : ''; $currency_symbol = get_woocommerce_currency_symbol($currency); $decimal_sep = wc_cp_price_decimal_sep(); $thousands_sep = wc_cp_price_thousand_sep(); $price = apply_filters('raw_woocommerce_price', floatval($price)); $price = apply_filters('formatted_woocommerce_price', number_format($price, $num_decimals, $decimal_sep, $thousands_sep), $price, $num_decimals, $decimal_sep, $thousands_sep); if (apply_filters('woocommerce_price_trim_zeros', false) && $num_decimals > 0) { $price = wc_trim_zeros($price); } $return = sprintf(get_woocommerce_price_format(), $currency_symbol, $price); return $return; }
/** * Get bundled product price after discount, price filters excluded. * * @return mixed */ private function get_raw_price($product = false) { if (!$product) { $product = $this->product; } $price = $product->price; if ($price === '') { return $price; } if (!$this->per_product_pricing) { return (double) 0; } if (apply_filters('woocommerce_composited_product_discount_from_regular', true, $this->component_id, $this->composite->id)) { $regular_price = $product->regular_price; } else { $regular_price = $price; } $discount = $this->component_data['discount']; $price = empty($discount) ? $price : (empty($regular_price) ? $regular_price : round((double) $regular_price * (100 - $discount) / 100, wc_cp_price_num_decimals())); return $price; }
function wc_composite_price_num_decimals() { _deprecated_function('wc_composite_price_num_decimals()', '3.5.0', 'wc_cp_price_num_decimals()'); return wc_cp_price_num_decimals(); }