* Remove usage of `prepare_item_for_response` function
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Detect Legacy Template block when it's inside a pattern
* Detect Single Product blocks when they are inside a pattern
* Typo
* Remove empty error messages
* Fix wrong variable passed to parse_blocks()
* Remove unnecessary parameters
* Add tests to check if the Single Product template contents are updated when the Legacy Template is in the content
* Add changelog file
* Linting
* Typo
* Make sure the correct template is used when deciding whether to disable the compatibility layer or not
* Simplify code
* Remove duplicate content in tests
* Simplify single product slug logic
* Add an extra test to make sure Single Product template logic doesn't leak into other templates
* Linting
---------
Co-authored-by: Sam Seay <samueljseay@gmail.com>
The support for such property was removed in woocommerce/woocommerce-admin#4858 ~4 years ago.
Co-authored-by: github-actions <github-actions@github.com>
* Remove title attribute from images in product gallery
* Remove wp-post-image class from image selector
* Scope the image locator to the link
* Add changelog file
* Move image params filter out of wp_get_attachment_image call
* Add docblock to the woocommerce_gallery_image_html_attachment_image_params filter
* Remove unnecessary empty space
* Set the regular price when the `Change to:` price is left empty
* Avoid fatal error when price is empty
* Add changefile(s) from automation for the following project(s): woocommerce
* Add e2e test
* Fix lint errors
---------
Co-authored-by: github-actions <github-actions@github.com>
* CYS - Move the ai/store-title endpoint to woocommerce admin api
* Add middleware and callback
* Add changefile(s) from automation for the following project(s): woocommerce
* Fix lint error
* CYS - Move the ai/business-description endpoint to woocommerce admin API
* CYS - Move the ai/store-info endpoint to woocommerce admin API
* Update endpoint
* CYS - Move the ai/images endpoint to woocommerce admin API
* CYS - Move the `ai/patterns` endpoint to woocommerce admin API
* CYS - Move the `ai/product` endpoint to woocommerce admin API
* CYS - Move the `ai/products` endpoint to woocommerce admin API
* CYS - Move the `private/patterns` endpoint to woocommerce admin API
* Remove unnecessary variable
* Replace endpoint
* Add changefile(s) from automation for the following project(s): woocommerce
* Fix lint errors
* Fix some feedback
* Refactor route to return an error not an exception and add tests
* Fix lint errors
---------
Co-authored-by: github-actions <github-actions@github.com>
* Ensure translation is loaded for new shared file
* add other files
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
* Revert "PluginUtil: Add method to get active valid plugins (#48709)"
This reverts commit 4d68cd486e.
* Reintroduce get_all_active_valid_plugins public function after revert (#50885)
Retroduce get_all_active_valid_plugins public function after revert
---------
Co-authored-by: Naman Malhotra <naman03malhotra@gmail.com>
* Fix typo
Fixed one typo
* Create reviews-guidelines.md
Creating the first draft of the Operation Star guidelines for partners to improve reviews and ratings.
* Adding more info and feedback!
adding info from https://wooengineering.wordpress.com/2024/07/30/closing-the-loop-enhancing-product-reviews-through-integrated-feedback/
* Update docs manifest
* Update menu_title for consistency
* Standardize language + remove unsupported characters from review doc
* Atomize review docs into subcategory + subpages
* Fix linting issues
* Update docs manifest with linter fixes
---------
Co-authored-by: Jacklyn Biggin <hi@jacklyn.dev>
* Add additional size units to product image element
* Add changefile(s) from automation for the following project(s): woocommerce-blocks
---------
Co-authored-by: github-actions <github-actions@github.com>
* Store API: Add test coverage for Product Reviews endpoint
* Add changelog file
* Use assertSame() instead of assertEquals()
* Linting
* Fix category_id param test
* CYS - Move the ai/store-title endpoint to woocommerce admin api
* Add middleware and callback
* Add changefile(s) from automation for the following project(s): woocommerce
* Fix lint error
* CYS - Move the ai/business-description endpoint to woocommerce admin API
* CYS - Move the ai/store-info endpoint to woocommerce admin API
* Update endpoint
* CYS - Move the ai/images endpoint to woocommerce admin API
* CYS - Move the `ai/patterns` endpoint to woocommerce admin API
* CYS - Move the `ai/product` endpoint to woocommerce admin API
* CYS - Move the `ai/products` endpoint to woocommerce admin API
* Add changefile(s) from automation for the following project(s): woocommerce
* Add changefile(s) from automation for the following project(s): woocommerce-beta-tester, woocommerce
* Add changefile(s) from automation for the following project(s): woocommerce
* Fix merge issues
* Add strict types
* Start extending from AIEndpoint
---------
Co-authored-by: github-actions <github-actions@github.com>
* Update core profiler setup e2e to handle coming soon mode
This adds a new test to confirm that the store is in coming soon mode after completing the core profiler. Additionally, it adds a new test to confirm that the store is in coming soon mode after skipping the core profiler.
These changes are necessary to ensure that the core profiler setup works correctly when the store is in coming soon mode.
* Add changefile(s) from automation for the following project(s): woocommerce
* Include coming soon test case in core profiler steps
---------
Co-authored-by: github-actions <github-actions@github.com>
* Use stricter text selector
Removes text ambiguity to avoid errors like "Strict mode violation resolved to 2 elements". For instance, it might search for "Settings", and there might be a menu "Foo Settings" which would resolve to 2 elements. This changes the behavior to match the exact test, instead of a substring.
* Update page-loads.spec.js
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: github-actions <github-actions@github.com>
This ensures the WC() session object is initialized before attempting to
get chosen shipping methods. If it's not initialized,
`wc_get_chosen_shipping_method_ids` will return an empty array.
Fixes#50283
- Add code docs to the Analytics classes and make get_order_statuses non-internal.
Document analytics classes and some methods. Add simple examples of how to use it. Give a brief "why?" and "when?" answers. Add links between related classes.
- Replace `Automattic\WooCommerce\Admin\API\Reports\*\Query` classes with a single `GenericQuery` class.
- Reduce the amount of duplicated code in Analytics `DataStore`s.
- Reduce duplicated code in Analytics controllers
- Add `FilteredGetDataTrait`, `OrderAwareControllerTrait`, and `StatsDataStoreTrait` for extension developers to reuse while creating custom Analytics
- Add a `GenericQuery` to reduce duplicated code in Query classes.
Also, to expose it to community extensions for reuse.
- Use `GenericQuery` instead of duplicated `Query` classes
- Move caching code to shared `DataStore::get_data`
- Move intervals specific `initialize_queries` to shared Trait
- Move intervals checking logic to shared `StatsDataStoreTrait`
- Reuse `GenericController::prepare_item_for_response` for `Reports\Controller` subclasses
- Reuse `GenericController::get_collection_params` for `Reports\Controller` subclasses.
- Move `get_items` code to shared `GenericStatsController`
- Move shared paginable controllers `get_items` code to the generic class
- Move fields param to `GenericStatsController`
- Separate `OrderAwareControllerTrait` from `ReportController`
to allow specific Analytics Controllers to extend the `Generic(Stats)Controller` directly, without extending the `ReportController`, which is used to list reports.
It's meant not to change any behavior. However, due to unification, it did tweak a few things mostly from the developer perspective:
- Previously, only some controllers threw an error from `get_items` when the data was missing; some did not. Now controllers the following Controllers changed behavior to also for such an error:
- Coupons
- Customers
- Downloads
- Orders
- Products
- Taxes
- the error has one error code from all controllers:`woocommerce_rest_reports_invalid_response` (previously there were report-specific)
- `woocommerce_rest_reports_categories_invalid_response` -> `woocommerce_rest_reports_invalid_response`
- In Orders Controller, the `$orders_data['order_number'], $orders_data['total_formatted']` are set in the `prepare_item_for_response` method, not in the `get_items`So `prepare_item_for_response` function is expected to be called with bare data from Query
- In Products Controller extended-info is now sanitized in the `prepare_item_for_response` method, not in the `get_items`
- ⚠️ (breaking) Previosly some Controlers' `prepare_item_for_response` function was getting and expecting first argument to be casted to `object`, while the rest of controllers used data as returned from the Store. This PR unifies this behavior for
- `Coupons\Stats\Controller`
- `Taxes\Controller`
- `Taxes\Stats\Controller`
So, if you extend those classes and override `prepare_item_for_response` in a way that expects `object`, you will get an error. (I have not found such cases in the `all-plugins` repo.)
All `woocommerce_rest_prepare_report_*` filters remain intact and inconsistent for backward compatibility.
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Mik <mikkamp@users.noreply.github.com>
* Fixed minor issues with recently added snippets docs
Fixed a few duplicate titles and encoding issues in the docs that were recently added via public resources.
* Create docs-check_payment_method_support
* update manifest
* fix linter errors
---------
Co-authored-by: Yaku <15178758+jacoswan@users.noreply.github.com>
* CYS - Move the ai/store-title endpoint to woocommerce admin api
* Add middleware and callback
* Add changefile(s) from automation for the following project(s): woocommerce
* Fix lint error
* CYS - Move the ai/business-description endpoint to woocommerce admin API
* CYS - Move the ai/store-info endpoint to woocommerce admin API
* Update endpoint
* CYS - Move the ai/images endpoint to woocommerce admin API
* CYS - Move the `ai/patterns` endpoint to woocommerce admin API
* CYS - Move the `ai/product` endpoint to woocommerce admin API
* Add changefile(s) from automation for the following project(s): woocommerce
* Remove import
* Add changefile(s) from automation for the following project(s): woocommerce-beta-tester, woocommerce
* Add changefile(s) from automation for the following project(s): woocommerce
* Add strict types
* Extract AI_CONTENT_GENERATED constant
* Move instance creating to where it's used
* Add try/catch and fix the on Patterns
* Use the base AIEndpoint class
* Fix endpoint
* Update comment return type
* Fix comments
---------
Co-authored-by: github-actions <github-actions@github.com>