Commit Graph

230 Commits

Author SHA1 Message Date
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 847dea6a2d docs/vars 2016-06-07 14:02:02 +01:00
Mike Jolley 730019ef18 scrutinizer best practice 2016-06-06 19:39:23 +01:00
Mike Jolley d9db29a035 Clean before json_encode to ensure values are strings
#10937 @thenbrent
2016-06-02 12:51:26 +01:00
Mike Jolley 2745d8721f Fix required field empty string check
@roykho
2016-05-31 18:02:15 +01:00
Mike Jolley 130933badf Merge pull request #10937 from thenbrent/cart_hash_tweak
Use print_r() to stringify cart session
2016-05-18 11:30:08 +01:00
Brent Shepherd 671ae32e58 Use print_r() to stringify cart session
Instead of json_encode(), because json_encode() takes types into
account, meaning numbers may end up being represented in the
encoded JSON as a string, e.g. "1" instead of 1, which can lead
to the md5() being different between requests.

This issue surfaces when creating a cart hash in a different
request to the request to pay for the order, because after adding
line items to the cart, the items quantity will be encoded with
json_encode() as an int, but when encoding them in a different
request, where they are coming from the database, they will be
encoded as a string.
2016-05-17 16:38:08 -07:00
Caleb Burks 75dfae2bf2 Return to shop if session expires and escape url. 2016-05-17 17:00:09 -05:00
Caleb Burks b8aea9aff0 Return to shop if session expires 2016-05-17 16:52:17 -05:00
Claudio Sanches 653f79b25b Fixed method retuning value in write context in includes/class-wc-checkout.php 2016-04-22 15:03:10 -03:00
Mike Jolley 6ae2fea045 Allow default address to be empty.
Fixes #10664
2016-04-18 14:51:39 +01:00
Mike Jolley bfadb22c7c Added notice when no methods exist 2016-03-31 18:54:33 +01:00
Mike Jolley bcd90ea1fb Fix error is default address values
Fixes #10606
2016-03-30 12:55:29 +01:00
Claudio Sanches ab90f54880 Better name for required field notices filter #10597 2016-03-24 09:06:17 -03:00
vasikgreif 565e259851 Add filter for required fields error message
Add the ability to change required fields error message, as discussed here: https://github.com/woothemes/woocommerce/pull/10591
2016-03-23 14:00:51 +01:00
Justin Shreve 4194aca904 Deprecated functions for old billing address functions 2016-03-17 13:40:30 -07:00
Justin Shreve e65ab6adec start transfering things to billing_ prefix 2016-03-17 12:39:29 -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
Mike Jolley ac122f13b9 Add context to checkout error messages
Closes #10540
2016-03-14 11:54:16 +00:00
JeroenSormani 67adc81814 Use real checkout fields for getting value 2016-02-12 13:51:08 +01:00
Mike Jolley a71a4de1b8 Add hash check when resuming order to detect changes.
@claudiosmweb
2016-02-05 09:41:25 +00:00
Mike Jolley 3938a43b44 Error handling when order cannot be retrieved.
Also renumbers error codes @claudiosmweb since 4xx usually reflects
client errors and may be misleading

Closes #10047
2016-01-11 10:47:10 +00:00
Max Rice 655089b162 Fix checkout result notice 2015-12-14 20:15:22 -05:00
Mike Jolley ef98a2d79c Compare type 2015-12-03 10:51:07 +00:00
Nicola Mustone c9da4f928a check if ABSPATH is defined 2015-11-06 10:22:19 +01:00
Mike Jolley 61e746730f wc_transaction_query function
Only uses transactions if enabled, or read uncommitted is supported
#9279
2015-11-04 14:11:40 +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
Claudio Sanches f64ea948f1 Replaced WC()->cart->ship_to_billing_address_only() to wc_ship_to_billing_address_only() 2015-10-28 16:03:24 -02:00
Mike Jolley 5ec400e514 Validate terms and conditions and improve templates 2015-10-06 12:33:45 +01:00
Claudio Sanches 9e41552342 Removed all "@return void" 2015-07-16 16:55:48 -03:00
Nathan Dawson f9e43b874c Resolve blank shipping information bug. Fixes #8235
Setting the 'woocommerce_cart_needs_shipping' filter to true means the shipping fields can be shown for virtual products. Whether to check shipping details should be based on whether they're shown and not whether the cart needs shipping.
2015-05-28 00:54:05 +01:00
Mike Jolley 0b58a840e2 Merge pull request #8168 from Nikker/master
Added method to check if cart is empty
2015-05-19 11:41:48 -04:00
Mike Jolley c1e3da8bcb Return real json response during checkout
Closes #8086
2015-05-15 13:51:51 +01:00
Nikki DelRosso 940c2369b0 Added method to check if cart is empty 2015-05-14 14:18:53 -07:00
Slobodan Manic f1927c8c40 Fixes WC_Checkout class name in header comment block 2015-04-27 21:57:16 +02: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
Nicola Mustone d2af01df5b scrutinizer suggested tweaks 2015-03-27 16:15:40 +01:00
Mike Jolley 9bc1b09fc5 Undefined and dead variables in checkout class 2015-02-03 15:27:40 +00:00
Mike Jolley ca29deead9 Error codes for create order function
Closes #6952
2015-01-05 15:45:11 +00:00
Mike Jolley d1fd2b3612 Fix zero-rated tax display and ensure tax_id is not empty when saving taxes
Closes #7040
2015-01-05 15:13:49 +00:00
Juan Gadiel Rosado Colon de1466779b Fixes issue #6940
Check if the cart needs shipping before updating the user shipping address. This fixes the issue (#6940) of the shipping address being updated with the user billing address when purchasing a virtual product.
2014-12-20 20:29:09 -04:00
juangadiel ca1b9c334c Update class-wc-checkout.php fixes issue #6940
Check if the cart needs shipping before updating the user shipping address. This fixes the issue (#6940) of the shipping address being updated with the user billing address when purchasing a virtual product.
2014-12-12 17:18:16 -04:00
Mike Jolley eba8206540 Merge branch 'tax-coupon-handling' Closes #6830
Conflicts:
	assets/js/admin/meta-boxes-order.min.js
	includes/api/class-wc-api-coupons.php
	includes/class-wc-cart.php
	templates/checkout/review-order.php
2014-12-03 12:33:15 +00:00
Barry Kooij 4c2adfda62 Doc return type update. 2014-11-30 14:16:40 +01:00
Mike Jolley 3c82331a8b Store discount 'tax' to show discounts on prices including tax more accuratly
Also deprecated some functions named after having 2 levels of discounts.
2014-11-25 13:05:03 +00:00
Mike Jolley 4a8c541fbf Remove 'order' discounts from classes 2014-11-25 11:05:14 +00:00
Mike Jolley 591086eb9b Show notice when nonce isn't set. Fixes #6658
Wrap entire process_checkout method in try catch block to make errors
output correctly.
2014-10-31 15:03:53 +00:00
claudiosmweb 95605982ba Load billing and shipping address when get the values in checkout, closes #6590 2014-10-21 19:56:20 -02:00
Mike Jolley b09f1062da Merge pull request #6579 from woothemes/hotfix-unqiue-nonce-edit-details
[2.2] Make edit account details nonce unique to customer.
2014-10-21 13:17:36 +01:00
Gerhard 5c1ad63876 Propper verify nonce use on checkout 2014-10-21 09:44:53 +02:00
mgiulio 8567f2f1fd Fix comment 2014-10-15 14:51:15 +02:00
Mike Jolley 229d9135ef Prevent errors when country field is disabled
Fixes #6336
2014-09-22 13:23:31 +01:00
Ninos Ego 966f6f1bad createaccount value check 2014-09-21 20:45:42 +02:00
Mike Jolley 09a59a5e7e Prevent errors when adding 'zero-rated' tax on checkout. 2014-09-17 11:40:54 +01:00
claudiosmweb 48b5014036 fixed the filling of the shipping fields in WC_Checkout::create_order() 2014-09-11 17:31:57 -03:00
claudiosmweb 591d3dc3be added methods to dynamically get the address fields in WC_Checkout::create_order(), closes #6226 2014-09-11 17:12:17 -03:00
Barry Kooij 6655188f0b Changed use of get_order with wc_get_order 2014-08-15 14:29:21 +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 93cf3c88bd initial implementation of order items taxes 2014-07-19 01:08:02 -03:00
Mike Jolley 755001f19b Use order types where required 2014-07-11 12:43:42 +01:00
Max Rice 10046cb8a1 Only print checkout notices when not reloading the checkout
Any notices that are added during checkout are immediately lost when
the checkout is forced to reload. This commit fixes that by only
printing the notices if the checkout is not being reloaded, otherwise
they’re printed on the page reload and properly displayed to the user.
2014-07-04 17:22:58 -04: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
JDGrimes 0d472cead5 Update copy-pasted docs
Fixes #5707
2014-06-19 15:43:05 -04:00
Mike Jolley cf3cca4c8e Merge branch 'feature-wc-create-order' 2014-06-18 16:07:29 +01:00
Mike Jolley f2ca5e76bd Use a transaction during checkout's order creation method to ensure all data gets set
Closes #5368
2014-06-18 16:03:46 +01:00
Coen Jacobs 89ea6c46ab Replace new WC_Order calls with get_order 2014-06-13 15:24:51 +02:00
Mike Jolley ef3e728855 Setters + wc_create_order + wc_update_order for #4169 2014-06-11 15:10:03 +01:00
Coen Jacobs 3ad8935b20 Removed ununsed global variables in local scopes 2014-06-08 22:33:11 +02:00
Mike Jolley 5d8a1e03c0 Merge pull request #5610 from ragulka/checkout-wc-clean-fix
Check if posted data is_array before doing wc_clean in checkout
2014-06-06 16:09:02 +01:00
Mike Jolley 09c4e1c07a Merge pull request #5614 from mkayan-wakefly/master
RE issue: #5613 - Typo in error message
2014-06-04 11:31:19 +01:00
mkayan-wakefly e6bfd393ac #5613 Typo in "don't ship to" error message
Typo in "don't ship to" country message: Issue #5613

Removing the word "to" from the error message indicating that a site doesn't ship to a certain country.

The function, shipping_to_prefix(), will handle insert the word "to".
Or, in the case of US, GB, and a few other countries, the words "to the".
2014-06-03 15:51:09 -04:00
mkayan-wakefly 32618c72b5 Update class-wc-checkout.php
Removing the word "to" from the error message indicating that a site doesn't ship to a certain country.

The function, shipping_to_prefix(), will handle insert the word "to".
Or, in the case of US, GB, and a few other countries, the words "to the".
2014-06-03 15:45:22 -04:00
Illimar Tambek 6302c0fb8a Check if posted data is_array before doing wc_clean in checkout 2014-06-03 14:16:19 +03:00
Mike Jolley f30e95663b Prefixes for queries 2014-06-03 11:29:01 +01:00
Mike Jolley 309f700283 has_status 2014-06-03 10:45:33 +01:00
Mike Jolley 5af1c5ba59 Update checkout functions 2014-05-30 16:16:57 +01:00
Mike Jolley 6e8e32256b Indentation 2014-05-20 11:08:09 +01:00
Mike Jolley b7efaea79f Tidyup brackets 2014-05-01 14:40:31 +01:00
mkayan-wakefly 84f531f848 Update class-wc-checkout.php
Recalculating the cart totals, in the event a user registers during checkout and in doing so qualifies for any discounts
2014-04-28 14:20:45 -04:00
Mike Jolley edf54ad0c8 Check order exists when resuming on checkout 2014-03-31 11:12:12 +01:00
Mike Jolley ed4f283627 Remove this from earlier as it breaks foreign chars 2014-03-19 15:32:07 +00:00
Mike Jolley 6355a0c54a esc_attr isn't suitable for meta keys 2014-03-19 12:58:39 +00:00
InoPlugs Webdesign a284d7fe69 Update class-wc-checkout.php
We need this hook to mark the fees our plugin (additional fee based on gateway) adds to the the order. Otherwise we can't tell if a fee was added by the user (Add fee button), by another plugin or by our plugin.
2014-03-11 19:48:51 +01:00
Mike Jolley f35c3708bb Rounding order_tax and order_shipping_tax restricts our ability to get an accurate tax_total after an order is made. Fixes some paypal rounding requests.
@coenjacobs
2014-02-20 15:41:08 +00:00
Mike Jolley 3be6664f05 Handle get_rate_code when no matching rate is found. Prevents notices. 2014-02-17 15:11:50 +00:00
Mike Jolley c0c21c8364 Unify textdomains Closes #4814 2014-02-17 13:14:45 +00:00
Mike Jolley 1a92bfeb39 If logged in, and no billing_email is set, set it. 2014-02-13 15:51:16 +00:00
Mike Jolley 5b5183bb35 The checkout's get_value method should return null if a value is not yet set - this allows the 'default' in woocommerce_form_field to be used as a fallback Closes #4746 2014-02-13 09:52:48 +00:00
justinstern 9a2b801e7b A Pair of Useful Shipping Related Actions 2013-12-30 18:59:09 -05:00
Illimar Tambek 9b43089562 Only continue getting checkout value if null 2013-12-27 15:39:21 +02:00
Mike Jolley 33f07a05a8 Pass order ID to woocommerce_payment_successful_result Fixes #4378 2013-12-23 15:47:56 +00:00
Mike Jolley 418a8785b0 woocommerce_checkout_customer_userdata filter Closes #4235 2013-12-03 12:27:53 +00:00
Mike Jolley 6db8ac6f6f Made error counts work with new notices api Closes #4201 2013-11-27 16:15:53 +00:00
Coen Jacobs 47ae00be28 Page functions woocommerce to wc refactor 2013-11-25 15:07:22 +01:00
Coen Jacobs f7df17db1c Order functions woocommerce to wc refactor 2013-11-25 14:54:52 +01:00
Coen Jacobs c1a439eb99 Formatting functions woocommerce to wc refactor 2013-11-25 14:34:21 +01:00
Coen Jacobs 1663eafb68 Customer functions woocommerce to wc refactor 2013-11-25 13:52:53 +01:00
Coen Jacobs aaa14894ca Core functions woocommerce to wc refactor 2013-11-25 13:45:04 +01:00
toddlahman 0c07663b26 wc_ delimiter to identify start of uniquid 2013-11-20 00:03:49 -08:00
thenbrent 2fcd615f88 Update calls to wc_print_messages() function
Part of #4034
2013-11-12 20:59:40 -08:00
thenbrent e14e3842b0 Update calls to wc_error_count() function
Part of #4034
2013-11-12 20:59:39 -08:00
thenbrent 0d45e19fcf Update calls to wc_add_error() function
Part of #4034
2013-11-12 20:59:39 -08:00
Mike Jolley 3fd02a57d0 Locales - store standardised values, and display using locale in admin #3862 2013-11-12 17:43:30 +00:00
James Koster 1fbb6249ff Replaced → / ← on frontend with icons from our font. closes #4009 2013-10-28 09:45:59 +00:00
Mike Jolley 51aba21d76 Rounding + precision for taxes. Store unrounded. Round down (for the moment) for taxes 2013-10-24 13:15:42 +01:00
Mike Jolley 5d2e1ac031 Refactor coupon code so coupons get the actual discount amount, redone edit coupon screen with tabs, added coupon item limits which Closes #3902 2013-10-18 18:10:58 +01:00
Gregory K da19fed52b class-wc-checkout.php : PHPDoc fixes 2013-10-06 00:44:04 -04:00
Mike Jolley 9361ef3120 more hooks closes #3860 2013-10-04 16:58:00 +02:00
Mike Jolley 633ead9390 woocommerce_checkout_update_customer_meta hook Closes #3860 2013-10-04 16:40:03 +02:00
Mike Jolley cabddc4e9f Maintain line breaks. Closes #3882 2013-10-04 14:31:43 +02:00
Mike Jolley 24a3e3e17b Format decimals with single function, convert locale to standard form. #3862 2013-10-01 17:54:32 +01:00
Mike Jolley 3bedaf5e94 Number format taxes, and allow 'auto' DP (we don't want to round these values) Closes #3703 2013-10-01 13:02:58 +01:00
Patrick Garman 1292a9f51a wp_insert_post should have true as $wp_error parameter
Add `true` as $wp_error parameter for wp_insert_post, otherwise it returns zero instead of a WP_Error object and the checkout process is not stopped.

@mikejolley - the messages from WP_Error are not displayed or logged, making debugging this difficult. Maybe we should check WP_DEBUG and display the message if it is set to true? either that or actually use the logger in WooCommerce for the first time?
2013-09-24 16:08:32 -05:00
Mike Jolley 4ef07f6a66 Cleanup defaults. Closes #3778 2013-09-19 15:02:17 +01:00
Mike Jolley 3ee6e2fa22 Validate rules, instead of doing it by key. Closes #3792. 2013-09-19 14:39:53 +01:00
Mike Jolley 5f741819b9 Merge pull request #3757 from ragulka/address-hooks
Allow using custom address types
2013-09-13 08:03:55 -07:00
Mike Jolley 355dd16962 Removed @coenjacobs helpers and cleaned up main clas 2013-09-12 14:41:02 +01:00
Illimar Tambek 41296943a6 Add woocommerce_checkout_get_value filter. 2013-09-10 17:23:26 +03: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 54b3d53a1b Flag a refresh when creating an account to prevent nonce issues. Fixes #3612.
@coenjacobs Might be for .14? Part of it anyway, can't cherry pick this
one.
2013-09-02 17:43:57 +01:00
Mike Jolley a66472d148 Order panel improvements + save multiple shipping methods 2013-08-16 16:43:26 +01:00
Mike Jolley e01df544ec Reworked total templates to support coupon lines, and started support for multiple shipping methods per order.
@todo store shipping methods in the order
@todo test with PP shipping real world

cc @coe
2013-08-14 21:00:34 +01:00
Mike Jolley e29c67b6bc Update user meta for billing fields 2013-08-08 12:38:26 +01:00
Mike Jolley 03af136986 Separate ship to options from sell to. Closes #3215. 2013-08-02 16:54:28 +01:00
Mike Jolley f7cba5948b Filter woocommerce_checkout_customer_id Closes #3491 2013-07-30 14:50:53 +01:00
Mike Jolley 0ef33da03c Make account password 'required' when needed. Closes #3313. 2013-07-19 06:58:45 +01:00
Mike Jolley c72ae714f7 Removed nonce helper
@coe
2013-06-11 17:55:55 +01:00
Mike Jolley 646a8a008c Make use of new functions 2013-06-11 15:59:54 +01:00
Mike Jolley c75ea04c1c classes -> includes 2013-06-11 14:25:30 +01:00