Answer the question
In order to leave comments, you need to log in
How to fix the price filter so that it takes values not from the admin panel but from the frontend?
In the admin panel, I indicate the cost of goods in currency, I have a code in the theme that recalculates in rubles and displays the cost in rubles for the user
// Конвертация стоимости
add_filter('woocommerce_get_regular_price', 'customPrice'); // Изменяем обычную цену
add_filter('woocommerce_get_sale_price', 'customPrice'); // Изменяем цену со скидкой
add_filter('woocommerce_get_price', 'customPrice'); // Изменяем цену
add_filter('woocommerce_variation_prices_sale_price', 'customPrice'); // Изменяем цену со скидкой у вариативных товаров
add_filter('woocommerce_variation_prices_regular_price', 'customPrice'); // Изменяем обычную цену у вариативных товаров
add_filter('woocommerce_variation_prices_price', 'customPrice'); // Изменяем цену у вариативного товара
function customPrice($price)
{
$rate = 22; // Курс валюты
$price = $price * $rate;
return $price;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question