Commit Graph

64701 Commits

Author SHA1 Message Date
Corey McKrill 4d68cd486e
PluginUtil: Add method to get active valid plugins (#48709)
* PluginUtil: Add method to get active valid plugins

When getting a list of active plugins directly from the options table,
you can run into an error if you try to then access one of the plugin
files if it doesn't actually exist. WP Core has a method that verifies
that the files exist before returning the list. But it's marked as a
"private" method, which means it could change and break backcompat.
That seems very unlikely, though, so we're using the method (it was
already in use actually), but putting in some safeguards so we can
detect if a backcompat issue arises.

Fixes #48132

* Modify to accommodate multisite
2024-07-11 18:18:33 +01:00
Niels Lange 79786c5443
Revert #46362 (#49404)
* Revert #46262

* Remove pnpm-lock.yaml

* Revert "Remove pnpm-lock.yaml"

This reverts commit df4b87940d.

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

* Revert pnpm-lock.yaml

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-11 19:00:49 +02:00
Jorge A. Torres aeab61838c
Change case for CLIRunner namespace to meet autoloader expectations (#49390)
* Correct case in `CLIRunner` namespace

* Rename a few `@packages`

* Add changelog
2024-07-11 09:54:27 -07:00
Jorge A. Torres 21cc919094
Return HTTP 404 in REST API for non-existent product reviews (#48726)
* Return HTTP 404 when accessing non-existent product views via REST API

* Fix unit tests

* Add changelog

* Address feedback
2024-07-11 16:30:20 +01:00
Albert Juhé Lluveras ec95afc178
Fix sidebar attribute control in Products by Attribute block (#49351)
* Fix sidebar attribute control in Products by Attribute block

* Add changelog file

* Linting
2024-07-11 15:52:57 +02:00
rodelgc fa82f493f1
Remove extraneous tags in changelog entries (#49393) 2024-07-11 21:00:28 +08:00
Adrian Moldovan 3ff155182e
Fix Blocks e2e environment setup in release checks (#49379) 2024-07-11 15:45:30 +03:00
Vladimir Reznichenko 9fef18cd0d
CI: missing jobs on changes in components package. (#49330)
This PR addresses issues in building a CI jobs matrix (resolving dependent packages and running CI jobs for them).
2024-07-11 14:36:56 +02:00
Veljko V e049d93681
Fix flaky e2e merchant tests (#49381) 2024-07-11 15:31:57 +03:00
Mike Jolley d18a722501
Store API: Reduced number of recalculations on Store API cart routes (#48944)
* woocommerce_removed_coupon event should recalculate totals automatically

* Remove early calculation from cart routes

* get_cart_for_response ensures late calculation if needed

* Remove calculation when removing coupons

* Calc totals already does shipping

* Remove calc on checkout route

* Update cart controller to load session if needed and introduce new helper methods

* Changelog
2024-07-11 13:12:51 +01:00
Tung Du 6d6271260d
E2E: Fix flaky CYS logo picker tests (#49364)
* test: fix flaky cys logo picker e2e tests

* chore: changelog

* try: unfocus the input

* fix: use toHaveCSS to leverage auto waiting

* fix: duplicated Promise

* fix: blur is unnecessary
2024-07-11 14:04:37 +02:00
nigeljamesstevenson da4de031f0
Update stable tag to 9.1.0 (#49383)
Update readme.txt
2024-07-11 12:32:00 +01:00
Vladimir Reznichenko f8c0e6e02f
E2E: enable reporting slow blocks test. (#49367) 2024-07-11 12:21:59 +02:00
rodelgc ab21f5981f
Delete changelog file from #49370 (#49378) 2024-07-11 18:18:42 +08:00
Ivan Stojadinov 236fe48f97
Cherry-pick #303 into trunk (#49373)
* Improve mu-compatibility of `WC_Customer_Data_Store::get_last_order()`.

* Use the blog prefix as a suffix rather than a prefix (readability).

Co-authored-by: Corey McKrill <916023+coreymckrill@users.noreply.github.com>

* Extract site-specific user meta handlers into their own set of reusable methods.

* Make the customer data store's get_order_count and get_total_spent methods network-aware.

* Support deletion of site-specific user meta.

* Update cache invalidation (make multisite-aware) for money spent, order count, and last order.

* Further fixes for mu-aware order and spend caching.

* Add migration to remove unneeded/unused user meta data.

* Revert change to handling of `paying_customer` user meta (out-of-scope for this fix).

* Be stricter when obtaining current blog prefix.

* Add missing `@since` tag to historic filter hook.

Archaeology: https://github.com/woocommerce/woocommerce/compare/4.9.0...4.9.1#diff-8dcda80485fb4b7bc3cb9544ecf4b73aa78dc448bc574b1e56271ee8b56e7189R330

* Ensure the 'last order ID' references an order that actually belongs to the current customer.

* Fix docblock.

* Add additional test to describe safeguards around fetching a customer order.

* Unset `$last_order_id` if the order is not of type `WC_Order`

Co-authored-by: Corey McKrill <916023+coreymckrill@users.noreply.github.com>

* Merge 9.1.0 update functions list.

* Logging best practices (do not translate).

Co-authored-by: Corey McKrill <916023+coreymckrill@users.noreply.github.com>

* Logging best practices (do not translate).

Co-authored-by: Corey McKrill <916023+coreymckrill@users.noreply.github.com>

---------

Co-authored-by: barryhughes <3594411+barryhughes@users.noreply.github.com>
Co-authored-by: Corey McKrill <916023+coreymckrill@users.noreply.github.com>
2024-07-11 12:33:26 +03:00
Ivan Stojadinov fa693249db
Cherry-pick #331 into trunk (#49370)
* Wrap order note saving with wc_sanitize_textarea

* Add changelog

* Change note output to wp_kses with no allowed HTML

* Add totalsMock for order confirmation test

* Add Totals test

* Add classic checkout test to ensure notes are cleaned

* Change wp_kses_post to wp_kses for all order note usage

* wp_kses the order note before editing too

---------

Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2024-07-11 11:49:33 +03:00
Vladimir Reznichenko ba9f0a1625
Monorepo: set strict mode for WooCommerce plugin linting script. (#49366) 2024-07-11 09:18:23 +02:00
Néstor Soriano c4ddaef3bc
Optimize the method that gets the downloads count for a given download (#49008)
The old code was retrieving all the existing download entries from
the database and then counting them locally. Now a SQL COUNT query
is used instead.

---------

Co-authored-by: Naman Malhotra <naman03malhotra@gmail.com>
2024-07-11 09:14:24 +02:00
Caleb Mazalevskis 2a90d1e06b
Fix typo (index.tsx) (#49233)
* Fix typo (index.tsx)

"Congratuations" -> "Congratulations"

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: Paul Sealock <psealock@gmail.com>
Co-authored-by: github-actions <github-actions@github.com>
2024-07-11 11:24:11 +08:00
Nathan Silveira c16b5e578b
Add new unique ID to the classic product form (#49312)
* Update wc_update_product_lookup_tables_column function

* Rename error message

* Create 'form-flex-box' class and increase icon size

* Persist global_unique_id for main product and variations

* Add global unique id field to main product

* Add global unique id field to variations

* Add changelog

* Update error message
2024-07-10 20:06:29 +00:00
Daniel W. Robert e0d6c981ea
CYS: Add `rel="noreferrer"` to External Fiverr Link (#49314)
* Add `rel="noreferrer"` to external link

This is a precautionary security measure to to prevent the new page
from accessing the original page’s `window` object.

See pb22l9-304-p2 (internal link) for additional context.

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-10 15:41:48 -04:00
Jonathan Lane a50a2a95b0
Fix failing e2e tests on daily run (#49313)
* Fix inability to activate twentytwenty theme

* Fix linting error

* Fix command palette test

* Change locator for Gutenberg tests

* Revert locator — Gutenberg adds an iframe

* Use regex for command palette

---------

Co-authored-by: Jon Lane <jon.lane@automattic.com>
2024-07-10 13:26:08 -03:00
piinthecloud cae3937ee6
Revert move docs (#49354)
* revert moving docs to main folder ahead of issues with subcategories

* add changelog

* add changelog
2024-07-10 17:33:15 +02:00
piinthecloud ec82b3f08f
move checkout docs with front matter to main folder (#49186)
* move checkout docs with front matter to main folder

* add manifest

* add core changelog

* Remove emojis, unsupported links and table of contents

* pr comments

* update folder name and remove toc

* title fix

---------

Co-authored-by: Jacklyn Biggin <hi@jacklyn.dev>
2024-07-10 16:53:52 +02:00
Miguel Pérez Pellicer 39b8b23fc8
Fix order_count inconsistency between stats and reports (#49283)
* Fix order_count consistency between stats and reports

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-10 17:19:33 +04:00
Vladimir Reznichenko 4311640de2
Monorepo: caching deps per target package in GH actions (#49020)
In this PR, we are implementing per-package build and caching, which optimizes build and fetching cached dependencies times across our workflows.
2024-07-10 14:39:49 +02:00
Néstor Soriano f1399c9d77
Fix the namespace of the RestApiControllerBase class (#49333)
* Fix the namespace of the RestApiControllerBase class

* Add changelog file
2024-07-10 13:10:03 +01:00
github-actions[bot] de9664f922
Prepare Packages for Release (#49334)
Co-authored-by: opr <opr@users.noreply.github.com>
2024-07-10 12:34:32 +01:00
Thomas Roberts b94fd1127d
Register block in PHP and Add default opt in text when saving example block in `@woocommerce/extend-cart-checkout-block` (#48581) 2024-07-10 12:07:02 +01:00
Sam Seay eaf57e9f15
Create a separate bundle for cart and checkout (#48010) 2024-07-10 21:23:17 +12:00
Adrian Moldovan a862dab4f7
Disable Metrics job in CI (#49328) 2024-07-10 11:12:23 +03:00
Alba Rincón fb421397be
CYS - Bring back footer and header borders on hover and selected patterns (#49299)
* Bring back footer and header borders on hover and selected patterns

* Add changefile(s) from automation for the following project(s): woocommerce

* Fix the selected pattern color

* Fix lint errors

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-10 09:14:23 +02:00
Alba Rincón 620fd4efed
CYS - Update delete button copy to `Delete` (#49295)
* Update delete button copy to match Dotcom

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-10 09:13:55 +02:00
Alba Rincón c000a074be
CYS - Fix the intro cards size to match the designs (#49297)
* Fix the intro cards to match the designs

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-10 09:13:41 +02:00
Matt Sherman 2957458bac
Product Editor Dev Tools: Improved expression evaluation tooling (#48588)
* Refactor to extract ExpressionField

* Move styling of expression and result prefixes to CSS

* Layout expression field with grid

* Add buttons to expression field

* Enter edit mode and cancel

* Hook up editing in textarea

* Allow existing expression to be edited

* Make expression param optional

* Use ExpressionField to add new expression

* Hide cancel button if no callback and add updateLabel prop

* Only show error when dirty

* Placeholder for expression field

* Format result in expression field

* Expression field textarea styling

* Justify expressions at bottom

* Prevent jumping when editing expression

* Revert changes on cancel

* Remove unused CSS

* Extract ExpressionTextArea

* Extract ExpressionResult

* Auto height textarea

* Hover styling for expression

* Result type tag

* Tweak styling

* Update padding in expression field

* Changelog

* Enable scrolling of result when editing expression

* Use smaller close icon

* Fix enabling of add/edit button

* Focus text area when clicking edit button

* Put cursor at the end of text area when focusing it

* Enter edit mode when clicking on text area

* Remove expression in list

* Don't style expressions list as a flex box

* Show full result while editing expression
2024-07-09 14:05:39 -04:00
Mik 5948b0d822
Fix incorrectly escaped HTML (#49195)
* Fix incorrectly escaped HTML

* Add a changelog entry
2024-07-09 17:04:20 +01:00
Alex Florisca 56cc77fcef
Fix the mini cart items not being visible when zoomed in (#48384)
* Render an aria-label for the initial mini cart html

* FIx mini-cart items not visible when zoomed in

* Add changelog

* Fix linting issues

* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce

* Kick the GH actions

* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce

* delete duplicate changelog file

* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce

* Delete plugins/woocommerce/changelog/48384-fix-43639-zoom-mini-cart

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-09 16:47:21 +01:00
Néstor Soriano 99ae453ea3
Improve the handling of the deprecated WC()->api property (#48884)
* Improve the handling of the deprecated WC()->api property:

- When the legacy REST API plugin is not available, set the property
  to an instance of RestApiUtil. This object has the get_endpoint_data
  method that is still used by external plugins.

- Add a new legacy_rest_api_is_available method to WooCommerce class.

- Replace all instances of "is_null(WC()->api)" with (negated) calls to
  the new legacy_rest_api_is_available method.

- Make WC()->api point to an instance of LegacyRestApiStub, instead of RestApiUtil.

---------

Co-authored-by: Naman Malhotra <naman03malhotra@gmail.com>
2024-07-09 17:26:20 +02:00
Matt Sherman ff9656840d
Product Editor: Fix crash and issues with variations (that will cause problems with React 18) (#49248)
* Only request layout template when have an id

* Add setAttributes to useEffect dependency array

* Add ErrorBoundary around Tab inner blocks

* Style Tab ErrorBoundary

* Fix CSS specificity for .woocommerce-attribute-list-item styles

* Remove test CSS

* Add specific error boundary message

* Use variable for error boundary margin

* Changelog

* Tweak error message

* Changelog

* Tweak console error log message
2024-07-09 10:44:41 -04:00
Nathan Silveira fbf464be51
Add improvements to NumberControl, using it in Shipping dimensions and manage download limits (#49205)
* Add inputMode decimal to regular price and sale price fields and useNumberInputProps

* Change min and max numbers for NumberControl

* Allow typing minus in number

* Fix number control CSS issues in modals

* Allow providing elements as label and add onFocus handler

* Migrate manage downloads limits modal to NumberControl

* Migrate shipping dimension fields to NumberControl

* Add changelog

* Avoid passing NaN to onChange

* Move limits to individual fields

* Update max limits and add underscores for readability
2024-07-09 10:51:21 -03:00
jonathansadowski b8c2cf8cde
Update ci.yml to be dispatchable and skippable (#45331)
Co-authored-by: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
2024-07-09 16:50:57 +03:00
Chris Lilitsas a4ff1d01b3
[Product Collection] Track block instances and feature usage (#46466)
* add block parser and filters wip

* replace strings with template slugs and do some polish

* Refactor some parts to reused in wc_tracker

* Clean up and introduce snapshot data in the WC_Tracker

* Minor improvements

* Track only fse themes

* Consolidate collection names per context in the WC_Tracker snapshot

* Add changelog

* Separate taxonomy filter usage into specific category and tag usage

* Polish event params values

* Lint

* Remove wc-tracker to simplify the pr

* More cleanup

* Unify location names

* Handle stock status default value

* Renamed order confirm context

* Track price filter fix

* consider 3pd stock statuses in tracking

* Lint

* Consider the woocommerce_hide_out_of_stock_items option when tracking stock filter

* Cleanup empty lines

* Rename single product area flag

* Add docblock

* Avoid drafts and autosaves

* introduce a new class under tracking events

* Cleanup main controller

* Cleanup

* Add docblocks

* Stop recursive process up to 2 levels and cleanup

* Cleanup

* Ensure blocks exist

* Lint

* Normalize keys and values

* Track inherit and order-by usage

* Fix lint

* Add strict types

* add strict again

* Strict types

* Move strict types

* Remove codeblock

* Clean up

* Move directive on separate line

* Cleanup spaces
2024-07-09 16:46:04 +03:00
Christopher Allford 7d71e2235a
Product Collection: Redesigned Collection Insertion Selection (#48911)
* Updated Collection Selection Buttons

Rather than using normal buttons we're going to replace these with cards
that we want to use instead.

* Reworked Product Catalog Creation

* Added Dropdown Collection Option

* Changelog

* Added Collection Dashicon Support

* Fixed Collection Change Modal

This is going to get replaced soon but it may as well look nicer than it
does right now.

* Type Fix

* Fixed `:focus` Hover Border

* Simplified Click Handler

* Style Fixes

* Gutenberg Style Fixes

* E2E Fixes

* Fixed E2E Test

* Added Dropdown Inserter E2E Support

* Logging

* Fixed Default Insertion Options

* Prevent Premature Rendering

* E2E Fix Attempt

* Lint Fix

* E2E Fix

* Fix test chaking if custom registred collections are available in the collection chooser

* Improve logic of choosing collection to cover both dropdown and placeholder

---------

Co-authored-by: Karol Manijak <20098064+kmanijak@users.noreply.github.com>
2024-07-09 13:53:48 +02:00
Tom Cafferkey dacee984fa
Track the newly installed version in wp_options (#49139)
* Add initial install version to database

* Change update_option to add_option

* Add changelog

* Add since annotation

* Change initial_install_version option to initial_installed_version and also set autoload to false

* Add unit test for initial_installed_version

* Add unit test for initial_installed_version
2024-07-09 10:51:24 +01:00
martynmjones ab67891874
Exclude simple products from variations reports by default (#49244)
* Make use of simple products exclusion filter regardless of included products

* Add unit test

* Add changefile(s) from automation for the following project(s): woocommerce

* Update reports-variations.php: Remove since comment

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-09 10:48:05 +01:00
Albert Juhé Lluveras a5aef5f599
BlockTemplatesController: move all hooks into methods instead of being inline (#49182)
* BlockTemplatesController: move all hooks into methods instead of being inline

* Add changelog file
2024-07-09 11:36:43 +02:00
Vedanshu Jain 6d92aa9ccb
Load controllers only when needed for performance. (#47704)
* Load controllers only when needed for performance.

* Classify controllers based on their namespace and load selectively.

* Enable private namespace along with store api.

* Only prevent route loading when request is known for back compat.

* Lint fixes.

* Remove duplicate inclusion.

* Correctly load feature controller.

* Add since tag.

* Add unit tests.
2024-07-09 09:07:14 +00:00
Luigi Teschio fcb7f6798f
CYS: Fix pattern preview border color (#49206)
* CYS: Fix pattern preview border color when the user hovers the preview; fix pattern preview border color when the pattern is present in the site preview

* Remove the is-added class to avoid marking patterns that are already removed

* Add changefile(s) from automation for the following project(s): woocommerce

* Fix lint errors

* Fix lint error

---------

Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
Co-authored-by: github-actions <github-actions@github.com>
2024-07-09 09:12:33 +02:00
Vlad Olaru 0346ca618a
Fix Payments and APMs tasks logic and links (#46017)
* Link Payments task item to Overview if WooPayments is connected

* Link APMs task item to payments task page

* Add changelog for WooCommerce

* If WCPay is connected go to Payments Overview page

It shouldn't matter if the WCPay account is fully or partially onboarded.

* Fix determining if other gateways are enabled besides WCPay ones

Since UPE, WCPay registers multiple payment gateways, all prefixed with woocommerce_payments.

* Fix WooCommercePayments task kick-in logic

The WooCommercePayments task should supersede the general Payments task
when the general Payments task is not completed already and the store is in a
WooPayments supported country. We should not factor in if WooPayments is
just installed but not connected.

* Add changelog

* test: Fix Playwright tests for payment tasks

* test: Fix Playwright tests linting

* test: Further fixes to the Playwright payment setup task
2024-07-09 09:42:50 +03:00
Barry Hughes 97656a907d
Reduce potential for plugin conflict-driven fatal errors during (REST API-based) refund creation (#47918)
Introduce a method to help ensure values that have been filtered are still of the expected type.

Fixes #47601

* Reduce potential for plugin conflict-driven fatal errors during (REST API) refund creation.

* Parcel up return-type-assurance logic into its own reusable helper.

* Generalize the type checking helper.

* Do not replace existing WP_Errors.

* Do not translate logging messages, per current best practices.

Ref: d2bde1368a/docs/extension-development/logging.md (best-practices)

* Add test describing the behaviour of `Types::ensure_instance_of()`.

Note that the exception error code originally specified in the Types class was also removed: if we want this, it needs to be an integer rather than a string. However, we don't have a methodology or centralized registry for handling numeric error codes at present.

* Use ternary shorthand, not null coalescing.

* Add `@since` tag for hook `woocommerce_rest_pre_insert_<POST_TYPE>_object`.

Selected 4.5.0, as this is the point at which the (until then separate) REST API package was merged into WooCommerce Core.

* Avoid short ternaries.

* Strict types.
2024-07-08 16:30:25 -07:00