Commit Graph

634 Commits

Author SHA1 Message Date
Claudio Sanches d133ee9d08 Fixed docblock 2021-02-26 20:54:40 -03:00
Claudio Sanches 3ed9e4b259
Merge pull request #28936 from Mindsize/wc-26857-add-action-remove-order-item
WC Issue: 26857 - Add action remove order item
2021-02-26 20:53:23 -03:00
Peter Fabian a9da927049
Merge pull request #27277 from filipecorrea/26686-invalid-refund
Fix invalid refund amount error when no decimals
2021-02-18 14:59:08 +01:00
mfs-mindsize 8d600826a4 updated docblock's since to 5.1.0 (from 4.9.03) 2021-02-01 13:43:50 -05:00
mfs-mindsize c1c2a8d4ad added docblock for new hook (per @claudiosanchesr) 2021-01-27 13:48:05 -05:00
mfs-mindsize 8c0b94619c removed - is declared but not used. 2020-12-18 13:05:31 -05:00
mfs-mindsize 6496e00428 method: remove_order_item(), added: do_action( 'woocommerce_ajax_order_items_removed', , , , ); 2020-12-18 13:04:05 -05:00
Philipp Bammes c84f4600e3
Simplify `reload_checkout` expression 2020-12-02 15:01:07 +01:00
roykho 9f12b34237
Fix unwanted html tags showing when searching products in select2 closes #27154 2020-11-25 13:15:56 -08:00
David Marín c3ba17ae71
Fixing spaces in empty lines 2020-11-03 13:53:19 +01:00
David Marín 9c1de7ca96
Optimizing memory usage
Removing the potential undesired retrieval of hundreds or thousands of unreadable WC_Product objects into memory just to filter them out immediately.
This change prevented some out-of-memory situations in our site.
2020-11-03 11:34:34 +01:00
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
Romario fefc6193be Replace 'DIRECTORY_SEPARATOR' with '/' 2020-08-26 17:02:07 -05:00
Romario 67a178f4f7 Replace 'DIRECTORY_SEPARATOR' with '/' 2020-08-26 15:50:34 -05:00
Romario 073c63c9c4 Replace dirname with __DIR__ and add DIRECTORY_SEPARATOR
Previously 'dirname(  __FILE__ )' was used to import files, however, the directory separator was missing.

This commit replaces 'dirname(  __FILE__ )' that was introduced in 5370d02484 with __DIR__  and added DIRECTORY_SEPARATOR
2020-08-21 15:16:26 -05:00
Romario 5370d02484 Change relative include paths to absolute include paths
Relative include paths in PHP can break whenever the server is running opcache.  As such, WordPress.com deploy system refuses to include WooCommerce because of that issue.

This commit changes the relative include paths to absolute include paths.

Relates to #27269
2020-08-20 15:32:04 -05:00
Filipe Correa a8bc07cf40 Add a translators comment 2020-08-17 10:11:39 -03:00
Filipe Correa 148387ecb9 Use Yoda condition checks 2020-08-17 09:56:01 -03:00
Filipe Correa 730e00565d Add parenthesis 2020-08-10 18:04:42 -03:00
Filipe Correa 193540d7e7 Code style fix 2020-08-10 17:22:14 -03:00
Filipe Correa 0b98407082 Fix invalid refund amount error when no decimals 2020-08-10 16:08:09 -03:00
Claudio Sanches d48f1d4e2e Fixed package tag usage 2020-08-05 13:36:24 -03:00
Peter Fabian 03230ecf01
Merge pull request #26642 from woocommerce/fix/26607
Limit stock changes for order items to status methods for consistency.
2020-07-24 13:23:53 +02:00
vedanshujain 1b3f1d75ba Limit stock changes for order items to status methods for consistency.
Methods `wc_maybe_increase_stock_levels` and `wc_maybe_reduce_stock_levels` already reduce/increase stock levels when statuses are changed, so no need to do this here.
2020-07-01 19:09:07 +05:30
Mário Valney 04ceaa52f9
Fix: remove HTML from error message. 2020-05-22 21:14:43 -03:00
Christopher Allford 1d1413b4ee Replaced direct access of many constants with the Constants library 2020-01-31 22:18:47 -08:00
Christopher Allford 6ad091a9b7 Changed all of the constant accesses into corresponding Automattic\Jetpack\Constants usages 2020-01-28 21:21:29 -08:00
Gerhard Potgieter 7d39222334
Merge pull request #25162 from woocommerce/fix/24018
Hid variable parent products from "Add Products" search on order page
2019-12-05 14:22:43 +02:00
Christopher Allford b67d094601 Added support for comma-delimited lists of types to exclude 2019-12-04 14:39:41 -08:00
Claudio Sanches 5fdb880831
Merge branch 'master' into feature/24956 2019-12-04 16:18:39 -03:00
Claudio Sanches 8033d5751e Changed wc_get_product_classname function name to wc_get_product_object 2019-12-04 16:15:16 -03:00
Christopher Allford d1e25c9118 Added support for excluding certain product types from AJAX product searches 2019-12-03 14:14:47 -08:00
Claudio Sanches cd4b2ac5b8
Merge pull request #25084 from woocommerce/fix/25004
Fixed manual sorting for products shortcode
2019-12-03 15:15:30 -03:00
Christopher Allford baeae0652c Added a check to prevent variable product parents from being added to orders. 2019-11-29 17:06:50 -08:00
Christopher Allford 928ec871fa Code style fixes 2019-11-29 17:06:33 -08:00
Peter Fabian 309c48ab0e Deprecated old cache function and replaced it with a new one. 2019-11-28 14:03:57 +01:00
Christopher Allford a0c4d54b4a Updated NonceVerification code sniff suppressions
The suppressions come in two flavors, a warning and an error. The suppressions have been updated to respect those states accordingly.
2019-11-21 09:19:56 -08:00
Christopher Allford b12574e9e4 Fixed code sniffs 2019-11-20 08:16:19 -08:00
Christopher Allford 358825f006 Added a transient clear when product ordering is changed 2019-11-20 06:50:32 -08:00
Claudio Sanches ba0773d12e Apply wc_get_product_classname() in the current code base 2019-11-13 15:30:09 -03:00
Timothy Jacobs b9bb4a7c6a
Use a separate first parameter for the WP_Error
This matches the pattern used elsewhere in WooCommerce and allows access to the original `WC_Product` object if an error is to be returned.
2019-10-02 15:01:09 -04:00
Pinal 7418ed123f Hook name changes
Updated the hook name as suggested.
2019-08-29 12:42:33 +05:30
Pinal e47f835f7a Add new hook for add-order-item
Added a new hook for validations in the add_order_item() called in
WC->Orders->Add/Edit Orders.

Allow plugins to perform validations/changes to the order before a
product is added the order.
2019-08-28 17:30:24 +05:30
Diego f95f73c548 Added arguments to filter `woocommerce_ajax_order_item` 2019-07-09 13:31:47 +01:00
Rodrigo Primo a26f38f3a1
Merge pull request #23133 from woocommerce/update/23111
If variations are missing prices, show notice
2019-07-04 10:08:41 -03:00
Gerhard Potgieter c3a25bb6bf
Merge pull request #23884 from woocommerce/fix/23875
Prevents taxes columns from being removed when the order is no longer editable
2019-07-04 09:25:49 +02:00
Yash Kapoor 84fd2bbca9
Update class-wc-ajax.php
Removed unused code.
2019-06-25 10:58:56 +05:30
Gerhard 9212ee5082 Add check before calling wc_delete_order_item for taxes to make sure order is editable. 2019-06-20 15:01:01 +02:00
rmalviya 5bf8adf2dd Send boolean as expected, not string
Originally checkout.js:336 expected string but changed to boolean
with 4ad370985. Send boolean for `reload` in json and fix #23888.
2019-06-08 20:12:44 +05:30