0

we have to send order total to one of affiliate along with other bits like order ID etc. we have managed everything but the problem is we can not fetch the order total exclude VAT. we have used code "

?php echo number_format($order->getGrandTotal(),2);"

and

"php echo $grandTotal;"

and we have tried to remove Grand from above but it does not work.

the affiliate link is something like this

"img src='https://www.afiliatesite.com/xxxxx?ORDERID=input-order-Id!&ORDERAMNT=input-order-amount!"

can some one tell us how we can get the amount exclude VAT or php code to just reduce the total price by 20%. because we only deal inside uk and all orders include 20% VAT so if we can just reduce that, it would give us same result.

all help is appreciated.

Thank you

1 Answer 1

1

You can check if $order->getTaxAmount(); is the VAT amount of your orders, if so then you can subtract this amount from grand total like

$order->getGrandTotal()-$order->getTaxAmount()

if there will be some difference after subtracting then check for $order->getHiddenTaxAmount()

FYI, PHP code to subtract a percentage from a value :

$amount=20; //in your case

$newprice = round($price * ((100-$amount) / 100), 2);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.