Tips & Tricks: snippet to display tax_rate on products view // v4.x

  • Posts: 103
  • Thank you received: 5
6 years 1 month ago #303510

-- HikaShop version -- : 4.0.2

I do not found such a category or place to post it. i find a section with sample codes for the v4.x could be cool.
maybe someone have a use for it.

a snippet for the product view to show the TAX_RATE (listing_price.php):

// modification START
// var_dump($this->element->prices[0]->taxes);

if(!empty($this->element->product_id)) {
	$myProductTaxRate = reset($this->element->prices[0]->taxes)->tax_rate * 100;

	echo '<span class="enter-a-class-to-style-it">';
	echo 'incl. ' . $myProductTaxRate . '% TAX'; 
	echo '</span>';
}
// modification END


and to show the TAX_RATE on the checkout at total price per article (checkout/listing_price.php):
// modification START
if(empty($this->unit)) {
	$myTaxRate = reset($price->taxes)->tax_rate * 100;

	echo '<span class="enter-a-class-to-style-it">';	
	echo 'incl. ' . $myTaxRate . '% TAX';
	echo '</span>';	
}
// modification ENDE

Last edit: 6 years 1 month ago by n00bster.
The following user(s) said Thank You: nicolas

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

Time to create page: 0.051 seconds
Powered by Kunena Forum