Skip to content

Commit

Permalink
Tax calculation condition updated on the checkout details page
Browse files Browse the repository at this point in the history
  • Loading branch information
shewa12 committed Oct 14, 2024
1 parent 50683b1 commit 530a1ac
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ecommerce/Tax.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ public static function get_setting( $key, $default = false ) {
* @return float
*/
public static function calculate_tax( $amount, $rate ) {
if ( 0 === $rate ) {
return $rate;
}

if ( self::is_tax_included_in_price() ) {
// Tax = (Tax Rate X Price) / (1 + Tax Rate).
$tax = $amount - ( $rate * $amount ) / ( 1 + $rate );
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ All of these Tutor LMS features allow the users to design a more powerful and di
Update: Implemented tax calculation on the checkout page.
Update: Added clear discount breakdown in order details.
Update: Displayed payment gateway names on frontend and backend order pages.
Update: Checkout page payment method list design updated.
Fix: Resolved issue preventing permanent order deletion.
Fix: Addressed course/bundle assignment issue when updating automatic coupons.
Fix: Fixed PHP fatal error related to course intro video source.
Expand Down
4 changes: 2 additions & 2 deletions templates/ecommerce/checkout-details.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
</div>

<?php
if ( Tax::is_tax_configured() && ! $is_tax_included_in_price ) :
if ( Tax::is_tax_configured() && $tax_rate > 0 && ! $is_tax_included_in_price ) :
?>
<div class="tutor-checkout-summary-item">
<div><?php esc_html_e( 'Tax', 'tutor' ); ?></div>
Expand All @@ -286,7 +286,7 @@
<div class="tutor-checkout-summary-item">
<div></div>
<?php
if ( Tax::is_tax_configured() && $is_tax_included_in_price ) :
if ( Tax::is_tax_configured() && $tax_rate > 0 && $is_tax_included_in_price ) :
?>
<div class="tutor-fs-7 tutor-color-muted">
<?php
Expand Down

0 comments on commit 530a1ac

Please sign in to comment.