selected_and_default_currency_match() ) { return $ratio; } // Skip conversion on discount to avoid doing it twice. if ( $this->utils->is_call_in_backtrace( [ 'WC_Points_Rewards_Discount->get_discount_data' ] ) ) { return $ratio; } $ratio = explode( ':', $ratio ); $points = (float) ( $ratio[0] ?? 0 ); $value = (float) ( $ratio[1] ?? 0 ); $rate = $this->selected_currency->get_rate(); $value = $value * $rate; return "$points:$value"; } /** * Whether the selected and default currency are the same. * * @return boolean */ private function selected_and_default_currency_match(): bool { if ( empty( $this->default_currency_code ) ) { $this->default_currency_code = $this->multi_currency->get_default_currency()->get_code(); } if ( empty( $this->selected_currency ) ) { $this->selected_currency = $this->multi_currency->get_selected_currency(); } return $this->default_currency_code === $this->selected_currency->get_code(); } }