is_type( 'bundle' ) ) { return $price; } if ( $price_type === 'regular_price' ) { if ( $with_tax ) { $price = $product->get_bundle_regular_price_including_tax(); } else { $price = $product->get_bundle_regular_price(); } } elseif ( $with_tax ) { $price = $product->get_bundle_price_including_tax(); } else { $price = $product->get_bundle_price(); } // Get WooCommerce Multi language Price by Currency. $price = $this->convert_currency( $price, $price_type, $product, $config ); if ( $price > 0 ) { return $price; } return ''; } /** * Get Regular Price. * * @param int $price product price. * @param \WC_Product $product product object. * @param \CTXFeed\V5\Utility\Config $config config object. * @param bool $with_tax price with tax or without tax. * @param string $price_type price type regular_price, price, sale_price. * @return float|int|string */ public function regular_price( $price, $product, $config, $with_tax, $price_type ) { return $this->bundle_price( $price, $product, $config, $with_tax, 'regular_price', $price_type ); } /** * Get Price. * * @param int $price product price. * @param \WC_Product $product product object. * @param \CTXFeed\V5\Utility\Config $config config object. * @param bool $with_tax price with tax or without tax. * @param string $price_type price type regular_price, price, sale_price. * @return float|int|string */ public function price( $price, $product, $config, $with_tax, $price_type ) { return $this->bundle_price( $price, $product, $config, $with_tax, $price_type ); } /** * Get Sale Price. * * @param int $price product price. * @param \WC_Product_Bundle $product product object. * @param \CTXFeed\V5\Utility\Config $config config object. * @param bool $with_tax price with tax or without tax. * @param string $price_type price type regular_price, price, sale_price. * @return float|int */ public function sale_price( $price, $product, $config, $with_tax, $price_type ) { return $this->bundle_price( $price, $product, $config, $with_tax, $price_type ); } /** * Convert currency if WooCommerce Multi language plugin is active. * * @param int $price product price. * @param string $price_type price type regular_price, price, sale_price. * @param \WC_Product_Bundle $product product object. * @param \CTXFeed\V5\Utility\Config $config config object. * @return float|int|string */ public function convert_currency( $price, $price_type, $product, $config ) { return apply_filters( 'woo_feed_wcml_price', $price, $product->get_id(), $config->get_feed_currency(), '_' . $price_type ); } /** * Should add tax or not. * * @param int $price product price. * @param \WC_Product_Bundle $product product object. * @param bool $with_tax price with tax or without tax. * @return float|int|string */ public function add_tax( $price, $product, $with_tax = false ) { if ( true === $with_tax ) { return ProductHelper::get_price_with_tax( $price, $product ); } return $price; } }