YITH WooCommerce Account Funds
if (class_exists('WOOCS')) {
global $WOOCS;
if ($WOOCS->is_multiple_allowed) {
$currrent = $WOOCS->current_currency;
if ($currrent != $WOOCS->default_currency) {
$currencies = $WOOCS->get_currencies();
$rate = $currencies[$currrent]['rate'];
$amount = $amount / $rate;
}
}
}
Dans le fichier \wp-content\plugins\yith-woocommerce-account-funds-premium\includes\class.yith-ywf-customer.php, ajouter le code suivant (deux fois comme sur l'image ci-dessous) :
if (class_exists('WOOCS')) {
global $WOOCS;
if ($WOOCS->current_currency != $WOOCS->default_currency) {
$currencies = $WOOCS->get_currencies();
$new_funds = $new_funds / $currencies[$WOOCS->current_currency]['rate'];
}
}
Dans le fichier \wp-content\plugins\yith-woocommerce-account-funds-premium\includes\class.wc-gateway-yith-funds.php, supprimer le code suivant :
Dans le fichier functions.php du thème WordPress actuel, ajouter le code suivant :
<?php
add_filter('yith_show_available_funds', function($fund_av) {
if (class_exists('WOOCS')) {
global $WOOCS;
if ($WOOCS->is_multiple_allowed) {
$fund_av = $WOOCS->woocs_exchange_value($fund_av);
}
}
return $fund_av;
});
add_filter('yith_show_used_funds', function($fund_av) {
if (class_exists('WOOCS')) {
global $WOOCS;
if ($WOOCS->is_multiple_allowed) {
$fund_av = $WOOCS->woocs_exchange_value($fund_av);
}
}
return $fund_av;
});
add_filter('yith_min_deposit', function($fund_av) {
if (class_exists('WOOCS')) {
global $WOOCS;
if ($WOOCS->is_multiple_allowed) {
$fund_av = floor($WOOCS->woocs_exchange_value($fund_av));
}
}
return $fund_av;
});
add_filter('yith_max_deposit', function($fund_av) {
if (class_exists('WOOCS') AND $fund_av) {
global $WOOCS;
if ($WOOCS->is_multiple_allowed) {
$fund_av = ceil($WOOCS->woocs_exchange_value($fund_av));
}
}
return $fund_av;
});