Skip to content

Wrong calculation of net price from TTC #9

@texnixe

Description

@texnixe

Maybe I'm getting this all wrong, but there seems to be something wrong with the ht, tax etc. calculations:

Calculation of net price from ttc should be:

function cart_ht($ttc, $vat) {
	$ht = $ttc / (1 + $vat/100);
	return $ht;
}

Calculation of vat value to be added to a net price (this is probably what you need in your plugin if tax is set to true, but then the product prices should be net prices, because this value is added when I click the Paypal submit button; even though the text says "TVA incluse"):

function cart_vat($net, $vat) {
	$tax = $net * $vat/100;
	return $tax;
}

Calculate amount of tax included in a given TTC price:

function cart_vat_incl ($ttc, $vat) {
  $ht = $ttc / (1 + $vat/100);
  $tax_incl = $ttc - $ht;
  return $tax_incl;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions