Files
roi-theme/wp-content/plugins/wp-marketing-automations/woofunnels/compatibilities/class-bwf-compatibility-with-woomulticurrency.php
root a22573bf0b Commit inicial - WordPress Análisis de Precios Unitarios
- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 21:04:30 -06:00

69 lines
1.5 KiB
PHP
Executable File

<?php
if ( ! class_exists( 'BWF_Compatibility_With_WooMultiCurrency' ) ) {
#[AllowDynamicProperties]
class BWF_Compatibility_With_WooMultiCurrency {
public function __construct() {
}
public function is_enable() {
if ( defined( 'WOOMULTI_CURRENCY_VERSION' ) ) {
return true;
}
return false;
}
/**
*
* @param $url
* @param WC_Order $order
*
* @return string
*/
public function maybe_add_currency_converter_url( $url, $order ) {
if ( ! $order instanceof WC_Order ) {
return $url;
}
return add_query_arg( array( 'wmc-currency' => strtoupper( $order->get_currency() ) ), $url );
}
/**
*
* Modifies the amount for the fixed discount given by the admin in the currency selected.
*
* @param integer|float $price
*
* @return float
*/
public function alter_fixed_amount( $price, $currency = null ) {
return wmc_get_price( $price, $currency );
}
function get_fixed_currency_price_reverse( $price, $from = null, $base = null ) {
$data = new WOOMULTI_CURRENCY_Data();
$from = ( is_null( $from ) ) ? $data->get_current_currency() : $from;
$base = ( is_null( $base ) ) ? get_option( 'woocommerce_currency' ) : $base;
$rates = $data->get_exchange( $from, $base );
if ( is_array( $rates ) && isset( $rates[ $base ] ) ) {
$price = $price * $rates[ $base ];
}
return $price;
}
}
BWF_Plugin_Compatibilities::register( new BWF_Compatibility_With_WooMultiCurrency(), 'woomulticurrency' );
}