[SOLVED] How to Show the COUPON CODE USED on the INVOICE?

  • Posts: 284
  • Thank you received: 6
6 years 7 months ago #278298

-- HikaShop version -- : 3.1.1

This code works perfectly for adding the COUPON CODE to the order emails:

<?php 
if(!empty($data->order_discount_code)){ ?>
<p>
	<span style="color:#1c8faf !important;font-weight:bold;">COUPON used :</span> {VAR:order.order_discount_code}
</p>
<?php
}
?>

But it does not work for adding the COUPON CODE to the INVOICE (order / invoice.php).

What code would work in this case?

Thank you.

Last edit: 6 years 7 months ago by MSTACE.

Please Log in or Create an account to join the conversation.

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
6 years 7 months ago #278328

Hi,

The tags system is only in the emails.
For view overrides you need to use PHP code instead.
So instead of:

<?php 
if(!empty($data->order_discount_code)){ ?>
<p>
	<span style="color:#1c8faf !important;font-weight:bold;">COUPON used :</span> {VAR:order.order_discount_code}
</p>
<?php
}
?>
You can use:
<?php 
if(!empty($this->element->order_discount_code)){ ?>
<p>
	<span style="color:#1c8faf !important;font-weight:bold;">COUPON used :</span> <?php echo $this->element->order_discount_code; ?>
</p>
<?php
}
?>

Please Log in or Create an account to join the conversation.

  • Posts: 284
  • Thank you received: 6
6 years 7 months ago #278393

That works great!
Thank you.

You might think about adding the Coupon Code Used on the email and invoice templates.
The retailers are asking to know which Coupon Code was used and the customers like to know that the Coupon Code was applied.

The following user(s) said Thank You: Philip

Please Log in or Create an account to join the conversation.

Time to create page: 0.060 seconds
Powered by Kunena Forum