Commit Graph

35310 Commits

Author SHA1 Message Date
Néstor Soriano add9fd791b
Merge pull request #27166 from xristos3490/fix/27163
[4.4] Pagination of custom product queries broken
2020-07-31 08:29:24 +02:00
Claudio Sanches c752721c2e
Merge pull request #27183 from woocommerce/fix/unit-tests-2
Fixed unit tests for WC_Notes_Run_Db_Update
2020-07-30 17:02:10 -03:00
Claudio Sanches 48974f29f1 Fixed unit tests for WC_Notes_Run_Db_Update 2020-07-30 17:00:11 -03:00
Claudio Sanches 891a0cf8e8
Merge pull request #27170 from woocommerce/fix/27167
Fixed - Fixed "Product type" dropdown from Product's data meta box on WP 5.5
2020-07-30 16:38:18 -03:00
Claudio Sanches cc8282a23f
Merge pull request #27142 from woocommerce/fix/25788
Improve order details UI to highlight "Paid" and "Net Payment" sections
2020-07-30 15:49:24 -03:00
Claudio Sanches 608fc8620d
Merge pull request #27172 from woocommerce/fix/27168
Let user stay in the same page after clicking to update WooCommerce
2020-07-30 15:48:27 -03:00
Claudio Sanches 2d468a4d27
Merge pull request #27175 from woocommerce/fix/27162
Fix incorrect adjustment of post count in WC_Query
2020-07-30 14:33:35 -03:00
Claudio Sanches 77f8bb57a6 Check if there's a payment method title 2020-07-30 13:05:03 -03:00
Claudio Sanches d51e4d806b
Merge pull request #27153 from woocommerce/fix/distignore
Included lerna.json to the .distignore file
2020-07-30 12:57:44 -03:00
Claudio Sanches 90fa418218
Merge pull request #27173 from woocommerce/fix/27169
Remove new WP 5.5 meta box arrows
2020-07-30 11:46:21 -03:00
Néstor Soriano d23a5fd0a9
Merge pull request #27177 from woocommerce/update/woocommerce-blocks-3.1
Package Update: Update WooCommerce Blocks to 3.1.0
2020-07-30 16:19:31 +02:00
Néstor Soriano e44154bf6e
Update tests/legacy/unit-tests/util/class-wc-tests-wc-query.php
Fix small coding standards issue.

Co-authored-by: Claudio Sanches <contato@claudiosanches.com>
2020-07-30 16:17:05 +02:00
Albert Juhé Lluveras ba4afe633c Update woocommerce/woocommerce-blocks to v3.1.0 2020-07-30 11:07:19 +02:00
Nestor Soriano 86c88f1750 Fix: incorrect adjustment of post count in WC_Query.
PR #26260 introduced a handler for 'found_posts' filter in WC_Query
class in order to adjust the count depending on the visibility
of variation products. However the handler incorrectly assumed
that the filter was triggered only when listing products, when
actually it's also triggered for any post type e.g. pages.
In these cases the post count was set to zero, which caused bugs.

Now the handler starts with the originally supplied posts count,
and only decrements it when a post is a product AND is not visible.
2020-07-30 09:32:28 +02:00
Claudio Sanches edaf71b115 Remove new WP 5.5 meta box arrows 2020-07-29 22:04:44 -03:00
Claudio Sanches 3c1132e274 Added unit tests for wc_get_current_admin_url() 2020-07-29 21:02:52 -03:00
Claudio Sanches a464b7aeab Improved wc_get_current_admin_url()
- Replace "/wp-admin" with regex like on WP core.
- Remove "wc-hide-notice" from query args.
2020-07-29 21:01:39 -03:00
Claudio Sanches c9f52a45eb New wc_get_current_admin_url() function 2020-07-29 20:52:36 -03:00
Claudio Sanches e26076af7b Return to the current page after enabled or disabling db update notices 2020-07-29 20:37:27 -03:00
Claudio Sanches d498341f0e Added function to get current admin page 2020-07-29 20:37:12 -03:00
Claudio Sanches 94f8d2d576 Fixed jQuery selector 2020-07-29 19:21:24 -03:00
Claudio Sanches 97c7937fd9 Fixed "Product type" dropdown on WP 5.5
WP 5.5 doesn't introduce a <span> tag inside metaboxes headings
2020-07-29 19:12:02 -03:00
xristos3490 6485fc337c Add docblock param 2020-07-29 18:30:26 +03:00
xristos3490 4d4b9e3432 Filter found_posts only on wc_query context 2020-07-29 18:21:36 +03:00
Néstor Soriano d5bedd82b2
Merge pull request #27148 from woocommerce/fix/dont-request-translations-with-no-locales
Don't request empty locales list for plugin translations.
2020-07-29 16:23:06 +02:00
Néstor Soriano 0f134ca6a2
Merge pull request #27054 from woocommerce/fix/27036
add/update correct deprecated notices on existing deprecations
2020-07-29 15:20:24 +02:00
Néstor Soriano 7f4df9e7ea
Merge pull request #27152 from hjoelr/add/woocommerce_file_download_method-addl-args
Add file path to woocommerce_file_download_method filter
2020-07-29 15:09:01 +02:00
Claudio Sanches 7531d308ca Included lerna.json to the .distignore file 2020-07-28 15:31:08 -03:00
Joel Rowley 61abc7caab
Add dockblock to the woocommerce_file_download_method filter
Co-authored-by: Claudio Sanches <contato@claudiosanches.com>
2020-07-28 14:28:15 -04:00
Claudio Sanches 008e41170b Improved UX to highlight order data when there's some refund 2020-07-28 15:13:00 -03:00
Joel Rowley ae5bd1e14f Add file path to woocommerce_file_download_method filter 2020-07-28 13:52:21 -04:00
Claudio Sanches 4b1a8cd96c
Merge pull request #26648 from woocommerce/renovate/eslint-plugin-jest-23.x
Update dependency eslint-plugin-jest to v23.19.0
2020-07-28 13:20:24 -03:00
Néstor Soriano d6791828fd
Merge pull request #27151 from woocommerce/update/wc-admin-1.4.0-beta.2
Refreshed woocommerce/woocommerce-admin for 1.4.0-beta.2 re-release
2020-07-28 17:42:57 +02:00
Christopher Allford 7d80474b60 Updated the `composer.lock` for re-release of woocommerce/woocommerce-admin@1.4.0-beta.2 2020-07-28 08:29:48 -07:00
budzanowski 57aeff0a71 Update comment. 2020-07-28 11:49:01 +02:00
budzanowski ac501dea64 Don't request empty locales list for plugin translations. 2020-07-28 11:37:51 +02:00
Néstor Soriano 05d5ff0417
Merge pull request #27144 from woocommerce/update/woocommerce-admin/1.4.0-beta.2
Update woocommerce-admin package to 1.4.0-beta.2
2020-07-28 10:20:51 +02:00
Nestor Soriano 393dbb7124 Update composer.lock 2020-07-28 10:09:33 +02:00
Timmy Crawford 5e787f836b Update woocommerce-admin package to 1.4.0-beta.2 2020-07-28 09:58:07 +02:00
Néstor Soriano df94b6570d
Merge pull request #26260 from woocommerce/fix/25524
Fix the visibility of partially out of stock variable products when using the layered nav widget
2020-07-28 09:54:09 +02:00
Nestor Soriano bc7085b3c4 Fixes after rebasing.
- Fix a call to get_available_variations with incorrect optional arguments.
- Add code that has been removed in WC_Product_Variable::get_available_variations.
2020-07-28 09:29:01 +02:00
Nestor Soriano 2283a4c7fd Revert woocommerce_product_loop to use have_posts instead of wc_get_loop_prop( 'total' ). 2020-07-28 09:01:55 +02:00
Nestor Soriano 681401850a Adjustments in the items count calculation on the nav filtering widget.
The calculations are now consistent with the change made to the
visibility of the variable products when using one or multiple filters.
2020-07-28 09:01:55 +02:00
Néstor Soriano e9d692f455 Apply suggestions from code review
Mostly adding "since 4.4.0" annotations and updating
db update functions from 4.2 to 4.4.

Co-authored-by: Claudio Sanches <contato@claudiosanches.com>
2020-07-28 09:01:55 +02:00
Nestor Soriano 29843b9396 Change in the logic of is_visible_core for variable products
Now, if there are filters present the logic is as follows:

- For multiple filtering values of the same attribute:
  the product is visible if there's at least one variation
  that has one of the filtering values associated to the attribute,
  or if there's at least one variation having the attribute
  with a value of "Any".

- For filtering by more than one attribute:
  the product is visible if there's at least one variation that
  is visible for ALL the attributes according to the above rule.

Note that this is irrespective of the type of logic configured for
the filter (OR or AND).
2020-07-28 09:01:52 +02:00
Nestor Soriano 3fefe84a51 Fix: WC_Query()::adjust_posts_count failing when posts list is null. 2020-07-28 08:55:55 +02:00
Nestor Soriano c074f085cc Remove two phpcs:ignores, improve code instead 2020-07-28 08:55:55 +02:00
Nestor Soriano 9142e27a19 Adjustments in WC_Query::adjust_posts_count
Two adjustments were needed:

- Adjust the count even when there's no nav filtering in the query.
  This is necessary to present the proper products count.
  even when the woocommerce_product_is_visible filter is used.
- Account for the case where $GLOBALS['wp_query']->posts
  returns objects instead of ids (for example when viewing
  a product page).
2020-07-28 08:55:55 +02:00
Nestor Soriano 9de1306c21 Fix counters in nav filtering widgets for variable products.
After the change that registers variation attributes as terms
(in addition to reigstering them as post meta) it is now time
to modify the get_filtered_term_product_counts methods in
WC_Widget_Layered_Nav so that it works consistently for both
variable and non-variable products. The logic for the counters
is now as follows:

with OR operator:
- Simple products: count the attributes of all visible products
  (unchanged behavior).
- Variable products: count attributes corresponding to
  visible variations.

with AND operator:
- Simple products: count the attributes of visible products but only
  for products that have all the selected (unchanged behavior).
- Variable products: find all the products for which all the variations
  corresponding to the selected attributes exist and are visible,
  then count the attributes corresponding to the visible variations
  of those products.

A product is "visible" if it's published, not excluded for catalog,
and has stock. Additionally, a variable product will not be considered
visible if the parent product is not.
2020-07-28 08:55:55 +02:00
Nestor Soriano 9c6c0d73d8 Record attribute terms for product variations in wp_term_relationships.
Product attributes are currently recorded as terms in
wp_term_relationships (product attributes are actually taxonomies).
In the case of variable products this is true for the main product,
but not for the variations. The attributes used to define variations
are stored as post meta, but nothing is recorded in the term
relationships table.

This is a problem when using the layered nav filtering plugin,
since the attribute counters displayed are calculated based solely
on the contents of the term relationships table. Adding meta queries
would be really messy (especially when the widget is configured
with AND operator) and would probably also hurt performance.

This commit adds a change to store the attributes for variations
as term relationships, additionally to storing them as post meta.
Terms are stored on variation creation, and updated/deleted together
with the variation as appropriate. "Any" variations (stored in meta
as empty values) are not stored as terms.

Additionally, a database upgrade is included in order to backfill
terms for already existing products.
2020-07-28 08:55:55 +02:00