Commit Graph

144 Commits

Author SHA1 Message Date
Claudio Sanches 74bb66dc6d
Merge pull request #27671 from mahmoudsaeed/master
Make WC_Tax::get_tax_rate_classes() public
2021-02-15 14:31:25 -03:00
Claudio Sanches 6701ce9c9d
Merge pull request #26983 from woocommerce/fix/25082
Use tax location from order while computing tax in discount.
2021-01-28 16:59:59 -03:00
Roy Ho acd78d43f6
Merge pull request #27451 from haydenw/fix-27339
Fix #27339
2020-12-01 13:28:54 -08:00
vedanshujain 24a69fd249 Add return param comment 2020-11-12 22:58:05 +05:30
vedanshujain 74de152535 Use tax location from order while computing tax in discount.
We were not passing tax location while computing discount in orders, hence it was defaulting to shop's base address resulting in incorrect tax calculation.

This commit refactors `get_rates` method into another method that allows getting rates from location directly.
2020-11-12 22:57:56 +05:30
Nestor Soriano 52eed70f04 Add a 'NumberUtil' class with a 'round' method.
There's a number of places in the WooCommerce codebase where the
built-in function 'round' is executed passing a non-numeric value
(not a number and not a string that can be parsed as a number),
for example round(''). In PHP 7 this yields a value of 0, but in
PHP 8 this throws an error.

This commit adds a 'NumberUtil' class with a static 'round' method,
this method checks if the passed value is numeric and if so it just
executes the built-in function, otherwise it returns 0. And all the
calls to 'round' in the codebase are replaced with 'NumberUtil::round'.
2020-10-01 11:08:51 +02:00
Nestor Soriano b1e81d02da Fix code style/sniffer errors in a few files. 2020-10-01 11:08:51 +02:00
mahmoudsaeed 3865c615b9
Make WC_Tax::get_tax_rate_classes() public 2020-09-14 23:43:30 +02:00
Ron Rennick cd579e3798
update phpcs rule 2020-08-28 13:56:25 -03:00
Hayden Whiteman a939cacf5c Fix #27339 2020-08-22 22:09:14 +12:00
Claudio Sanches d48f1d4e2e Fixed package tag usage 2020-08-05 13:36:24 -03:00
Dominic c38e059ce8 Pass $customer to woocommerce_match_rates hook.
This allows tax related plugins to get more data on the customer and
make better decisions on the correct tax rate to apply.

Fixes #25787
2020-05-01 13:49:55 -07:00
Rodrigo Primo 62d6b05b58 Fix Generic.Formatting.MultipleStatementAlignment violations
This commit fixes all violations of the Generic.Formatting.MultipleStatementAlignment sniff automatically using phpcbf.
2019-12-20 14:21:08 -03:00
Peter Fabian 309c48ab0e Deprecated old cache function and replaced it with a new one. 2019-11-28 14:03:57 +01:00
Gerhard 4fa1e7d431 Only remove 2019-07-29 11:53:15 +02:00
Gerhard 978f0ef88d Add backward compatible functionality to the new table if maybe_remove_tax_class_rates happens to get called. 2019-07-29 10:56:13 +02:00
Gerhard 0e316c238d Add back WC_Tax::maybe_remove_tax_class_rates removed in #23093 and deprecate it instead. 2019-07-22 14:11:11 +02:00
Ewout Fernhout 0b69a19401 coding standard 2019-07-11 17:21:56 +02:00
Ewout Fernhout 8b51f55856 remove unused variable 2019-07-11 16:11:14 +02:00
Ewout Fernhout 324ac63376 code readability 2019-07-11 15:56:36 +02:00
Ewout Fernhout 6fe857f718 Merge remote-tracking branch 'origin/master' into patch-8 2019-07-11 14:44:39 +02:00
Claudio Sanches 6c0ef10016 Do not save create taxes with empty names 2019-07-09 15:26:07 -03:00
Ewout Fernhout 1ea6d7d3f8
separate getter for rate percent & percent value 2019-04-10 17:27:48 +02:00
Mike Jolley db3b486442 Order by name and fix return value 2019-03-20 15:27:53 +00:00
Mike Jolley e900fa3b1e Helper functions to get/delete/create tax classes in new table 2019-03-20 14:21:23 +00:00
Mike Jolley d5ab20d1a5 get ID before running actions 2019-02-26 20:29:17 +00:00
Mike Jolley b8921f9fba
Merge pull request #22420 from woocommerce/refactor/tax-rounding-methods
Refactor tax rounding methods for consistency
2019-02-12 16:13:58 +00:00
Mike Jolley 8fc7e2be99 prefix tax cache key 2019-01-30 16:11:37 +00:00
Mike Jolley cb1c579262 Cache tax class slugs 2019-01-30 16:11:19 +00:00
Mike Jolley af3707d75a Always round to precision. Negate need to call get_tax_total to handle rounding. Instead it just sums. 2019-01-11 12:38:05 +00:00
Mike Jolley 11d14b30a4 PHPCS fixes 2019-01-11 12:28:52 +00:00
Peter Fabian 9bca5abb40 Cast tax rate to float so that it can be treated as number going forward.
In case no tax rate is specified for the default catch-all tax rate, the tax rate was an empty string which caused a PHP notice when it was later used in arithmetic operations.
2018-07-26 14:32:48 +02:00
Claudio Sanches 0660a50e07 Removed obvious boolean results 2018-03-21 19:57:10 -03:00
Hardip Parmar 632da6779e fixed spelling for calculate. 2018-02-24 16:53:27 +05:30
Mike Jolley f91b733a0f Make compound rates stack 2018-01-24 16:26:44 +00:00
Mike Jolley 7a94bf06df Reversion changes 2017-12-07 15:39:10 +00:00
Mike Jolley 664970539d Remove rounding/precision from the tax class and handle exclusively in cart totals. 2017-12-04 20:33:27 +00:00
JeroenSormani 14e5bcd51d Exclude virtual tax classes from calcluation for shipping taxes 2017-11-20 20:14:23 +01:00
Mike Jolley 0e7cb9940c Filter out invalid tax classes
Closes #17221
2017-10-16 22:05:48 -07:00
Mike Jolley 878e4816fb Use city and postcode count to determine sort order 2017-10-12 14:04:10 +01:00
corsonr e9cc8242ce Remove extra space in tax state code
Fixes #16821

Spaces shouldn’t allowed in tax state code, only 2 letters are required.
2017-09-14 15:50:25 -07:00
Mike Jolley e9c3ebebdc Merge branch 'master' into feature/discounts-class
# Conflicts:
#	includes/abstracts/abstract-wc-data.php
#	woocommerce.php
2017-08-08 15:49:59 +01:00
Mike Jolley 7a829036c2 Fix tests 2017-08-07 17:49:46 +01:00
Mike Jolley 6af275da6e Only return tax classes if product is taxable.
Fixes #16241
2017-08-03 08:44:02 +02:00
Mike Jolley 6054519605 Discount taxes 2017-07-27 13:48:58 +01:00
Jaydeep Rami 46d3638089 Fix missing return statement (#16148)
* Fix missing return statement

* Fix missing return statement

* Fix missing return statement

* Fix missing return statement

* Fix missing return statement

* Fix missing return statement
2017-07-20 18:01:14 +01:00
Jaydeep Rami 3522857d23 Fix typo in WooCommerce plugin (#16135)
* Fixed typo

* Fixed more typo

* Fixed more typo

* Fix tyop

* Fix more typo

* Fix more typo

* Fix typo

* Fix typo

* Fix typo

* Fix typo datatime object

* Fix short name of compat

* Fix typo: update short name

* Fix typo "deactive" to "deactivate" and short BW - Compat

* Fix typo "Backwards compat"

* Fix typo 'parameters'

* Fix more typo 'pararmeters'

* Fix typo 'compund'

* FIx typo order

* Fix typo

* Fix typo 'incorrecly'

* Fix typo 'genarate'

* Fix typo 'reletive'

* Fix typo 'Handly'

* Fix typo 'rotatated'

* Fix typo

* Fix typo 'additonal'

* Fix typos
2017-07-17 11:10:52 +01:00
Rasmus Bengtsson 185934fad9 Fix phpdoc to include params and correct types 2017-05-15 13:50:52 +02:00
Mike Jolley aacb01d1e7 Merge branch 'pr/13503'
# Conflicts:
#	assets/css/twenty-seventeen.css
#	assets/css/woocommerce-layout.css
#	assets/css/woocommerce-layout.scss
#	assets/css/woocommerce.css
2017-04-27 12:46:05 +01:00
Claudio Sanches 59c2849736 Changed version 2.7 to 3.0 2017-03-15 13:36:53 -03:00