Fix encoding on a few HPOS docs (#46786)

* Fix encoding in some HPOS docs

* Update manifest
This commit is contained in:
Jorge A. Torres 2024-04-22 13:53:14 +01:00 committed by GitHub
parent aba7cb753b
commit a6222d6828
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 18 deletions

View File

@ -563,7 +563,7 @@
"post_title": "HPOS order querying APIs", "post_title": "HPOS order querying APIs",
"tags": "reference", "tags": "reference",
"edit_url": "https://github.com/woocommerce/woocommerce/edit/trunk/docs/high-performance-order-storage/wc-order-query-improvements.md", "edit_url": "https://github.com/woocommerce/woocommerce/edit/trunk/docs/high-performance-order-storage/wc-order-query-improvements.md",
"hash": "0e7d4f6ed88da1607aef79d72f2f8289ce3717f405f5e028b4be654654a80289", "hash": "e6a82fd1551296d1f104cb70921ecf13d63e04760ed2f24a3d57d4b2da2217e3",
"url": "https://raw.githubusercontent.com/woocommerce/woocommerce/trunk/docs/high-performance-order-storage/wc-order-query-improvements.md", "url": "https://raw.githubusercontent.com/woocommerce/woocommerce/trunk/docs/high-performance-order-storage/wc-order-query-improvements.md",
"id": "94261c0a5d954f409ce6c207c9ae624dd577cf64" "id": "94261c0a5d954f409ce6c207c9ae624dd577cf64"
}, },
@ -571,7 +571,7 @@
"post_title": "HPOS extension recipe book", "post_title": "HPOS extension recipe book",
"tags": "how-to", "tags": "how-to",
"edit_url": "https://github.com/woocommerce/woocommerce/edit/trunk/docs/high-performance-order-storage/recipe-book.md", "edit_url": "https://github.com/woocommerce/woocommerce/edit/trunk/docs/high-performance-order-storage/recipe-book.md",
"hash": "07491c9e8ee2dd78d7f242ad4cc8c3aa9a604837287a6af4eba85017c8d70951", "hash": "f5dc57939c8278a9de9a7ddd9fdd968ca672e998ba43a080a03203c499d98709",
"url": "https://raw.githubusercontent.com/woocommerce/woocommerce/trunk/docs/high-performance-order-storage/recipe-book.md", "url": "https://raw.githubusercontent.com/woocommerce/woocommerce/trunk/docs/high-performance-order-storage/recipe-book.md",
"id": "991c19edd20b1df6683f31f106d74689248cd102" "id": "991c19edd20b1df6683f31f106d74689248cd102"
}, },
@ -967,11 +967,6 @@
], ],
"categories": [] "categories": []
}, },
{
"category_slug": "utilities",
"category_title": "Utilities",
"categories": []
},
{ {
"content": "\nThis section covers general guidelines, and best practices to follow in order to ensure your product experience aligns with WooCommerce for ease of use, seamless integration, and strong adoption.\n\nWe strongly recommend you review the current [WooCommerce setup experience](https://woocommerce.com/documentation/plugins/woocommerce/getting-started/) to get familiar with the user experience and taxonomy.\n\nWe also recommend you review the [WordPress core guidelines](https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/) to ensure your product isn't breaking any rules, and review [this helpful resource](https://woocommerce.com/document/grammar-punctuation-style-guide/) on content style.\n\n## General\n\nUse existing WordPress/WooCommerce UI, built in components (text fields, checkboxes, etc) and existing menu structures.\n\nPlugins which draw on WordPress' core design aesthetic will benefit from future updates to this design as WordPress continues to evolve. If you need to make an exception for your product, be prepared to provide a valid use case.\n\n- [WordPress Components library](https://wordpress.github.io/gutenberg/?path=/story/docs-introduction--page)\n- [Figma for WordPress](https://make.wordpress.org/design/2018/11/19/figma-for-wordpress/) | ([WordPress Design Library Figma](https://www.figma.com/file/e4tLacmlPuZV47l7901FEs/WordPress-Design-Library))\n- [WooCommerce Component Library](https://woocommerce.github.io/woocommerce-admin/)\n", "content": "\nThis section covers general guidelines, and best practices to follow in order to ensure your product experience aligns with WooCommerce for ease of use, seamless integration, and strong adoption.\n\nWe strongly recommend you review the current [WooCommerce setup experience](https://woocommerce.com/documentation/plugins/woocommerce/getting-started/) to get familiar with the user experience and taxonomy.\n\nWe also recommend you review the [WordPress core guidelines](https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/) to ensure your product isn't breaking any rules, and review [this helpful resource](https://woocommerce.com/document/grammar-punctuation-style-guide/) on content style.\n\n## General\n\nUse existing WordPress/WooCommerce UI, built in components (text fields, checkboxes, etc) and existing menu structures.\n\nPlugins which draw on WordPress' core design aesthetic will benefit from future updates to this design as WordPress continues to evolve. If you need to make an exception for your product, be prepared to provide a valid use case.\n\n- [WordPress Components library](https://wordpress.github.io/gutenberg/?path=/story/docs-introduction--page)\n- [Figma for WordPress](https://make.wordpress.org/design/2018/11/19/figma-for-wordpress/) | ([WordPress Design Library Figma](https://www.figma.com/file/e4tLacmlPuZV47l7901FEs/WordPress-Design-Library))\n- [WooCommerce Component Library](https://woocommerce.github.io/woocommerce-admin/)\n",
"category_slug": "user-experience-extensions", "category_slug": "user-experience-extensions",
@ -1271,5 +1266,5 @@
"categories": [] "categories": []
} }
], ],
"hash": "05621c308414a34776d141252c0d0b8f618eaf28961758d3432e23e58ae5861d" "hash": "814c3cc3f8b107aa3e1c160a4dbf81c9d13ac7a14e1ee58d03f149d053217b35"
} }

View File

@ -90,7 +90,7 @@ $order->delete_meta_data( $meta_key_3, $meta_value_3 );
$order->save(); $order->save();
``` ```
💡 Calling the `save()` method is a relatively expensive operation, so you may wish to avoid calling it more times than necessary (for example, if you know it will be called later in the same flow, you may wish to avoid additional earlier calls when operating on the same object). **Note:** Calling the `save()` method is a relatively expensive operation, so you may wish to avoid calling it more times than necessary (for example, if you know it will be called later in the same flow, you may wish to avoid additional earlier calls when operating on the same object).
When getting exact type of an order, or checking if given ID is an order, you can use methods from `OrderUtil` class. When getting exact type of an order, or checking if given ID is an order, you can use methods from `OrderUtil` class.
@ -115,7 +115,7 @@ post_updated_messages|do_meta_boxes|enter_title_here|edit_form_before_permalink|
You will see a lot of false positives here as well. However, if you do encounter a usage where these methods are called for the order screen then to upgrade them to HPOS, the following changes have to be done: You will see a lot of false positives here as well. However, if you do encounter a usage where these methods are called for the order screen then to upgrade them to HPOS, the following changes have to be done:
Instead of a `$post` object of the `WP_Post` class, you will need to use an `$order` object of the `WC_Order` class. If its a filter or an action, then we will implement a similar filter in the new WooCommerce screen as well and instead of passing the post object, it will accept a WC_Order object instead. Instead of a `$post` object of the `WP_Post` class, you will need to use an `$order` object of the `WC_Order` class. If it's a filter or an action, then we will implement a similar filter in the new WooCommerce screen as well and instead of passing the post object, it will accept a WC_Order object instead.
The following snippet shows a way to add meta boxes to the legacy order editor screen when legacy orders are in effect, and to the new HPOS-powered editor screen otherwise: The following snippet shows a way to add meta boxes to the legacy order editor screen when legacy orders are in effect, and to the new HPOS-powered editor screen otherwise:
@ -179,4 +179,4 @@ As many WordPress extensions aren't WooCommerce related, WC will only display th
### New order querying APIs ### New order querying APIs
HPOS, through `WC_Order_Query`, introduces new query types that allow for more complex order queries involving dates, metadata and order fields. Head over to [HPOS: new order querying APIs](https://github.com/woocommerce/woocommerce/wiki/HPOS:-new-order-querying-APIs) for details and examples. HPOS, through `WC_Order_Query`, introduces new query types that allow for more complex order queries involving dates, metadata and order fields. Head over to [HPOS: new order querying APIs](https://developer.woocommerce.com/docs/hpos-order-querying-apis/) for details and examples.

View File

@ -3,9 +3,9 @@ post_title: HPOS order querying APIs
tags: reference tags: reference
--- ---
With the introduction of HPOS, weve enhanced the querying functionality in WC. Now, in addition to the well-known [existing APIs](https://github.com/woocommerce/woocommerce/wiki/wc_get_orders-and-WC_Order_Query), were adding a few features that would make it easier to create complex queries on orders or their properties, including the ability to query custom order metadata. With the introduction of HPOS, we've enhanced the querying functionality in WC. Now, in addition to the well-known [existing APIs](https://github.com/woocommerce/woocommerce/wiki/wc_get_orders-and-WC_Order_Query), we're adding a few features that would make it easier to create complex queries on orders or their properties, including the ability to query custom order metadata.
All the new query types are implemented as additional query arguments that can be passed to `wc_get_orders()` and are heavily inspired by similar functionality in WordPress own `WP_Query`. As regular query arguments, they can be combined with other arguments to produce complex queries that, until now, would have required writing custom code and SQL. All the new query types are implemented as additional query arguments that can be passed to `wc_get_orders()` and are heavily inspired by similar functionality in WordPress' own `WP_Query`. As regular query arguments, they can be combined with other arguments to produce complex queries that, until now, would have required writing custom code and SQL.
## The new query types ## The new query types
@ -19,11 +19,11 @@ At its core, `meta_query` is an array that can contain one or more arrays with k
`compare` (optional) an operator to use for comparison purposes such as LIKE, RLIKE, NOT BETWEEN, BETWEEN, etc. `compare` (optional) an operator to use for comparison purposes such as LIKE, RLIKE, NOT BETWEEN, BETWEEN, etc.
`type` to cast the meta value to a specific SQL type in the query `type` to cast the meta value to a specific SQL type in the query
The different arrays can also be combined using `relation` (which admits 'AND' or 'OR' values) to produce more complex queries. The syntax for this new argument is exactly the same as for WP_Querys `meta_query`. As such, you can refer to the [`meta_query` docs](https://developer.wordpress.org/reference/classes/wp_query/#custom-field-post-meta-parameters) for more details. The different arrays can also be combined using `relation` (which admits 'AND' or 'OR' values) to produce more complex queries. The syntax for this new argument is exactly the same as for WP_Query's `meta_query`. As such, you can refer to the [`meta_query` docs](https://developer.wordpress.org/reference/classes/wp_query/#custom-field-post-meta-parameters) for more details.
```php ```php
// Example: obtain all orders which have metadata with the "color" key (any value) and have metadata // Example: obtain all orders which have metadata with the "color" key (any value) and have metadata
// with key "size" containing "small" (so itd match "extra-small" as well as "small", for example). // with key "size" containing "small" (so it'd match "extra-small" as well as "small", for example).
$orders = wc_get_orders( $orders = wc_get_orders(
array( array(
'meta_query' => array( 'meta_query' => array(
@ -42,10 +42,10 @@ $orders = wc_get_orders(
### Order field queries (`field_query`) ### Order field queries (`field_query`)
This query type has a syntax similar to that of meta queries (`meta_query`) but instead of `key` youd use `field` inside the different clauses. Here, `field` refers to any order property (such as `billing_first_name`, `total` or `order_key`, etc.) which are also accessible as top-level keys in the query arguments as usual. The difference between directly querying those properties and using a `field_query` is that you can create more complex queries by implementing comparison operators and combining or nesting. This query type has a syntax similar to that of meta queries (`meta_query`) but instead of `key` you'd use `field` inside the different clauses. Here, `field` refers to any order property (such as `billing_first_name`, `total` or `order_key`, etc.) which are also accessible as top-level keys in the query arguments as usual. The difference between directly querying those properties and using a `field_query` is that you can create more complex queries by implementing comparison operators and combining or nesting.
```php ```php
// Example. For a simple query, youd be better off by using the order properties directly, even though there's a `field_query` equivalent. // Example. For a simple query, you'd be better off by using the order properties directly, even though there's a `field_query` equivalent.
$orders = wc_get_orders( $orders = wc_get_orders(
array( array(
'billing_first_name' => 'Lauren', 'billing_first_name' => 'Lauren',
@ -150,7 +150,7 @@ $orders = wc_get_orders( $query_args );
``` ```
```php ```php
// Obtain orders where the first name in the billing details contains "laur" (so itd both match "lauren" and "laura", for example), and where the orders total is less than 10.0 and the total discount is >= 5.0. // Obtain orders where the first name in the billing details contains "laur" (so it'd both match "lauren" and "laura", for example), and where the order's total is less than 10.0 and the total discount is >= 5.0.
$orders = wc_get_orders( $orders = wc_get_orders(
array( array(