Commit Graph

35310 Commits

Author SHA1 Message Date
Nestor Soriano e1265bfa25 Refactor WC_Helper_Product by extracting duplicated code to methods.
The new methods are create_product_variation_object and
create_product_attribute_object, they are public.
2020-07-28 08:55:55 +02:00
Nestor Soriano 752b47513d Fix code sniffer errors in some files.
Fixed files:

includes/data-stores/class-wc-product-variable-data-store-cpt.php
includes/wc-update-functions.php
2020-07-28 08:55:55 +02:00
Nestor Soriano 50e8f27bc7 Fix visibility of variable products with layered nav filtering.
The layered nav filtering doesn't work well with variable products
when some variations have stock and other don't. When a term is
selected in the widget, a variable product having no stock for
the variation corresponding to that term but having stock for
other variations will be displayed, but it shouldn't.

This commit fixes that by introducing two changes:

- A new override of "is_visible" for WC_Product_Variable that
  looks at the supplied filters, compares them against the corresponding
  available variations and calculates the visibility based on
  the query type (OR or AND).

- A hook on the "found_posts" filter in WC_Query, that adjusts
  the posts count based on the found products visibility
  when there are filters available; this is needed to sync the
  "displaying X posts" messages and the paging when variable
  products are hidden due to stock status.

Additionally, the visibility calculated in "found_posts" is cached
as loop variables so that it isn't calculated again when actually
displaying the products.
2020-07-28 08:55:52 +02:00
Nestor Soriano ff7884bdb6 Fix total products count display when there's one single result.
Fix from "Showing all 1 results" to "Showing the single result".
2020-07-28 08:47:29 +02:00
Nestor Soriano c27283dffe Fix code sniffer errors in some files.
Fixed files:

includes/abstracts/abstract-wc-product.php
includes/class-wc-query.php
includes/wc-template-functions.php
includes/widgets/class-wc-widget-layered-nav.php
templates/loop/result-count.php
tests/unit-tests/util/class-wc-tests-wc-query.php
2020-07-28 08:47:29 +02:00
Christopher Allford 578b205b4e
Merge pull request #27123 from woocommerce/feature/jetpack-autoloader-upgrade
Upgraded Jetpack Autoloader to 2.0
2020-07-27 23:35:53 -07:00
Claudio Sanches 134ab5c184 Fixed coding standards 2020-07-27 20:21:41 -03:00
Claudio Sanches 4f90307e2e Fixed "Paid By Customer" data when the orders contains refunds 2020-07-27 20:18:33 -03:00
Christopher Allford 1868cd8aaa Adjusting the shipping task order in the E2E test for setup tasks 2020-07-27 15:18:27 -07:00
Christopher Allford edf1932ee9 Adjusted the OBW test for changes in WC-Admin 1.4.0 2020-07-27 14:38:43 -07:00
Renovate Bot 3f784fd17f
Update dependency eslint-plugin-jest to v23.19.0 2020-07-27 20:20:12 +00:00
Ron Rennick d8edcb4551 update from review feedback 2020-07-27 16:48:39 -03:00
Christopher Allford c84f2b987b
Merge pull request #26750 from woocommerce/implement/core-language-packs-updates
Add language packs automatic delivery code.
2020-07-27 12:45:58 -07:00
Néstor Soriano 5cf1d77438
Merge pull request #27067 from matt-h/webook-race-fix
Queue all webhooks on shutdown.
2020-07-27 18:56:27 +02:00
Matt Harrison 9f8be6e2d8
Switch to use WordPress' shutdown action instead of register_shutdown_function 2020-07-27 12:11:40 -04:00
Matt Harrison e696ac7824
Queue all webhooks on shutdown.
It is possible for a later duplicate webhook to be fired too early if
the same webhook triggers in one request more than once with the updated
changes from the second one missing if it happens too quickly.
This queues all webhook to be register on shutdown instead of just
syncronous ones to make sure all data from the request is updated first
before the webhook gets queued.
2020-07-27 12:11:40 -04:00
Nestor Soriano cc118c0c10 Fixed the number of product types in the onboarding E2E test 2020-07-27 16:49:32 +02:00
Claudio Sanches db82c98801
Merge pull request #26945 from woocommerce/fix/25233
Photoswipe: Populate alt attribute for photoswipe galleries
2020-07-27 11:35:13 -03:00
Christopher Allford 4123d048e0 Fixed the number of industries in the onboarding E2E test 2020-07-27 07:08:54 -07:00
Christopher Allford 08575b1661 Added JETPACK_AUTOLOAD_DEV flag to autoloader
Since Composer assigns dev versions to locally checked out repositories (most of the time) we need to set this flag. If we don't tell the autoloader we want to use dev versions then it will always prioritize the package classes over the plugin classes.
2020-07-27 09:40:55 +02:00
Christopher Allford 5afab2b03d Removed the temporary PSR-4 autoloader
This was added to get around a limitation in the Jetpack Autoloader 1.x branch. Since dependencies could not be used before `plugins_loaded` without throwing a notice we needed a custom autoloader to run before it in order to prevent the notice from showing.
2020-07-27 09:40:55 +02:00
Christopher Allford c36ea25eb9 Updated composer lock file
Now that we've got all of the packages updated successfully we can do this!
2020-07-27 09:40:55 +02:00
Christopher Allford 77eee6d92d Updated the REST API to 1.0.11 2020-07-27 09:40:55 +02:00
Christopher Allford 3e6c4dd14a Updated WooCommerce Admin to 1.4.0-beta.1
The official PR for 1.4.0-beta.2 will be arriving next week and so I've included the first beta here in order to complete the autoloader update.
2020-07-27 09:40:55 +02:00
Renovate Bot 0897ed68fc Update dependency automattic/jetpack-autoloader to v2 2020-07-27 09:40:55 +02:00
Darren Ethier 3dafe70257 update woo blocks to 3.0.0 2020-07-27 09:40:55 +02:00
Néstor Soriano de73ec027c
Merge pull request #26303 from netzstrategen/feature/prevent-unnecessary-available-variations-render
Allows avoiding performance bottlenecks caused by get_available_variation().
2020-07-27 08:46:24 +02:00
Claudio Sanches aafb06929a
Merge pull request #26174 from woocommerce/fix/25843
Fix stock status saving for variable products on bulk and quick edit
2020-07-24 17:05:16 -03:00
Claudio Sanches 7bd34e3545
Merge branch 'master' into fix/25843 2020-07-24 17:04:28 -03:00
Claudio Sanches 419e5c239a
Fixed docblocks 2020-07-24 17:01:42 -03:00
Ron Rennick 3c6cff4b1c
Merge pull request #26961 from LeGaS/patch-1
Extend BACS accounts filter with order ID
2020-07-24 16:27:57 -03:00
Ron Rennick e218d25d6e
Merge pull request #26989 from adamradocz/patch-1
Remove leftover note.
2020-07-24 14:44:05 -03:00
Ron Rennick 96d73d2300
Merge pull request #27090 from woocommerce/update/wp-jest-preset-version
Update E2E env jest preset default version.
2020-07-24 14:39:55 -03:00
Vedanshu Jain dfe5493dd5
Merge pull request #26850 from woocommerce/fix/26654
Make sure shipping tax are not rounded down when prices are inclusive of taxes.
2020-07-24 22:53:26 +05:30
vedanshujain cd09e91817 Applied coding standards 2020-07-24 19:12:25 +05:30
vedanshujain f90699ddb9 Add more assertions in tests for order totals. 2020-07-24 19:12:25 +05:30
vedanshujain 0e7b064c02 Add more assertions in tests for round at subtotal. 2020-07-24 19:12:25 +05:30
vedanshujain fc6ae313e3 Do not use `wc_round_tax_total` in shipping tax for accuracy.
`wc_round_tax_total` is for when prices are inclusive of taxes, however, shipping taxes can never include taxes so they should always use `round( $price, wc_price_get_decimals() )` instead.
2020-07-24 19:12:25 +05:30
vedanshujain a413952784 Use round_item_subtotal for shipping because shipping prices never include taxes so no need to wc_round_tax_total. 2020-07-24 19:12:25 +05:30
vedanshujain 57c105a3fe Remove wc_round_tax_total calls because lines would have already been rounded appropriately before reaching here. 2020-07-24 19:12:24 +05:30
vedanshujain 853539df12 Remove wc_round_tax_total from shipping item because shipping price are never inclusive of taxes 2020-07-24 19:12:24 +05:30
vedanshujain 3aed8f1c85 Remove incorrect comments. 2020-07-24 19:09:59 +05:30
vedanshujain 7735eed314 Add unit tests and helpers for #26654 2020-07-24 19:09:59 +05:30
vedanshujain 541d9ca483 Remove individual rounding because lines would have already rounded.
When rounding at subtotal is enabled, line items are already rounded where they need to, so we only should do any further rounding when displaying values and no where else.

This is part of our larger attempt to remove individual rounding as much as possible.
2020-07-24 19:09:59 +05:30
Néstor Soriano 8c2412ea7d
Merge pull request #26731 from woocommerce/feature/introduce-dependency-injection
Introduce a dependency injection framework
2020-07-24 15:12:16 +02:00
Nestor Soriano c2e28b2b05 Replace array_merge_recursive in MockableLegacyProxy with custom code
test_static_mocks_can_be_used_via_injected_legacy_proxy_and_woocommerce_object
was failing in PHP 7.0, this replacement fixes it.
Suspected cause: https://bugs.php.net/bug.php?id=76505
2020-07-24 14:51:37 +02: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
Nestor Soriano 8f596bd25a Update composer.lock 2020-07-24 09:41:45 +02:00
Nestor Soriano e55ef052a2 Add documentation about the container and good coding practices.
- src/README.md largely expanded
- tests/README.md expanded
- includes/README.md added
- src/Internal/REAMDE.md added

src/README.md and includes/README.md have TODO placeholders to add
guidelines regarding to actions and filters.
2020-07-24 09:25:12 +02:00
Christopher Allford 811ac747e6 Added callable reflection to `add_with_auto_arguments`
This allows the dependencies of the callable function to be automatically resolved out of the container too!
2020-07-24 09:25:12 +02:00