Commit Graph

128 Commits

Author SHA1 Message Date
Mike Jolley e99798f16e Date modified is read only and set by WP after update 2016-08-16 11:57:25 +01:00
Mike Jolley 46b6ca0f3b Only read users from current site 2016-08-16 11:08:54 +01:00
Mike Jolley de7e522835 Remove customer order queries for performance reasons and offer get_last_order() method instead.
Same for order counts - these don’t need to be populated after read,
only when needed. cc @justinshreve
2016-08-16 10:04:52 +01:00
Mike Jolley 589ce2f544 Write context 2016-08-15 18:26:00 +01:00
Mike Jolley 83dca89d0c Correct customer escaping and tests 2016-08-15 16:53:48 +01:00
Mike Jolley 14b40ea340 Handle first and last name fields
@justinshreve
2016-08-15 14:13:20 +01:00
Mike Jolley e1318d9175 Stop WP core meta data being removed for customers
@justinshreve
2016-08-15 13:17:43 +01:00
Justin Shreve a610c6a804 Update the Customers API to use the WC_Customer CRUD Class
Also:
* Introduces Tests for the Customer REST API
* Fixes a few API and test issues from recent CRUD changes
* Adds some missing billing_ and shipping_ meta data functions to Customer CRUD
2016-08-11 10:30:44 -07:00
Mike Jolley f4b45001ec Merge conditonal 2016-08-09 11:17:47 +01:00
Mike Jolley b7dcd97572 Sanitize on set only 2016-08-09 11:16:54 +01:00
Mike Jolley 01a4c81094 Spacing 2016-08-09 11:16:13 +01:00
Justin Shreve e3b1f6dbc9 A few fixes to customer CRUD:
* Implement some missing legacy functions
* Stop calling legacy functions from some pages
* Prevent extra meta from being deleted, unless requested by the CRUD (was causing problems with user/customer)
* Prevent save when loading from session AND logged out
2016-08-04 13:13:07 -07:00
Justin Shreve f4353f6aa9 Don't save to the database if we are working with sessions, save to the session when save() is called instead. 2016-08-04 11:39:34 -07:00
Mike Jolley 1bc9da3e91 Merge branch 'master' into WC-CRUD
# Conflicts:
#	includes/class-wc-coupon.php
2016-08-04 12:10:04 +01:00
Mike Jolley 92c670acde Fix - woocommerce_local_pickup_methods comparison by stripping instance IDs before the check.
@claudiosmweb Seems that local_pickup in zones did not get base tax
applied due to method id mismatch.
2016-06-29 15:23:42 +01:00
Mike Jolley 78142a8ebb Merge branch 'master' into WC-CRUD
# Conflicts:
#	includes/class-wc-checkout.php
#	includes/class-wc-coupon.php
#	includes/class-wc-customer.php
#	tests/unit-tests/cart/cart.php
#	tests/unit-tests/cart/functions.php
#	tests/unit-tests/coupon/coupon.php
#	woocommerce.php
2016-06-13 15:01:58 +01:00
Mike Jolley 1cb15b2636 Fix unit tests 2016-05-25 12:46:16 +01:00
Fredrik Forsmo 398ab8a016 Add `public` keyword to public various methods 2016-04-26 19:26:56 +02:00
Justin Shreve d98299778e Fix set_to_base deprecated call 2016-03-17 13:28:40 -07:00
Justin Shreve 9f998b01b1 Make sure sessions and compat code correctly deal with billing_ prefix 2016-03-17 13:26:33 -07:00
Justin Shreve e65ab6adec start transfering things to billing_ prefix 2016-03-17 12:39:29 -07:00
Justin Shreve 15e37ab66a Add meta handling to WC_Customer and fix some missing code with first and last name. 2016-03-17 12:03:23 -07:00
Justin Shreve f5a43e7025 Move WC_Customer to use the new Abstract WC_Data 2016-03-17 10:30:20 -07:00
Justin Shreve 0f1f6dddd1 Finish customer crud tests 2016-03-17 09:41:12 -07:00
Justin Shreve 8dbe673c89 Fix loading meta fields that are not address fields. Add some tests related to CRUD, and add stubs for the rest of the tests we will add. 2016-03-17 09:41:12 -07:00
Justin Shreve 25430afd33 Make session loading work correctly, add an alias for address_1 and shipping_address_1, fix total spent and order count 2016-03-17 09:41:12 -07:00
Justin Shreve aa590f3845 Implement remaining customer get/setters, and start on tests. 2016-03-17 09:41:12 -07:00
Justin Shreve 8f05c04ca4 Start working on the last set of get/setters 2016-03-17 09:41:12 -07:00
Justin Shreve ffc80ccd15 Start updating some usage, and start implementing the actual CRUD functions, and some new get/setters for username, email, etc. 2016-03-17 09:41:12 -07:00
Justin Shreve eb22c8b57d Initial start of WC_Customer CRUD refactor, start moving some logic to legacy class, implement WC_Data, and finally a functioning read() that works with passed DB customer info AND sessions. 2016-03-17 09:41:12 -07:00
Mike Jolley 1076854608 Merge branch 'master' into shipping-zones
# Conflicts:
#	assets/css/admin.css
#	includes/abstracts/abstract-wc-shipping-method.php
#	includes/class-wc-shipping.php
#	includes/shipping/flat-rate/class-wc-shipping-flat-rate.php
#	includes/shipping/flat-rate/includes/class-wc-eval-math.php
#	includes/shipping/free-shipping/class-wc-shipping-free-shipping.php
#
includes/shipping/legacy-international-delivery/class-wc-shipping-legacy
-international-delivery.php
#
includes/shipping/legacy-local-delivery/class-wc-shipping-legacy-local-d
elivery.php
2016-01-11 11:48:18 +00:00
Fredrik Forsmo a0ae6dfbe2 Improve docblock comments WC_Customer class
* Added comment to `has_calculated_shipping`, `get_taxable_address`
and `calculated_shipping`
2016-01-06 15:56:25 +01:00
Mike Jolley 119f19a5c1 Include and conditionally load legacy shipping methods 2015-12-18 14:24:34 +00:00
Nicola Mustone c9da4f928a check if ABSPATH is defined 2015-11-06 10:22:19 +01: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 737769174e Customer class using wrong meta keys for address_1/shipping_address_1
Fixes #8717
2015-08-05 14:05:03 +01:00
Mike Jolley 84bc6e1b1a Merge branch 'geolocate-cache'
Conflicts:
	includes/class-wc-customer.php

Closes #7939
2015-06-23 12:26:03 +01:00
Mike Jolley 00d574a929 get_taxable_address() should get postcode and city too.
@SiR-DanieL Can you check this?
2015-06-23 11:50:15 +01:00
Mike Jolley eb4cbaf69f get_taxable_address does not need to handle geolocation_ajax any more 2015-06-22 15:30:34 +01:00
Mike Jolley f988aae387 Use hashes and server side redirection 2015-06-22 14:55:15 +01:00
Mike Jolley af83181a25 Set to default locale if QS does not match customer data in store 2015-06-17 16:56:26 +01:00
Mike Jolley b8f644fe9e Remove line breaks 2015-06-17 15:19:04 +01:00
Mike Jolley 9886a805df Fix up standards #7939 2015-06-17 13:59:04 +01:00
Mike Jolley 33c298fea7 Experiment with appending geolocation to query string to prevent caching 2015-06-17 12:12:49 +01:00
Gerhard 072b52c520 Avoid making multiple get_default_* calls after each other, just reuse the first calls data 2015-04-30 14:29:25 +02:00
Mike Jolley 9f65d2a1fc Added priorities for shipping methods to give more control over defaults.
Closes #7871
2015-04-13 15:32:57 +01:00
Nicola Mustone 95cdb0390f fix related products error 2015-03-27 17:52:21 +01:00
Nicola Mustone 15ef65ea54 split WC_Customer constructor 2015-03-27 17:43:04 +01:00
Mike Jolley 217c3a49ff If logged in, populate customer data from user meta.
Closes #7459
2015-02-17 15:47:28 +00:00
Mike Jolley c01fe87d69 Cast to array 2015-02-03 15:06:15 +00:00
Mike Jolley caac9768a7 Added more fallbacks for API geoIP 2014-12-30 11:11:17 +00:00
Mike Jolley d908093eac Made function names make more sense (customer location vs base locations) 2014-12-23 17:33:33 +00:00
claudiosmweb da43955416 Introduces the wc_get_default_location() function 2014-11-18 12:56:13 -02:00
claudiosmweb 771f25d7b7 Improved the WC_Customer class, removed dead variables, removed duplicated code and added new docblocks 2014-11-18 12:32:48 -02:00
claudiosmweb 6acfd3e2a7 Created WC_Customer::get_default_location() for avoid duplicate code 2014-11-18 11:32:44 -02:00
Mike Jolley 229d9135ef Prevent errors when country field is disabled
Fixes #6336
2014-09-22 13:23:31 +01:00
Mike Jolley 3fb4deaa2b Prevent woocommerce_apply_base_tax_for_local_pickup breaking tax on virtual orders 2014-09-08 14:48:18 +01:00
Mike Jolley c4ef86d44e scrutinizer patches 2014-09-08 00:37:55 +01:00
claudiosmweb 78c7fefe3e fixed some docblocks 2014-09-02 16:50:19 -03:00
Mike Jolley 387cc973df Removes properties from customer class - these are all stored in _data! 2014-06-02 11:50:01 +01:00
claudiosmweb d0fac1f737 introduces the wc_get_customer_available_downloads() function 2014-05-28 14:05:19 -03:00
Mike Jolley 455ef80ee7 Refactor country class get methods Closes #4692 2014-05-15 13:27:13 +01:00
Mike Jolley ffb6dcee4a Brackets 2014-05-08 10:35:51 +01:00
splashingpixels c5deab6fe6 fixed my account downloadables out of order 2014-04-16 21:23:45 -07:00
Remi Corson 7886a4d95d Removed break line and space 2014-04-04 15:23:15 +02:00
Remi Corson e475521a85 Optimized is_paying_customer() 2014-04-04 15:18:10 +02:00
Remi Corson 94c93800b4 Added is_paying_customer() to easily check if a user is a WC customer:
Usage:

`
$customer = new WC_Customer();
$out      = 'Paying customer ? ';

if( $customer->is_paying_customer( 10 ) ) {
	$out .= "yes";
} else {
	$out .= "no";
}

echo $out;
`
2014-04-04 09:38:56 +02:00
Mike Jolley 9068da2ece When getting downloadable files, check access_expires too Closes #5060 2014-03-06 14:35:25 +00:00
Gerhard 123d60912b Add filenames to Downloads section in My Account 2014-02-25 12:48:36 +02:00
Mike Jolley c3f514fa0a Standards and some query tweaks for get_downloadable_products #4827 2014-02-17 11:58:14 +00:00
Coen Jacobs 19688ad9ef Fixed several @return void clauses. There are more. No code changes in this commit, only PhpDocs
Closes #4216
2013-11-27 10:03:47 +01:00
Mike Jolley 51ba9c393f WC globals 2013-11-25 14:01:38 +00:00
Mike Jolley 67c7671bb2 woocommerce_apply_base_tax_for_local_pickup when no methods are chosen yet 2013-10-30 15:30:20 +00:00
Mike Jolley 355dd16962 Removed @coenjacobs helpers and cleaned up main clas 2013-09-12 14:41:02 +01:00
Mike Jolley e1631bd084 Reloads checkout after registration which fixes #3612, removes some notices preventing login cookie being set, moves cart check for #3162
No perfect solution for #3162. DB locking would probably cause more
issues that its worth, we cannot reliably use transactions as some
clients still use MyIsam. Best to accept orders and deal with stock
conflicts after the fact.
2013-09-04 11:26:19 +01:00
Mike Jolley b797cdb672 Handle local pickup taxes when getting taxable address 2013-09-03 16:26:06 +01:00
Mike Jolley c75ea04c1c classes -> includes 2013-06-11 14:25:30 +01:00