Commit Graph

106 Commits

Author SHA1 Message Date
Nestor Soriano 23df8a4d17 Revert a couple of files to its original content after a messed rebase 2020-07-24 09:20:24 +02:00
Nestor Soriano 281ec18158 Undo the registration of old singletons in the DI container.
The container will in principle be used only to register classes
in the `src` directory.

Also, CustomerProvider class removed.
2020-07-24 09:20:24 +02:00
Nestor Soriano 312383ae47 First steps towards introducing a dependency injection framework.
- Add PHP League's Container package via Composer.
- Add an ObjectContainer class that encapsulates all the configuration
  and insulates the codebase from the concrete DI engine used.
- Add an improved ReflectionContainer class that will allow to
  register individual classes as singletons while autowiring.
- Use ObjectContainer to resolve the WooCommerce class, everything
  instantiated with "new" inside it, and all singletons that are
  usually obtained via WC() function.
- Introduce the CustomerProvider class.
- Introduce a service provider to resolve WC_Queue_Interface,
  this replaces the WC_Queue class.
- Mark as obsolete all the replaced "instance()" methods,
  and the entire WC_Queue class.
2020-07-24 09:20:21 +02:00
Claudio Sanches 855b1d3b6b Added docblocks and removed $this 2020-06-01 14:35:31 -03:00
Boro Sitnikovski dd512c6f40 Move filter out of abstract class and into the manager class 2020-06-01 19:25:18 +02:00
Christopher Allford 8c0f4a1204 Made the is_package_shippable check more permissive
Initially it was made more precise to avoid calculating estimates for incomplete addresses. Due to some bad working in template files though, as well as historical precedent, we need to change it back.
2020-03-13 09:15:31 -07:00
Christopher Allford 6ad091a9b7 Changed all of the constant accesses into corresponding Automattic\Jetpack\Constants usages 2020-01-28 21:21:29 -08:00
Claudio Sanches 107720dc08 Make is_package_shippable less strict 2020-01-10 17:05:28 -03:00
Christopher Allford a7daebc6fd Fixed an exception that was thrown when a country had no states when checking for package shippability 2019-12-26 13:55:42 +05:30
Christopher Allford e800b40ad6 Made packages with incomplete destinations unshippable 2019-12-26 13:55:41 +05:30
Yash Kapoor b6e0c0308b
Update class-wc-shipping.php
Fixed spelling of WooCommerce.
2019-08-22 11:57:27 +05:30
Yash Kapoor 5b9b67ace1 Make matched shipping zone notice translatable (#24366)
* Update class-wc-shipping.php

Added translation.

* Update class-wc-shipping.php

Added translation.

* Update class-wc-shipping.php

Fixed phpcs error.

* Update class-wc-shipping.php
2019-08-12 10:32:44 -03:00
Mike Jolley 5280ceb8d9 Improve inline docs in calculate_shipping_for_package 2019-01-21 11:49:44 +00:00
Mike Jolley 868e7841e6
Merge pull request #21860 from rellect/wc_case
Rename wc() to WC() for consistency
2019-01-08 14:29:59 +00:00
JeroenSormani f4775ccd90 Use shipping method instead of property through magic + doc return statements 2019-01-04 12:41:38 +00:00
Refael Iliaguyev 127f1cb276 Use WC() instead wc() for consistency 2018-11-08 12:59:07 +02:00
Peter Fabian 17f9b601e9 Reverted more accurate counting of shipping class items as it could cause perf issues. 2018-09-10 16:23:06 +02:00
Peter Fabian 2ba13d06fd Fixed PHPCS. 2018-09-05 11:38:14 +02:00
Peter Fabian 43e3957bd5 Switched the variations to parent products to fix product counts for shipping classes. 2018-09-05 11:37:11 +02:00
Claudio Sanches 996d3decfe Fixed file and class dockblock 2018-03-21 20:54:10 -03:00
Rodrigo Primo 45c1adec23 Remove unused private method WC_Shipping::get_default_method()
This method was create in commit 9f65d2a1fc and it was used only once inside WC_Shipping::calculate_shipping(). But commit 4c4f26ff41 removed this call to WC_Shipping::get_default_method() and left the method unused.
2018-03-14 17:50:38 -03:00
Rodrigo Primo e90ce56a50 PHPCS fixes in includes/class-wc-shipping.php 2018-03-14 17:50:19 -03:00
Caleb Burks c21cc2e8fe Replace “Cheatin’ uh?” with friendlier messages 2018-02-07 17:01:12 -05:00
Mike Jolley 8f9bd7d0bf Return packages with no rates. 2017-12-05 15:00:07 +00:00
claudiulodro d7161cb711 Refactor it a little bit 2017-11-02 09:24:09 -07:00
claudiulodro a3ffd72842 Packages are shippable until proven otherwise 2017-11-02 09:16:17 -07:00
Mike Jolley d2e3839d99 Use getters and setters in cart class 2017-08-18 12:51:45 +01:00
ragulka d73e7e4f9d Prevent unwanted double cart notices (#16460)
* Don't add shipping zone debug message when doing ajax

Prevent an issue where the "Customer matched zone" debug message is shown twice after first selecting a shipping method and then changing a product's quantity in cart and clicking Update cart.

* Don't pass event object to cart.update_cart

Prevent accidentally preserving cart notices when `wc_update_cart` event is triggered on body. If the event object is passed to update_cart() as the first param, it evaluates to true, forcing existing notices to be preserved.

* Pass custom arguments to cart.update_cart()

Instead of simply not passing the event object, pass any custom arguments, so it's possible to do something like: $( body ).trigger( 'wc_update_cart', true ); to still preserve notices if needed.
2017-08-16 11:34:35 +01:00
Mike Jolley 4c4f26ff41 Changes to allow shipping to be calculated from totals class
Moved some items from
https://github.com/woocommerce/woocommerce/pull/11889/files to support
this.
2017-07-25 15:11:32 +01:00
Mike Jolley c16acc6b51 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	assets/css/wc-setup-rtl.css
#	assets/css/wc-setup.css
2017-05-23 19:00:24 +01:00
Rasmus Bengtsson 185934fad9 Fix phpdoc to include params and correct types 2017-05-15 13:50:52 +02:00
Rasmus Bengtsson 4f00d7e5e3 PHPDoc: Add missing return statement 2017-05-15 13:37:59 +02:00
Boro Sitnikovski 5a0b70f291 Fix empty string case for `WC_Order::get_total_shipping` 2017-02-06 14:41:19 +01:00
Mike Jolley d7dfdd3d10 Wrap all deprecation calls. 2016-11-23 16:15:00 +00:00
Krzysztof Grabania 4711066490 Removed empty string param in _deprecated_function function (#12301)
`_deprecated_function` has conditional which is checking if third param (replacement) is null. Passing replacement as empty string to this function will fail this test and the end of triggered error will look like this: `Use instead.` instead of `with no alternative available.`. This PR removes all occurrences of empty strings in this function.
2016-11-10 10:17:32 +00:00
Dwain Maralack c27fd5c052 Check if the chosen method is set on the package rates. There are rare instances where store manager may disable a shipping option while the users session is still in progress. This results in an unexpected errors and checkout page hanging. Double checking that the chosen method is accessable on the package avoids the error. (#12111) 2016-10-18 11:38:44 +01:00
Aristeides Stathopoulos 734f284fa4 WordPress.PHP.YodaConditions.NotYoda 2016-09-08 01:32:24 +03:00
Aristeides Stathopoulos ff852038c9 WordPress.Arrays.ArrayKeySpacingRestrictions.NoSpacesAroundArrayKeys 2016-08-27 06:11:30 +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 0667c1cde1 Remove option based tools 2016-08-24 17:35:13 +01:00
Mike Jolley 84487d0f4b Shipping debug mode moved to shipping settings 2016-08-24 16:55:34 +01:00
Mike Jolley d4cc1f80d4 [2.6] Fix ship to specific counties option
Fixes #11642
2016-08-10 12:04:52 +01:00
Mike Jolley 6e1a640b1c Prevent dirty sessions by removing data objects from the package hash
Closes #11269
2016-08-02 17:10:26 +01:00
Claudio Sanches 7d9d091767 Fixed mixed tabs and spaces 2016-07-11 16:56:35 +02:00
Mike Jolley 3ab6a22146 Match zones with no countries 2016-06-20 13:22:58 +01:00
Mike Jolley 291a997161 Don't show debug on checkout
Closes #11166
2016-06-17 13:21:59 +01:00
Mike Jolley 7266e020fb Avoid normalization of zone postcodes so wildcard matching can be performed on postcodes with spaces. E.g. SP1 *
Also adds matching zone notice when shipping debug is on.

fixes #11154
2016-06-16 11:28:53 +01:00
Mike Jolley 032e57d602 If shipping method count changes, reset to default. 2016-06-15 14:38:08 +01:00
Mike Jolley 5329baee0a shipping_methods can be null 2016-06-07 14:24:10 +01:00
Mike Jolley 847dea6a2d docs/vars 2016-06-07 14:02:02 +01:00