Need a heads on on how to add VAT tpo a products price in a bit of code
Posted: Tue Sep 12, 2023 12:11 pm
I need a bit of help with a small modification of a small bit of code in a admin - categories - hook file
The current code shows the product price, but less VAT at 20%. I want to show the price under the current price with the VAT added. So one row with net price the other gross price.
The current code I have is
I take it I can just add another few lines of code with the new text in but what sum do I use to show the price with the VAT includes assuming that I need to start from products_price. Is there anything else that I will need to add.
Hopefully some understand what I am trying to do, and can give a bit of advice.
The current code shows the product price, but less VAT at 20%. I want to show the price under the current price with the VAT added. So one row with net price the other gross price.
The current code I have is
Code: Select all
function listen_infoBox($parameters) {
global $product; $this->load_lang();
if ($product && ($product Instanceof Product)) {
if (!is_null($product->get('cost') ?? null)) {
$parameters['contents'][] = ['text' => COST_INPUT_TEXT . ' ' . $product->get('cost')];
}
if (!is_null($product->get('price') ?? null)) {
$parameters['contents'][] = ['text' => NET_PRICE_INPUT_TEXT . ' ' . $product->get('price')];
}
}
}Hopefully some understand what I am trying to do, and can give a bit of advice.