Hello i would like to change products price because of stock managment software they change something i think and how i have always 2 prices which when i am not on sale there are the same so i decide to try code php in function.php with this code
add_filter( ‘woocommerce_get_price_html’, ‘custom_price_html’, 100, 2 );
function custom_price_html( $price, $product ) {
$prices = $product->get_variation_prices();
$min_price = min($prices[‘price’]);
$max_price = max($prices[‘price’]);
if ($min_price == $max_price) {
// Ако цените са еднакви, показваме само едната цена
$price = wc_price($min_price);
} else {
// Ако цените са различни, показваме две цени, като по-високата е задраскана
$regular_price = wc_price($max_price);
$sale_price = wc_price($min_price);
$price = ‘‘ . $regular_price . ‘ ‘ . $sale_price;
}
return $price;
}
but something is not working or i am not doing it right can you check or give me advise what to do
hire you can see similar prices https://solo00.fun/product-category/chanti-i-raniczi/