Commit Graph

20605 Commits

Author SHA1 Message Date
James Collins 79dd557b77
Return true to indicate that authentication using this method was successful 2020-10-08 09:33:33 +08:00
Ron Rennick 175499b40a Merge branch 'master' into fix/27215 2020-10-07 15:59:19 -03:00
Ron Rennick 577494796c
Merge pull request #27736 from woocommerce/fix/27681
Update taxonomy template file names to `-`
2020-10-07 15:23:11 -03:00
Ron Rennick 24ec59cf26 fix merge conflict 2020-10-07 15:19:05 -03:00
Ron Rennick 67a54b3aa3
Merge pull request #27289 from woocommerce/fix/27222
use first gallery image on single product when image not assigned
2020-10-07 15:06:30 -03:00
Dominic Vermeulen-Smith c054a2803b issue #24631 - Updated needs payment check to use order 2020-10-06 17:38:07 +01:00
Knyazevich ce59afb2b9 Simplify drafts excluding logic (ref #24136) 2020-10-06 18:11:58 +03:00
Knyazevich f551c6c792 Exclude drafts from the "Shop page" select (ref #24136) 2020-10-06 06:42:56 +03:00
Ron Rennick ab4a46e32e
Merge pull request #27299 from woocommerce/fix/27116
allow variation image to be removed via REST API
2020-10-05 09:33:50 -03:00
rowayda_khayri 547451560c Add punctuation mark to function's docblock 2020-10-03 20:52:57 +02:00
sudoshreyansh dd9bf06594 Fixed </strong> closing tag position. Issue: #27839 2020-10-02 15:46:41 +05:30
Nestor Soriano 7485b9165f Convert optional-before-required arguments to required.
In PHP 8 required parameters after optional parameters in
function/method signatures trigger a deprecation notice. These type
of parameters are pointless since a value needs to always be
provided for them anyway, so they are actually de-facto required.

This commit converts all these not-so-optional parameters into
truly required parameters by removing their default values.
2020-10-02 09:45:09 +02:00
Nestor Soriano 53d33457e3 Fix code style/sniffer errors in a few files. 2020-10-02 09:34:09 +02:00
Nestor Soriano 52eed70f04 Add a 'NumberUtil' class with a 'round' method.
There's a number of places in the WooCommerce codebase where the
built-in function 'round' is executed passing a non-numeric value
(not a number and not a string that can be parsed as a number),
for example round(''). In PHP 7 this yields a value of 0, but in
PHP 8 this throws an error.

This commit adds a 'NumberUtil' class with a static 'round' method,
this method checks if the passed value is numeric and if so it just
executes the built-in function, otherwise it returns 0. And all the
calls to 'round' in the codebase are replaced with 'NumberUtil::round'.
2020-10-01 11:08:51 +02:00
Nestor Soriano b1e81d02da Fix code style/sniffer errors in a few files. 2020-10-01 11:08:51 +02:00
Jonathan Sadowski e540b4820e Rename maybe_enable_setup_wizard to maybe_set_activation_transients 2020-09-30 17:27:43 -05:00
Jonathan Sadowski 83238ec1d7 Move maybe_enable_setup_wizard abode update_wc_version so new install is detected 2020-09-30 17:01:43 -05:00
Jonathan Sadowski 95755cb59d Update the activation transient to only get added on new installs 2020-09-30 16:00:45 -05:00
Joshua Flowers 048c43a37f Add back in activation transient to redirect on install 2020-09-29 14:25:15 -04:00
Ron Rennick 802b364b05 Merge branch 'master' into fix/27681 2020-09-28 16:17:51 -03:00
Nestor Soriano f419335cdf Remove the migration to delete variation term relationships. 2020-09-28 09:35:13 +02:00
Milana Cap 7c184e5f25
Update class-wc-countries.php 2020-09-24 22:41:33 +02:00
vedanshujain c69e1f5799 Remove protection as we already diff and update only if needed.
In #26642 we removed adding reduced_stock meta when adding new order item to prevent ghost entries, but in inadvertently exposed an underlying bug where _reduced_stock meta was getting set to 0 if its emtpy.

We were then checking the presence of this meta, but also not reducing the stock in case it was not set.
2020-09-24 00:54:24 +05:30
Nestor Soriano 849a64d67c Add a data migration for removing term relationships related to variations
After the code that creates term relationships for variations has been
removed, a data migration is required to remove all the no longer needed
term relationships.

Also, the original migration that backfilled those relationships has
been removed (the migration function is kept but with an empty body).
2020-09-22 16:31:38 +02:00
Nestor Soriano a94ea7f51f Remove logic for storage of attribute terms for variations
A mechanism for improved filtering by attribute for variations was
introduced some time ago. This mechanism implied maintaining term
relationships for variations, where the terms were the attributes
that defined the variation.

The mechanism was reverted because it was complex and presented many
issues, but the code that created those term relationships was kept.
This pull request removes that code and the associated unit tests.
2020-09-22 16:31:06 +02:00
Rodrigo Primo c3a72b994a Fix version in which the setup wizard was deprecated
The setup wizard is going to be deprecated in WC 4.6.0 which should be
released soon. Some functions were marked as if they were deprecated in
WC 4.5.0 which is not the case.
2020-09-22 11:20:33 -03:00
Rodrigo Primo 51fd4af1b2 Remove call to __() from deprecation messages
Doing this as AFAIK we don't typically support traslation for
deprecation messages.
2020-09-22 11:18:43 -03:00
James Collins ce31260452
Return early if another plugin has already declared an auth failure 2020-09-22 16:17:35 +08:00
Claudio Sanches 3391d8c0b0
Merge pull request #27718 from woocommerce/bump-versions-to-4.7.0
Bump WC version to 4.7.0
2020-09-21 16:21:09 -03:00
Ron Rennick 6a36bce334 tweak logic to use `woocommerce/*-*` templates in theme folder 2020-09-21 14:12:22 -03:00
Ron Rennick bb6ded857d phpcs fixes 2020-09-21 13:34:14 -03:00
Ron Rennick 57fa6aff83 update taxonomy template names from `_` to `-` 2020-09-21 13:30:29 -03:00
Rodrigo Primo 6a641c4b1d Bump WC version to 4.7.0 2020-09-19 15:24:12 -03:00
Rodrigo Primo 7401982d37
Merge pull request #27047 from woocommerce/fix/26972
Removed Features settings and home screen option
2020-09-18 16:46:43 -03:00
Ron Rennick 9ae1ba92c6 remove WC_Admin_Setup_Wizard_Tracking from tracking classes 2020-09-18 15:26:18 -03:00
Ron Rennick 0735ed9f40 Merge branch 'fix/26173' of github.com:woocommerce/woocommerce into fix/26173 2020-09-18 15:23:08 -03:00
Ron Rennick 4b3b40d42e address feedback 2020-09-18 15:22:24 -03:00
Rodrigo Primo f3191907d9 Add missing line break 2020-09-18 14:25:25 -03:00
Ron Rennick 43051a0950 update deprecation versions to 4.6.0 2020-09-18 13:16:46 -03:00
Ron Rennick cca97599d7 only automatically create pages on new install 2020-09-18 13:10:11 -03:00
Ron Rennick 9915a5b142 merge master 2020-09-18 12:53:28 -03:00
Ron Rennick 6630f3fdba remove class accidentally added to PR 2020-09-18 12:41:57 -03:00
Rodrigo Primo d99053dbed Update version in @since tag of the woocommerce_should_send_no_stock_notification filter 2020-09-18 12:08:36 -03:00
Rodrigo Primo 8be6dc5b96
Merge pull request #27634 from jondcampbell/master
Added filter for no stock notification emails
2020-09-18 12:07:04 -03:00
Rodrigo Primo 60d6510cb0
Merge pull request #27685 from woocommerce/add/wp-env-type-to-wc-tracker
Added environment type var to WC tracker.
2020-09-18 11:30:35 -03:00
Rodrigo Primo 197e8d274c
Merge pull request #27616 from woocommerce/fix/26960
Paypal gateway: protect code against a fatal error if WooCommerce is unable to communicate with PayPal
2020-09-18 09:34:57 -03:00
Peter Fabian ed9c1e2f93
Update includes/class-wc-tracker.php
Co-authored-by: Claudio Sanches <contato@claudiosanches.com>
2020-09-18 14:30:39 +02:00
Dion Hulse 9440ec3570 Change __wakeup() to a public method to avoid PHP8 warning. 2020-09-18 07:55:26 +00:00
Claudio Sanches 29b8b0d60d
Merge pull request #27701 from woocommerce/fix/rest-api-package-tag
Fixed usage of package tag in REST API and templates
2020-09-17 18:45:14 -03:00
Claudio Sanches 153ce009de Fixed helper header 2020-09-17 16:50:17 -03:00
Claudio Sanches 3377c60c5e
Merge pull request #27433 from woocommerce/fix/remove-relative-include-paths
Change relative include paths to absolute include paths
2020-09-17 13:15:40 -03:00
Claudio Sanches f4e9fcc1a4 Fixed missing include 2020-09-17 13:12:57 -03:00
Claudio Sanches 70c7adfeb7 Fixed usage of package tag in REST API and templates 2020-09-17 11:56:08 -03:00
Claudio Sanches ed1a59b39b
Merge pull request #27416 from woocommerce/fix/27415
Fixed country list sorting
2020-09-17 10:35:43 -03:00
Konstantin Kovshenin a100ed67b2 Fix race conditions in WC_Install
In an environment with persistent object caching, concurrent calls
to delete_option() + add_option() can result in the option value
leaking out of the alloptions cache key, and into its own cache
item under the options group, while deleting the value from the
database.

This causes future function calls to add_option() to fail, since
the value already exists in cache (under the wrong key). It also
causes calls to delete_option() to fail, since the value is not
in the database.

This commit forces update_option() instead of the delete + add
combination, as well as removes multiple unnecessary calls to
update the woocommerce_db_version from admin notes and notices.
2020-09-17 11:59:50 +03:00
Peter Fabian b8670162a7 Added environment type var to WC tracker. 2020-09-16 13:44:36 +02:00
Anton Timmermans 723f14e44a
Improve bool <-> string conversion functions docs
These functions are polymorphic towards their input types to be more useful in more cases. Change the documentation to reflect this fact.
2020-09-13 13:01:14 +02:00
Rodrigo Primo 9bdafbeb18
Merge pull request #27219 from woocommerce/fix/filter-quantity-in-add_to_cart_handler_grouped
Filter quantity in add_to_cart_handler_grouped
2020-09-12 15:56:49 -03:00
Rodrigo Primo a24937556a
Merge pull request #27658 from woocommerce/update/4.6.0-dev
Prepare master for 4.6.0 development
2020-09-12 11:18:22 -03:00
Rodrigo Primo f345a1e0c8
Merge pull request #27615 from woocommerce/fix/26590
Fix bug when using tax classes with some non-ASCII characters
2020-09-11 14:48:10 -03:00
Rodrigo Primo d7b2207e75
Merge pull request #27610 from attitude/patch-1
Encapsulate scope of `c` variable
2020-09-11 14:27:06 -03:00
Rodrigo Primo fd25815a7c Prepare master for 4.6.0 development 2020-09-11 14:07:58 -03:00
Jon Campbell bb949ae474
simplifying filter usage
Switched to product id instead of product object
Moving the filter into the if condition instead of having a single use variable
2020-09-11 09:38:52 -07:00
Claudio Sanches b5d8d94bc8 Use reference in wc_asort_by_locale 2020-09-10 16:02:39 -03:00
jonathansadowski 2bcdbacc98
Merge pull request #27625 from woocommerce/revert-improved-filtering-for-variations
Revert improved filtering for variations
2020-09-10 12:42:15 -05:00
Nestor Soriano 4411a394dc Reintroduce adjust_posts_count, and remove unnecessary comment.
We can't remove that method since it's public, but its body has
been changed so that it just returns the input unchanged.
2020-09-10 15:17:43 +02:00
Jon Campbell 642b5b958e
Update class-wc-emails.php
removing whitespace to be coding standards compliant.
2020-09-09 16:32:12 -07:00
Jon Campbell 188f839e70
add no stock notification filter 2020-09-09 12:07:15 -07:00
Christopher Allford ae697f9fe2 Prevented zero from being considered empty when validating posted variation attributes 2020-09-09 11:29:31 -07:00
Nestor Soriano 70a1cb2f1f Revert improved filtering for variations.
This commit reverts the functionality introduced in PR #26260
(later refined by #27175, #27190, #27508) in which filtering by
attribute using the layered nav widget was improved to handle the
cases of variations out of stock. The revert is a response to the
numerous problems reported by users in Woo 4.4 and 4.5

Not all the code has been reverted, only the code that resulted in
visible functionality changes. Thus, the code that generates
term relationships for variations is still in place to keep database
consistency and to keep the reverting changes to the minimum needed.
2020-09-09 17:36:26 +02:00
Jonathan Sadowski 9da304e983 Update version in class-woocommerce.php 2020-09-09 10:35:05 -05:00
jonathansadowski d00083f1ec
Merge pull request #27628 from woocommerce/fix/27624
Check for state and postcode fields only if required
2020-09-09 09:41:57 -05:00
vedanshujain 7f2b322085 Check for state and postcode fields only if required
We were doing state and postcode even for countries where its not required, but unfortunately as an unintended effect we were ending up not checking shipping requirements if this was not met.
2020-09-09 18:21:14 +05:30
Rodrigo Primo 3aed780443 Paypal gateway: protect code against a fatal error
This commit changes the order of the error handling check to protect the code against a possible fatal error if wp_safe_remote_post() returns an instance of WP_Error().
2020-09-08 16:57:48 -03:00
Rodrigo Primo d50cd4389b Fix using tax classes with some non-ASCII characters
This commit fixes a bug that made it impossible to assign to a product a tax class that contained non-ASCII characters that are URL encoded by sanitize_title().

WooCommerce uses sanitize_title() to generate a slug when creating a tax class (d48f1d4e2e/includes/class-wc-tax.php (L808)). sanitize_title() converts some non-ASCII to ASCII equivalents (those handled by remove_accents()) and URL encodes others (like some Greek characters, for example).

The code was using wc_clean() to sanitize the tax class when the user edited a product. The problem is that wc_clean() removes URL encoded characters, changing the slug of some tax class, causing WooCommerce to use the standard tax class instead without any errors. To fix this issue, this commit replaces wc_clean() with sanitize_title(). This should be enough for security purposes and should not cause any issues with non-ASCII characters.
2020-09-08 16:00:56 -03:00
jonathansadowski 168698cd91
Merge pull request #27589 from woocommerce/enhance-query-for-filtering-attributes-with-any-value
Enhance the query for "Any" variations in filter by attribute widget
2020-09-08 11:58:54 -05:00
Martin Adamko c2ab6a488d
Encapsulate scope of `c` variable
By changing to auto invoking call the `c` variable will be encapsulated in its scope therefore not polluting the global scope and will continue to function as previously.

Fixes conflict and reassigning of already used variables when using other minified scripts. In my case the problem occurred with the Speed Booster Pack plugin.
2020-09-08 09:20:18 +02:00
Nestor Soriano 958ecf1d48 Fix the SQL query to count products in the filter by attribute widget
The previous query was counting variable products twice when they
had a variation with a concrete value for the attribute and also
a variation with "Any..." value for the same attribute.
2020-09-07 16:44:14 +02:00
Rodrigo Primo 12cc9ddf7c Merge branch 'master' of github.com:woocommerce/woocommerce 2020-09-05 11:16:09 -03:00
Rodrigo Primo 1694975910 Fix type of the WC_Query::$product_query property in the documentation 2020-09-05 11:14:57 -03:00
Rodrigo Primo be8dc533ff
Merge pull request #26957 from kevinruscoe/patch-3
Update types
2020-09-05 11:13:10 -03:00
Rodrigo Primo a582589449
Merge pull request #27008 from azzy9/master
Fix the error message shown for the max setting
2020-09-05 11:08:50 -03:00
KoolPal 41ea743a22
Update includes/class-wc-validation.php
Please proceed with your suggested changes. I cannot continue to debate this.

Co-authored-by: Claudio Sanches <contato@claudiosanches.com>
2020-09-04 14:12:23 +00:00
Nestor Soriano 43642f7835 Enhance the query for "Any" variations in filter by attribute widget.
The new query fixes a bug where variations were being counted twice:
if a product was included in both the queries then it would be counted
differently and added; e.g. when a product had two variations,
one with "Any" attribute and other with a attribute that has a value.

The new query also optimizes performance, so that filter conditions
can be improved and better indexes can be used.
2020-09-04 11:29:50 +02:00
James Collins 59a6c4b330
Authentication fallback if current user is set before WC is initialized
See Issue #26847
2020-09-04 15:55:12 +08:00
James Collins 958896545d
Merge branch 'master' into fix/26847-rest-api-auth 2020-09-04 14:05:14 +08:00
jonathansadowski 53c22ba4e4
Merge pull request #27508 from woocommerce/fix/27419
Fix filter by attribute widget now working for "Any..." attributes
2020-09-02 13:32:54 -05:00
Nestor Soriano 417bcf8fff Split the query for counting terms in the filter by attributes widget.
For performance reasons the query is split in two: one for simple
products and variations with a concrete attribute value, and another
one for variations having "Any..." as the attribute value.
2020-09-02 16:22:25 +02:00
Shiki ac4cba3fab Orders API: Fix regression in `meta_data` `display_*` values
Previously, we were using the `$formatted_meta_data` to build the final array.
However, this does not consider the fact that
`WC_Order_Item->get_formatted_meta_data` can exclude `meta_data` from the
result. There would be less `meta_data` objects return than the previous
implementation.

This fixes the issue by using the `$data['meta_data']` value as the main list of
meta data and only using `$formatted_meta_data` to optionally apply the
`display_key` and `display_value` properties.
2020-09-01 14:38:28 -06:00
Shiki 398076627a Orders API: Fix mismatched domain error 2020-09-01 14:37:55 -06:00
jonathansadowski 86f8788525
Merge pull request #27509 from woocommerce/fix/creating-variations-for-numeric-attributes
Fix "Create variations from all attributes" for numeric attribute values
2020-09-01 13:40:52 -05:00
Nestor Soriano 07b62dabbd Improve the query to retrieve "Any..."-attributed variations in filtering widget
The new query doesn't need empty attribute entries in the meta table,
therefore the code that generates them and the migration to backfill
the missing existing ones have been removed.
2020-09-01 16:47:41 +02:00
KoolPal 4fc66caadb
Updated - Added postcode validation for India
Updated from incorrect PR #27517
Postcode in India consists of 6 digit number.
Reference:
https://en.wikipedia.org/wiki/Postal_Index_Number
https://en.m.wikipedia.org/wiki/Address#India

Popular eCommerce sites in India use the same logic for Postcode:
Amazon India (https://www.amazon.in) & FlipKart (https://www.flipkart.com)

P.S. Please review as I am not very confident at a PR.
2020-09-01 11:21:06 +05:30
Nestor Soriano 53351fcc2f Update wc_product_attribute_uasort_comparison to accept null entries
When set_attributes is used on WC_Product to remove existing attributes
the wc_product_attribute_uasort_comparison ends up being called
with a null argument, and this breaks tests in PHP 7.4 since
null is used as an array. This commit modifies the function so that
if null is passed no array access is attempted.
2020-08-31 16:49:29 +02:00
Nestor Soriano 3a583feab1 Change filter by attributes widget to count products, not variations.
Right now the filter by attributes widget counts available variations
(for variation products). This is confusing since the counter shows
numbers that are higher than the actual count of products displayed.

This commit changes the query used by the widget so that instead
of counting variations it returns the parent product ids, and then
counts the distinct values. This also covers the case of products
where some of the variations have concrete values and some have
"Any..." values.
2020-08-31 12:22:33 +02:00
KoolPal 3f28df9150
Renamed Postcode / ZIP to Pin code & renamed State / County to State for India
Renamed Postcode / ZIP to Pin code & renamed State / County to State for India

Reference: https://en.m.wikipedia.org/wiki/Address#India
2020-08-29 14:19:33 +05:30
Ron Rennick bbdafb5cb1
Merge pull request #26196 from fitimvata/master
Add filter woocommerce_cart_item_required_stock_is_not_enough
2020-08-28 15:34:46 -03:00
Ron Rennick af162d8bed
Updated `@since` for the filter 2020-08-28 15:33:43 -03:00
Ron Rennick d998c6334d
Merge pull request #26976 from JoryHogeveen/patch-1
Public access to WC_Install::get_core_capabilities()
2020-08-28 15:12:51 -03:00
Ron Rennick a88cb8ab8e
Merge pull request #27437 from georgejipa/master
Remove the second occurrence of woocommerce_add_{$notice_type} filter
2020-08-28 14:10:43 -03:00