Skip to content

Commit

Permalink
Fix tax rate
Browse files Browse the repository at this point in the history
  • Loading branch information
tcharlss committed Nov 19, 2019
1 parent ab38eb2 commit e66cc9a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/jquery.editpricehelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,17 +406,19 @@
* @return {Number} float - Default = 0
*/
Plugin.prototype.getTaxRate = function () {
var taxRate;
var
taxRate,
taxRateOptions = Number.parseFloat(this.options.taxRate) || 0;

// Without input, we take the default tax
if (!this.hasTaxRateInput) {
taxRate = this.options.taxRate;
taxRate = taxRateOptions;
// Otherwise we take the input value
} else {
taxRate = Number.parseFloat(this.$inputs.taxRate.val()) || 0;
// If the input is empty, there can be a default taxe rate
if (!Number.isNumeric(taxRate) && this.options.taxRate) {
taxRate = this.options.taxRate;
if (!Number.isNumeric(this.$inputs.taxRate.val()) && this.options.taxRate) {
taxRate = taxRateOptions;
}
}
// taxRate = taxRate.toFixed(2);
Expand Down

0 comments on commit e66cc9a

Please sign in to comment.