Commit Graph

257 Commits

Author SHA1 Message Date
Mike Jolley 4fc03c9930 Revert "[Product CRUD] Abstract todos (#12305)"
This reverts commit 9a6136fcf8.
2016-11-11 11:58:57 +00:00
Mike Jolley 9a6136fcf8 [Product CRUD] Abstract todos (#12305)
* Get dimensions and weights, with soft deprecation

* Product attributes

* Ratings

* Fix read method

* Downloads

* Feedback
2016-11-11 11:43:52 +00:00
Mike Jolley 5f4dbdb733 [Product CRUD] Variations - setters, getters and admin. (#12228)
* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* Feedback fixes
2016-11-09 16:05:49 +00:00
Claudio Sanches 2de494e105 Merge pull request #12219 from ramiy/i18n-translation-comments
i18n: add translators comments
2016-11-03 13:24:35 -02:00
Mike Jolley 32e814eef1 Use all paid statuses in $customer->get_total_spent() 2016-11-03 11:27:03 +00:00
Rami Yushuvaev 55f08d62ae add translators comments 2016-10-29 23:03:28 +03:00
Mike Jolley 85f22f9f11 Update coupon on pending order
Closes #12096
2016-10-18 12:27:56 +01:00
Claudio Sanches 657c312cae Fix strings case (#12069)
* Fixed case for all _e, esc_attr_e and esc_html_e strings

* Fixed case for all _n_noop strings

* Fixed case for all _x strings

* Fixed case for all __, esc_html__ and esc_attr__ strings

* Fixed a few more strings

* Fixed strings in unit tests

* Fix PayPal Standard case.

* Save Order text
2016-10-12 11:16:30 +01:00
Claudio Sanches 7172429244 Fixed coding standards 2016-09-14 16:00:14 -03:00
Claudio Sanches 0fced8d5d5 Fixed wrong "quantity" while reducing stock
cc @mikejolley
2016-09-14 15:35:17 -03:00
Mike Jolley 311c540662 Merge pull request #11833 from aristath/master
Coding Standards (2nd pass)
2016-09-07 10:14:17 +01:00
Mike Jolley 3f9ab31461 Fix CRUD refunds 2016-09-07 10:04:56 +01:00
Aristeides Stathopoulos fde1037757 fix failing tests. 2016-09-01 23:50:14 +03:00
Aristeides Stathopoulos 82f3cc221e WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeOpenParenthesis 2016-08-27 07:23:02 +03:00
Aristeides Stathopoulos 6c30f84fa2 WordPress.Arrays.ArrayKeySpacingRestrictions.SpacesAroundArrayKeys 2016-08-27 06:23:21 +03:00
Aristeides Stathopoulos 17961f6484 WordPress.Arrays.ArrayDeclaration.ValueNoNewline 2016-08-27 06:04:10 +03:00
Aristeides Stathopoulos ec8a0b288b PHPCS: WordPress.Arrays.ArrayDeclaration.NoCommaAfterLast 2016-08-27 05:08:49 +03:00
Aristeides Stathopoulos b063bcfe4c last item in a multiline-array should end in a comma 2016-08-27 04:46:45 +03:00
Mike Jolley 938361535f Exception handling 2016-08-24 16:02:19 +01:00
Mike Jolley cde78abed3 Working on catching errors 2016-08-24 15:26:35 +01:00
Mike Jolley 95b11606fc get_product_from_item -> get_product 2016-08-22 16:51:24 +01:00
Mike Jolley fdd7e797ba API get refunds 2016-08-22 13:15:15 +01:00
Mike Jolley 9e45927803 Create refund with crud 2016-08-22 13:15:15 +01:00
Mike Jolley f4a4f6c361 Reduce stock and other notices 2016-08-09 14:15:04 +01:00
Mike Jolley 7685587b22 payment_method 2016-08-05 16:04:41 +01:00
Mike Jolley 84c52370fa more getters 2016-08-05 15:57:40 +01:00
Mike Jolley 39b4831e95 get_id 2016-08-05 15:56:23 +01:00
Mike Jolley 837e08143b Merge branch 'master' into orders-crud-classes
# Conflicts:
#	includes/abstracts/abstract-wc-order.php
2016-08-03 12:32:27 +01:00
Rodrigo Primo 3c485fc2a1 Use WC_Cache_Helper::get_cache_prefix() to generate the cache key for wc_orders_count() 2016-06-29 16:19:47 -03:00
Rodrigo Primo 1a394fbe02 Improve wc_orders_count() performance by running a query to count only posts of the given status
The function wc_orders_count() is called on every admin page. WooCommerce core uses it to count only orders with the status 'processing' and typically a site has only a few of those orders. But since wc_orders_count() calls internally wp_post_count() this means that MySQL will have to count the number of orders of all status. Thus, in a site with a significant number of orders, this query can be slow.

This commit changes wc_orders_count() function to query directly the database to get the number of orders for a given status instead of using wp_post_count(). On a WooCommerce installation I manage, the old query takes about 2 seconds to run and the new query takes 0.002 seconds.
2016-06-29 15:04:59 -03:00
Mike Jolley b11794ceac @Since changes 2016-06-29 12:58:38 +01:00
Mike Jolley eb2a840db0 Use string in search
Closes #11222
2016-06-23 12:32:20 +01:00
Mike Jolley 46439ddba5 Refund unit tests 2016-06-22 16:31:05 +01:00
Mike Jolley 7b3a9b27ed Function replacements for class methods 2016-06-21 20:26:35 +01:00
Claudio Sanches c9a3ce465f Fixe the return type of wc_order_search() 2016-06-13 15:26:14 -03:00
Claudio Sanches e253382702 Created wc_order_search() function
cc @mikejolley
2016-06-13 17:08:20 +01:00
Mike Jolley 3fd15ad50f Unused vars and code docs 2016-06-06 18:57:24 +01:00
Mike Jolley 2cc0ac294e Fix return on add_metadata
Fixes #10892
2016-05-11 15:28:40 +01:00
Mike Jolley 3db3f3796e Clear item meta cache when adding new meta 2016-05-09 10:01:15 +01:00
Mike Jolley 6a4a6d8471 Fix refund shipping 2016-04-29 11:44:28 +01:00
Mike Jolley a588757d33 Feedback 2016-03-14 16:08:42 +00:00
Mike Jolley c1e8dd1fe8 Use wc_get_orders iternally 2016-03-09 16:11:05 +00:00
Mike Jolley d3f98dce03 More advanced customer filter
#10500
2016-03-09 14:50:34 +00:00
Mike Jolley 5075d4bab3 Implement wc_get_orders() function
#10500
2016-03-09 13:25:42 +00:00
Mike Jolley 6880a71ea9 Merge pull request #10141 from woothemes/fix-10135
Fix 10135
2016-02-12 13:37:53 +00:00
Mike Jolley 0c30999a67 When orders update, invalidate money spent user meta.
Closes #9562
2016-02-08 12:26:46 +00:00
Mike Jolley 77e1aa8263 Make qty for refunds negative
Fixes order counts reported in #10135

May however require an upgrade routine and needs more testing. Not for
2.5.

Fixes #10135
2016-01-22 16:28:29 +00:00
Mike Jolley 9890c18b5d Notice if called early.
Closes #9923
2016-01-04 10:43:51 +00:00
Mike Jolley 851fc2a442 Use get_cache_prefix in orders class 2015-11-13 23:11:05 +00:00
Scrutinizer Auto-Fixer 08efaf84df Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
2015-11-05 16:05:03 +00:00
Mike Jolley 4e5baf23aa Cache get_item_meta_array for better performance
Closes #8810 @claudiosmweb
2015-11-05 15:21:28 +00:00
Claudio Sanches 5893875b0c Removed period for file headers 2015-11-03 11:53:50 -02:00
Claudio Sanches ee30b5b308 Fixed php docs standards 2015-11-03 11:31:20 -02:00
Mike Jolley abaa8f47d8 Moved refund hooks to avoid emails after API refund failure 2015-10-06 14:43:36 +01:00
Mike Jolley 630c14124c Avoid firing woocommerce_order_fully_refunded twice 2015-08-13 16:35:52 +01:00
Mike Jolley f8b539eb5e Improved refund email events and woocommerce_order_fully_refunded hook.
Closes #8793
2015-08-12 19:01:05 +01:00
Mike Jolley 7a58c5417c Only process downloads if valid order is found
Closes #8798
2015-08-12 17:21:07 +01:00
Claudio Sanches 0361a10e26 Removed instances of WC_Order in favor to wc_get_order(), closes #8689 2015-07-30 15:07:34 -03:00
Mike Jolley 7b2aec4791 Take item qty into consideration when refunding orders
Fixes #8675
2015-07-29 13:13:41 +01:00
Claudio Sanches 9e41552342 Removed all "@return void" 2015-07-16 16:55:48 -03:00
adnanoner d07e567050 add $args to woocommerce_refund_created action hook
#8432
2015-06-22 17:54:45 +02:00
davidlenehan 718d550252 Merging refund email template files
Changing previous commit to merge templates for partial and full
refunds to cut down on files.
2015-06-18 11:34:21 +01:00
davidlenehan 8b02b02145 Add email notification for partial refunds
fixes #8278

Emails are now sent to the customer when a partial refund is issued. I
referenced #7785 when doing this.

When a full refund happens the email the customer receives is clear
enough that they are getting a full refund. However I thought it would
be useful to add a new line in these new partial refund emails that
states exactly the value of the partial refund as it may not be that
clear.
2015-06-17 15:35:54 +01:00
Justin Shreve b68244f3eb Prevent negative refunds in wc_create_refund by 0ing it out. 2015-06-15 20:20:31 +00:00
Diego Zanella c0051da5c5 Added logic to copy the refund currency from parent order 2015-06-04 08:55:24 +01:00
Mike Jolley 5cac639cff Merge branch 'improve-refund-reporting' Closes #8028
Conflicts:
	includes/admin/reports/class-wc-report-sales-by-date.php
	includes/updates/woocommerce-update-2.4.php
2015-05-28 14:41:20 +01:00
Mike Jolley 126eb578aa Upgrade routine 2015-05-15 16:27:11 +01:00
matttallan 93d76e33f0 New order post type param: exclude_from_order_webhook
Allows others that are using custom order types to choose whether
webhooks for WC Orders should also be triggered.
More of a CPT approach than adding more hooks and filters :)
2015-05-12 14:01:23 +10:00
Mike Jolley 6c8cc42876 Revise reports #8028 2015-04-24 15:58:13 +01:00
Mike Jolley c19f2e573e [2.3] Only automatically cancel orders created via checkout + allow post_parent to be set 2015-04-01 14:21:10 +01:00
Mike Jolley f55e7d6969 wc_customer_bought_product transient
Closes #7322
2015-03-27 13:17:54 +00:00
Nicola Mustone 95f581452f removed useless functions 2015-03-04 11:35:25 +01:00
Nicola Mustone ed67650c36 added order count functions 2015-03-04 09:51:06 +01:00
Mike Jolley 8126b7ef58 When purchasing multiple downloadable products (same item), multiply download limit by qty purchased.
Closes #7451
2015-02-17 14:03:44 +00:00
Barry Kooij 6cd77ea3b1 Typo fix 2015-02-11 15:14:42 +01:00
Mike Jolley 27a7a58e8c Can return wp_error 2015-02-03 15:08:36 +00:00
Mike Jolley e3c1ebc927 Simplify mark_order_status() 2014-11-27 15:37:42 +00:00
Mike Jolley ab562615ce [2.2] Remove strtolower and capitalize status names
Fixes #6624
2014-10-29 11:15:00 +00:00
Mike Jolley daf14fc57e Use current user ID for refunds. Closes #6598 2014-10-23 11:36:15 +01:00
claudiosmweb 42820ea88d introduced the wc_strtolower() function, closes #6575 2014-10-21 10:51:16 -02:00
Mike Jolley 05d5849a67 Check mb_strtolower exists. 2014-10-16 15:53:12 +01:00
Mike Jolley ea1d61b88e Use mb_strtolower to prevent issues with unicode chars
Fixes #6525
2014-10-14 11:58:28 +01:00
claudiosmweb bc1ea4fdea woocommerce_ prefix in refund actions, related #6477 2014-10-09 13:15:42 -03:00
75nineteen Media f57de2cf9a Added two hooks to support refund Followup Emails 2014-10-07 15:58:21 -07:00
Mike Jolley 8c3d142002 define $transients_to_clear 2014-10-07 11:09:35 +01:00
Mike Jolley 700369c386 Refund report changes
1. Ensure refund order_total is negative and reflects the full amount,
not just line items
2. Ensure transients are cleared when doing refunds
3. sales-reports order types so we can exclude refunds from pure
‘sales’ reporting
4. Tweak placement of refunds in legend.

Closes #6411
2014-10-06 13:39:53 +01:00
shivapoudel 58595f0f2b Absolute path fix for wc-order-functions.php 2014-09-21 00:55:04 +05:45
Mike Jolley a3b522aff8 Prepare update queries. 2014-09-16 10:45:28 +01:00
claudiosmweb 066eb3c5b0 fixed wc_get_order_status_name() appear as wc 2.1 order status 2014-09-12 10:01:49 -03:00
claudiosmweb 2f1533ff94 created the wc_get_order_status_label() function 2014-09-09 14:14:10 -03:00
Mike Jolley c4ef86d44e scrutinizer patches 2014-09-08 00:37:55 +01:00
thenbrent 56c7d5fe96 Don't create redundant $payment_method var 2014-08-25 12:11:39 -07:00
Barry Kooij 9d5ce49805 Passed $args to dynamic class that inherits WC_Abstract_Order is never used.
Therefor the $args in the function and method in factory class seems unnecessary.
2014-08-15 14:56:43 +02:00
Barry Kooij 6655188f0b Changed use of get_order with wc_get_order 2014-08-15 14:29:21 +02:00
Barry Kooij e97d06a0f0 Renamed function get_order to wc_get_order 2014-08-15 14:26:26 +02:00
claudiosmweb 532d06b560 fixed the wc_cancel_unpaid_orders() post_type query 2014-08-12 12:14:38 -03:00
Barry Kooij a9e3c3bbe4 Use correct variable and correct property when counting processing orders. 2014-07-30 10:39:37 +02:00
Mike Jolley c465c7235d Merge branch 'credit-notes'
Conflicts:
	includes/abstracts/abstract-wc-order.php
	includes/class-wc-order-factory.php
	includes/class-wc-post-types.php
	includes/wc-formatting-functions.php
	includes/wc-order-functions.php
2014-07-29 12:09:52 +01:00
claudiosmweb 7c141fcd41 prevented some errors when the order has no taxes 2014-07-28 10:59:55 -03:00
Max Rice b192bd46f8 Add wc_update_order_item() function 2014-07-27 23:21:16 -04:00
Mike Jolley 5e663a7fa8 Show refunded line items inline 2014-07-25 16:48:19 +01:00
Mike Jolley 19b6922044 Refund line items and taxes 2014-07-24 15:34:14 +01:00
claudiosmweb a3d0d5903e removed a test 2014-07-23 19:28:57 -03:00
claudiosmweb 23628ad430 fixed undefined offset in wc_create_refund() 2014-07-23 13:56:43 -03:00
Mike Jolley 11835826de A start on negative line items
@claudiosmweb
2014-07-23 17:41:35 +01:00
claudiosmweb 954a5ddc23 only show refund via button when gateway supports refunds #3164 2014-07-22 12:13:35 -03:00
Mike Jolley 93155c9e11 Do not use before init.
#3164
2014-07-22 14:30:42 +01:00
claudiosmweb 93cf3c88bd initial implementation of order items taxes 2014-07-19 01:08:02 -03:00
claudiosmweb c1b8878587 removed order_type taxonomy from wc_create_refund() 2014-07-11 15:39:20 -03:00
Mike Jolley 755001f19b Use order types where required 2014-07-11 12:43:42 +01:00
Mike Jolley 2545e55b73 wc_get_order_types and wc_register_order_type
Uses CPT rather than terms. #3164
2014-07-11 10:42:49 +01:00
Mike Jolley 280b884c28 Create refunds and process via gateway 2014-07-10 14:49:04 +01:00
claudiosmweb 87d8cd1c95 set order_type for refunds 2014-07-08 16:41:07 -03:00
claudiosmweb 7e36d05c75 created order_type taxonomy 2014-07-08 14:23:11 -03:00
Claudio Sanches 9701cfe2a7 Revert "order_type taxonomy and register_order_type() function" 2014-07-08 14:10:37 -03:00
claudiosmweb 840def82e7 fixed tax default value 2014-07-08 11:44:12 -03:00
claudiosmweb 1ba7788991 fixed refund tax 2014-07-08 11:34:09 -03:00
claudiosmweb 09cb28a7bb created initial refund class and function 2014-07-08 11:32:47 -03:00
claudiosmweb 72aae0e69d created order_type taxonomy and register_order_type() function 2014-07-07 16:19:51 -03:00
Coen Jacobs 86a4add087 Merge remote-tracking branch 'upstream/master' into order-factory-refactor
Conflicts:
	includes/class-wc-order.php
2014-07-03 13:38:55 +02:00
claudiosmweb 7fd6e9f0a0 moved the wc_ship_to_billing_address_only() function to wc-order-functions.php 2014-06-17 17:39:02 -03:00
Coen Jacobs 89ea6c46ab Replace new WC_Order calls with get_order 2014-06-13 15:24:51 +02:00
Coen Jacobs 4ca9855bec get_order wrapper function for new factory 2014-06-13 15:21:10 +02:00
Coen Jacobs 3ad8935b20 Removed ununsed global variables in local scopes 2014-06-08 22:33:11 +02:00
Mike Jolley f30e95663b Prefixes for queries 2014-06-03 11:29:01 +01:00
Mike Jolley 9307fcf66b Internal wc- prefix and get_status filter 2014-06-03 11:04:56 +01:00
Mike Jolley 309f700283 has_status 2014-06-03 10:45:33 +01:00
Mike Jolley 51201d0a6b Update script 2014-05-30 18:27:41 +01:00
Mike Jolley e0a74fffc4 implement is_status() 2014-05-30 17:43:21 +01:00
Mike Jolley fca32a98de Implement is_status functions and update_status 2014-05-30 17:16:22 +01:00
Mike Jolley 83b4845250 Optimise order functions for post statuses 2014-05-30 16:09:28 +01:00
Mike Jolley 55f087b20e wc_get_order_statuses function 2014-05-30 16:03:11 +01:00
Max Rice f5d3d1d74f Clear cached API reports when deleting shop order transients 2014-04-22 15:01:08 -04:00
Mike Jolley 97c92bc7c8 Prevent notices on activation Closes #5216 2014-04-07 15:57:52 +01:00
Mike Jolley 8615d06a33 Refactored report transients to use fixed names based on the report classname. Allows use of delete_transient and Fixes #5041 2014-03-20 11:10:25 +00:00
Mike Jolley 9d1cb8316f Correct property #5041 2014-03-18 11:18:35 +00:00
Mike Jolley 251b8b411f Clear object cache for orders + products #5041 2014-03-18 11:09:56 +00:00
Mike Jolley c27a5a3f4d Merge pull request #5082 from crazyscience/patch-2
Fix for Issue #3367
2014-03-12 14:37:40 +00:00
Coen Jacobs 3617316357 Updated expiry times for transients 2014-03-12 12:58:41 +01:00
crazyscience 9898aee867 Fix for Issue #3367
Fixed a bug where the application attempts to schedule an event using a function name rather than a hook name
2014-03-07 11:17:11 -08:00
Coen Jacobs 03163c54b0 set_transient calls should have expiration to prevent autoloading 2014-03-07 09:29:01 +01:00
Mike Jolley 41183d1663 wc_delete_shop_order_transients functions and trigger when order status updates. Closes #4875 2014-02-26 15:43:19 +00:00
Mike Jolley 1e1490894e Code standards 2014-02-17 10:50:36 +00:00
Mike Jolley b22abbda90 Order status check needs to be inside wc_downloadable_product_permissions so permissions are granted after completion. Closes #4826 2014-02-17 10:50:00 +00:00
Mike Jolley e3b5df7ce2 Merge pull request #4388 from niravmehta/master
Expiry date calculation based on order completion date
2013-12-23 05:22:25 -08:00
Ratnakar 0faf26cbd2 Expiry date calculation based on order completion date 2013-12-17 10:37:19 +05:30
Justin Stern ae91c698f2 Downloadable File Fixes/Tweaks
* Hooked up new downloadable product permissions function to
completed/processing actions
* WC_Product::get_files() is used rather than the underlying
_downloadable_files meta directly
* $this is passed to downloadable product filters in WC_Product in place
of $this->id which doesn't does not afford you the particular variation
when a product variation is being used.
2013-12-16 18:27:57 -05:00
Coen Jacobs 3e6acf7aab Code changes for #4252 2013-12-02 12:34:27 +01:00
Gregory K 7b38c7300b Inconsistent return types: mostly TODOs, some fixes 2013-11-29 13:50:31 -05:00
Coen Jacobs f7df17db1c Order functions woocommerce to wc refactor 2013-11-25 14:54:52 +01:00