G
G
greenorangeblue2022-03-15 18:13:53
Online shopping
greenorangeblue, 2022-03-15 18:13:53

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;
}


But the price filter in the catalog takes the price values ​​from the admin panel
How to make it take the values ​​from the frontend?

And so that it does not show the discount price with the original price crossed out, if in fact there is no discount for the product

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question