* Check if WordPress version is higher than 6.2.2 to make Products block compatible with Gutenberg 16+
* Extract the logic of checking the post template support for grid view toi separate function
* Change the versions comparison and improve description of custom version compare function
* Remove opinionated font styles and sizes from the Large Footer pattern.
* Ensure the year is dinamically changed in the footer.
* Make string translatable
* Update translation to include the WooCommerce brand.
* Register order route
* Check authorization for getting the order
* Add order data to the response
* Add order schema for the endpoint
* Move validation check to order controller
* Add order item schema
* Check if the order is associated with current user
* Fix after rebase
* Add checkout order endpoint
* Add order authorization trait
* Allow to use the order update customer endpoint in dev build only
* Get both customer and guest details
* Remove duplicate function
* Update the cart update customer class doc block
* Remove duplicate order route
* Update documentation for feature flags
* Add checkout trait
* Remove checkout trait
* Update billing address and order
* Only allow checkout pending orders
* Create checout trait
* Use sanitize text field
* Extend from checkout schema
* Update response message
* Allow failed orders to be paid for
* Update authorization error message
* Introduce the new Featured Products: Fresh & Tasty pattern.
* Update lettuce image.
* Update indentation.
* Make all strings translatable.
* Align all prices right
* Ensure text doesnt stack on mobile
* Update mobile display for the prices
* Update mobile display for the product names
* Remove the image id and the text styles
* Remove custom font color from the cover block.
* Update indentation for the Featured Category Triple pattern.
* Update indentation for the third column
* Make all strings translatable.
* replate all paragraph blocks with a wp-block-heading
* Ensure the central text is also white
* replace the buttons with a paragraphs.
* Remove unnecessary styles from wp:column
* Remove more unnecessary styles from wp-block-cover
* Remove the has-text-color class and other unnecessary positioning styles
* Update headings from h4 to h3 and update the paragraph styles.
* Replate theme's has-base-color with has-white-color
* Show alignment toolbar also when the block is in the single product block
* Start using `Single Product` for the `Product Details Product Listing` pattern
* Use counter and stars blocks in the pattern
* Undo button change
* Make the new rating blocks not experimental
* Add Beta to the average rating block
* Add blocks to block types controller
* Add missing page titles to the Cart and Checkout templates
* Adjust headline level
* Add i18n support for Cart and Checkout template titles
* Keep empty line between “wp:group” and “wp:template-part”
* Add empty line between “wp:template-part” and “wp:group”
* Add PHPUnit tests for the ProductCollection block type
This commit introduces PHPUnit tests for the ProductCollection block type. A new test file, `ProductCollection.php`, has been added under the `BlockTypes` directory within the tests. The test file sets up a mock instance of `ProductCollection` and verifies its behavior. Particularly, it tests the merging of on-sale queries, ensuring the results are as expected.
To assist in the testing, a new mock class, `ProductCollectionMock`, has been created under the `Mocks` directory. This class extends the `ProductCollection` block type and provides methods for setting parsed block data and attribute filter query arguments.
These tests should help ensure the correctness and reliability of the `ProductCollection` block type.
* Expand PHPUnit tests for ProductCollection block to cover stock status queries
This commit expands the existing PHPUnit tests for the ProductCollection block type to cover scenarios involving stock status queries. Specifically, a new test method, `test_merging_stock_status_queries`, has been added.
This method tests if the 'woocommerceStockStatus' attribute is correctly merged into the query parameters. It verifies that the stock status is correctly incorporated into the 'meta_query' array as part of the constructed query.
This addition enhances the coverage of our test suite, ensuring that the ProductCollection block behaves as expected in scenarios involving stock status queries.
* Add extensive testing for ProductCollection block's query merging
The following test methods were added:
1. `test_merging_default_stock_queries`: This tests the merging of default stock queries, verifying the absence of meta_query in certain conditions.
2. `test_merging_attribute_queries`: This tests the merging of attribute queries, ensuring the correct taxonomy and terms are used in the merged tax_query.
3. `test_merging_order_by_rating_queries` and `test_merging_order_by_popularity_queries`: These test the merging of order by queries, checking for the right orderby and meta_key in the merged query.
4. `test_product_visibility_query_exist_in_merged_query`: This tests if the product visibility query exists in the merged query.
This additional testing improves the reliability and coverage of our tests, ensuring the correct functionality of the ProductCollection block's query merging process.
* Add unit tests for merged queries in ProductCollection block
- Merging multiple queries
- Merging filter by max price queries
- Merging filter by min price queries
- Merging filter by min and max price queries
- Merging filter by stock status queries
- Merging filter by attribute queries
- Merging multiple filter queries
These tests use PHPUnit assertions to validate the correctness of the merged queries.
* Add tests for REST query modifications in ProductCollection block
This commit adds two new test cases and a helper method to the `ProductCollection` test class.
The helper method, `build_request()`, constructs a simplified `WP_REST_Request` object for testing purposes. This request object simulates a typical request from the ProductCollection block, including potential WooCommerce parameters such as 'woocommerceOnSale', 'woocommerceAttributes', and 'woocommerceStockStatus'.
The first new test, `test_updating_rest_query_without_attributes()`, tests the block's capability to modify a REST query that doesn't include any product attribute filters. It verifies that the correct '_stock_status' and 'product_visibility' parameters are set in the meta and tax queries respectively.
The second test, `test_updating_rest_query_with_attributes()`, does the same as the previous one but with the inclusion of a product attribute filter in the REST request. This test verifies that the block can handle REST queries with attribute filters correctly.
These tests improve coverage on the ProductCollection block's REST query handling, ensuring that it can merge different filter queries correctly.
* Add test for merging taxonomies query in ProductCollection block
This commit introduces a new test, `test_merging_taxonomies_query()`, in the `ProductCollection` test class.
The test simulates a situation where the block has to merge taxonomy queries related to product categories and tags. The parsed block attributes are configured to include 'product_cat' and 'product_tag' taxonomies with certain term IDs.
The test then asserts that the merged query correctly includes these taxonomies with the appropriate term IDs and 'include_children' set to false. This confirms that the block correctly merges taxonomy filters when building the final query.
* Fix failing test
* Try again
* Try again
* Remove test_merging_filter_by_attribute_queries test
This commit removes the `test_merging_filter_by_attribute_queries()` test from the `ProductCollection` test class.
* Add option to manually update Products block to Product Collection
* Disable manual upgrade of Products yet
* Manual update flag doesn't have to be dependant on auto update
* Removed commented out console info logs
* Disable option to upgrade Products block
* Change the way to bold text in Upgrade Notices so it's translatable
* Change the way UpgradeNotice is rendered conditionally
* Register order route
* Get order it
* Add order schema
* Check authorization for getting the order
* Add order data to the response
* Add order schema for the endpoint
* Move validation check to order controller
* Update the error codes
* Add order item schema
* Check if the order is associated with current user
* Update order schema to match cart schema
* Update order item schema to match cart item schema
* Add product item trait
* Update sold individually property
* Allow guests to pay for order
* Update wording for logged out customers
* Allow getting all orders from the endpoint
* Add inline explanation for pay_for_order capability
* Remove unused $user_id and $order variables
* Remove duplicate pay_for_order capability check from validate_order_key
* Update exception wording when missing order id or key, or user mismatch
* Ensure $order_key is not null to avoid fatal error when left blank
* Resolve linting errors in order route class
* Adjust order ID description
* Create an abstract item schema
* Remove unused properties
* Remove unused properties
* Add billing email validation
* Allow to use the order endpoint in dev build only
* Add order status property
* Fix coupon and fee handling
* Update documentation for feature flags
* Update typo in total fees tax
* Update typo in tax lines
* Add missing payment methods to cart response
---------
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Remove styles from `Newest arrivals` pattern
* Remove id
* Replace row with columns to be able to stack blocks on mobile
* Make string translatable
* Make button string translatable