config->getConfigData($this->key, 0); if($value){ add_filter('advanced_woo_discount_rules_additional_fee_amount', array($this, 'convertPrice')); add_filter('advanced_woo_discount_rules_converted_currency_value', array($this, 'convertPrice')); } } /** * To convert price * */ public function convertPrice($value) { if(is_numeric($value) && !empty($value)) { if(class_exists('\WOOMC\Currency\Detector') && class_exists('\WOOMC\Rate\Storage')){ if(class_exists('\WOOMC\Price\Rounder') && class_exists('\WOOMC\Price\Calculator')){ if(class_exists('\WOOMC\Price\Controller')){ $currency_detector = new \WOOMC\Currency\Detector(); $currency_detector->setup_hooks(); $rate_storage = new \WOOMC\Rate\Storage(); $rate_storage->setup_hooks(); $price_rounder = new \WOOMC\Price\Rounder(); $price_calculator = new \WOOMC\Price\Calculator($rate_storage, $price_rounder); $price_controller = new \WOOMC\Price\Controller($price_calculator, $currency_detector); $value = $price_controller->convert($value); } } } } return $value; } /** * load fields * */ public function loadFields(&$available){ $value = $this->config->getConfigData($this->key, 0); if ( is_plugin_active( 'woocommerce-multicurrency/woocommerce-multicurrency.php' ) || ($value == 1)) { $available = true; ?>