E
E
Elio Don2021-05-03 01:15:58
WordPress
Elio Don, 2021-05-03 01:15:58

How to display prices minus the discount in the product card?

I want to display two more prices next to the price of the product Discounted prices:
Price: 500
Small wholesale: 400
Wholesale: 250

In order not to create complex mechanisms, the essence will be a fixed discount, for example, for wholesale it is 50%

How to write down the formula and display
500 in the product card - 50%= 250 the amount displayed in the product card

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav Chernenko, 2021-05-03
@elmurzaalchakov

You can simply calculate:

$price = $product->get_price();
$discount = '50'; //%
$itogo = $price - ($price * ($discount / 100));

echo $itogo;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question