WordPress.org

Ready to get started?Download WordPress

Forums

WP eCommerce
Wrong tax calculation logic (1 post)

  1. snky1987
    Member
    Posted 4 months ago #

    Hi I found logic in wpec_taxes_controller class which might be wrong.

    Logic is as follows:

    function wpec_taxes_calculate_tax( $price, $tax_percentage, $exclusive = true ) {
          $returnable = 0;
    
          if ( !empty( $tax_percentage ) ) {
          	if($exclusive)
    	    $returnable = $price * ($tax_percentage / 100);
    	else{
                 $returnable = ($price / (100 + $tax_percentage) ) * $tax_percentage;
    	}
    
          }// if
    
          return $returnable;
       } // wpec_taxes_calculate_tax

    And for default calculation (with $exclusive == true) it returns:

    for 199 price tax value 33.16 and it should be 39.8

    I commented out this calculation and just duplicate previous one (from above) and my question is:

    Is there any reason to use second calculation as it is not correct with general mathematics percentage calculation rule. Cuz maybe there is some reason that I don't see so far.

    Regards

    https://wordpress.org/plugins/wp-e-commerce/

Reply

You must log in to post.

About this Plugin

About this Topic