Commit Graph

20658 Commits

Author SHA1 Message Date
vedanshujain a5fb3178f0 Drop CacheHydration class and do it directly.
Primary reason for dropping the cache hydration is that seems like we can acheive the same results without it, so no need to add this additional complexity to our code.
2020-11-10 14:23:43 +05:30
vedanshujain 975783b2b4 Also support methods in case direct accessing key is deprecated.
For example, in case of refunds, directly accessing parent_id is deprecated, we should use get_parent_id instead.
2020-11-10 14:23:42 +05:30
vedanshujain 8ab9fd26ef Set key before trying to add values 2020-11-10 14:23:42 +05:30
vedanshujain d502407145 Use CacheHydration to speed up fetching Order data.
This also primes various caches by fetching data well in advance, this would have been individual SQL queries otherwise.
2020-11-10 14:23:42 +05:30
vedanshujain 44a226941d Refactor `read_meta` into filter_raw_data for better re-usability. 2020-11-10 14:23:41 +05:30
vedanshujain 4f514e79ad Add support to prime refund cache in wc_order class.
Fetching refunds call is an expensive query, so priming the cache where possible could be beneficial for better performance.
2020-11-10 14:23:41 +05:30
vedanshujain 9bd92205b0 Add support to use `cache_hydration` in wc_get_order.
This can be used to pre-load expensive to compute caches.
2020-11-10 14:23:40 +05:30
vedanshujain e9d97d97e7 Support for order_item to be init from obj with `order_item_id` prop.
Also set metadata cache if metadata prop is present in initial item.
2020-11-10 14:23:40 +05:30
vedanshujain 22212c7065 Add support for fetching order using a hydration object.
It will ultimately be on the datastore to effectively use the hydration object.
2020-11-10 14:23:40 +05:30
vedanshujain 4efc22f7d5 Refactor method to get individual class names for order and order-items.
This is done so that methods that fetch class names can be re-used.
2020-11-10 14:23:39 +05:30
vedanshujain f5d0275786 Refactor methods to break down into smaller units for re-usability.
This commit breaks down `read_meta_data` so that individual methods for cache key and setting raw meta data can be reused.

Also adds set_meta_data_from_raw_data to initialize metadata from manual cache.
2020-11-10 14:23:39 +05:30
Christopher Allford e711a447fe Fixed order account creation 2020-11-04 16:56:32 -03:00
Néstor Soriano 6e5cc0c2f2
Merge pull request #28052 from woocommerce/php8_tighten_non-strict_date_comparison
PHP 8.0 - Use strict comparison to compare post dates
2020-11-04 15:23:16 +01:00
Néstor Soriano 09e066fc6e
Update includes/data-stores/class-wc-data-store-wp.php
Update `@since` in new function to 4.8.0
2020-11-04 13:09:52 +01:00
James Allan 82b68b4914 Use strict comparison to compare post dates
With PHP 8.0, non-strict comparisons between integers and strings containing
non-numeric characters are being tightened. This affects comparisons like:

0 < '0000-00-00 00:00:00'

PHP 8.0 that equates to true whereas prior to 8.0 it would be false.

More details of this change can be found at: https://wiki.php.net/rfc/string_to_number_comparison
2020-11-02 11:10:30 +10:00
jozeflambrecht 6c86950075
Update class-wc-validation.php
Add support for validation BE postcodes

https://github.com/woocommerce/woocommerce/issues/28144
2020-10-29 19:11:36 -04:00
Rodrigo Primo e38d0dfdb1
Merge pull request #28005 from woocommerce/fix/issue-27945
Replace jQuery.ready function with recommended way since jQuery 3.0 c…
2020-10-29 18:06:02 -03:00
Rodrigo Primo b612c4f041
Merge pull request #28064 from woocommerce/fix/27087
Improves i18n of string displayed during checkout
2020-10-29 17:55:02 -03:00
Néstor Soriano 604958c4a8
Merge pull request #28103 from woocommerce/fix/issue-27756
Fix/issue 27756
2020-10-28 10:06:55 +01:00
Roy Ho 5007d17596
Merge pull request #27514 from helgatheviking/has_options
Add woocommerce_product_has_options filter to has_options() method
2020-10-27 09:48:26 -07:00
roykho 4abdf2d78b
Remove underline tag and allow themes to style to their liking 2020-10-27 09:10:13 -07:00
Roy Ho 99fcafee8f
Merge pull request #28027 from woocommerce/pp_response_check_for_cart
Check the cart exists before emptying it after handling PayPal response
2020-10-27 08:54:56 -07:00
roykho 3b022be68b
Prevent variable product from adding to cart when no variations are selected closes #27756 2020-10-26 11:21:28 -07:00
Shiki 94ecfcab34 Orders API: Add parent_name to schema 2020-10-26 13:28:04 -03:00
Shiki 48d595ed71 Orders API: Reorganize and place parent_name in a separate section 2020-10-26 13:28:04 -03:00
Shiki 52739ba9ee Orders API: Add parent_name to line_items for variable products 2020-10-26 13:28:04 -03:00
Claudio Sanches 19e4c7ac7c
Merge pull request #28094 from woocommerce/revert/27289
Revert changes introduced in #27289
2020-10-26 12:39:11 -03:00
Roy Ho c96a642e8a
Merge pull request #28067 from woocommerce/fix/27529
Fix: use the correct parameter when calling get_avatar()
2020-10-26 07:46:51 -07:00
Claudio Sanches c5ff759d61 Revert changes introduced in #27289 2020-10-26 10:26:29 -03:00
Rodrigo Primo 80c3f343a4
Merge pull request #28062 from PlexusLLC/fix-sorting-capability
Fix incorrect capability for product sorting link
2020-10-24 15:10:00 -03:00
Rodrigo Primo 1b40e13f99
Merge pull request #27856 from sudoshreyansh/fix/27831
Fixed update term message. Issue: #27831
2020-10-24 14:57:06 -03:00
Rodrigo Primo 92153ac3b3
Merge pull request #27723 from alexstewartja/master
Introduced fine-grained cultural adaptation for Jamaican-based WooCommerce stores
2020-10-24 14:44:07 -03:00
Rodrigo Primo 3ed300a4aa
Merge pull request #27607 from wpdesk/bugfix/cart-weight-float
Fixed cart weight return type.
2020-10-24 14:12:03 -03:00
Claudio Sanches 1427a39be1
Merge pull request #28074 from shahlin/master
Minor docblock grammar/typo/casing fixes
2020-10-23 17:33:41 -03:00
Roy Ho ecd08277f9
Merge pull request #28070 from NicholasMacedo/patch-1
Update class-wc-product-variable.php
2020-10-23 13:12:04 -07:00
Shahlin Ibrahim e06466b2b7 Minor docblock grammar/typo/casing fixes 2020-10-23 17:27:39 +04:00
Nicholas Macedo 815fd01a98
Update class-wc-product-variable.php
Fix the typo on line 416 according to Issue  #28066
2020-10-22 20:37:36 -04:00
Rodrigo Primo 09faf8ba84 Fix: use the correct parameter when calling get_avatar()
`WC_Admin_Dashboard::recent_reviews()` was calling `get_avatar()` passing `$comment->comment_author` which is not one of the list of parameters that the function accepts to get the avatar. As a result, the widget that displays the recent reviews in the admin dashboard was never displaying the avatar of the user that left the review. This commit fixes this issue by passing `$comment->comment_email` instead. I opted to use `$comment->comment_author` as it should be available for reviews left both by authenticated and anonymous users and because getting the comment object wouldn't be so simple (either we need to perform an extra query for each review or deprecate the `woocommerce_report_recent_reviews_query_from` filter).
2020-10-22 17:43:59 -03:00
Rodrigo Primo e91872c1a8 PHPCS fixes 2020-10-22 17:34:47 -03:00
Rodrigo Primo 6bde9fd8a5 Replace WPCS deprecated syntax
Using the WPCS native whitelist comments is deprecated. So this PR just replaces all instances of `// WPCS: XSS ok.` found in `includes/wc-cart-functions.php` with the PHPCS native "// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped". I found this while working on another issue in the same file.
2020-10-22 16:03:34 -03:00
Rodrigo Primo 4e5fb5724c Improves i18n of string displayed during checkout
This commit improves the i18n of a string displayed during checkout showing the total amount of the order when the store is configured to display prices inclusive of taxes.

Before string concatenation was used to build the final string which is almost always a bad practice from i18n point of view (https://codex.wordpress.org/I18n_for_WordPress_Developers#Best_Practices). This commit uses sprintf() and two separate strings to make translation easier.
2020-10-22 15:38:07 -03:00
pjv f03bfb85da Fix incorrect capability for product sorting link
Fixes #28049
2020-10-22 13:03:35 -05:00
James Allan b1a2fa01a6 Check the cart exists before emptying it after PayPal response 2020-10-21 10:32:37 +10:00
Claudio Sanches f7ecbbeb35 Prepare default branch to 4.8 2020-10-20 15:20:52 -03:00
Claudio Sanches 631c06020c
Merge pull request #27800 from gbiorczyk/fix/field-label-escaping
Escaping output for field label
2020-10-19 20:26:38 -03:00
roykho 8c73c5f2f8
Replace jQuery.ready function with recommended way since jQuery 3.0 closes #27945 2020-10-19 06:47:55 -07:00
Rodrigo Primo 0a81188e42
Merge pull request #27987 from woocommerce/php8/fix-required-parameters-after-optional-take-2
[PHP 8] Convert optional-before-required parameters into required parameters (take 2)
2020-10-17 09:42:20 -03:00
roykho e8bcd464db
Update escape based on suggestion 2020-10-16 06:00:34 -07:00
Nestor Soriano 63ced34e2d Convert optional-before-required arguments to required (take 2)
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-16 13:08:31 +02:00
roykho 800cbdbc7e
Add missing escapes 2020-10-15 16:31:56 -07:00