Wp wc product attribute term list: verschil tussen versies

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
Regel 91: Regel 91:
 
== Examples ==
 
== Examples ==
  
Just
+
Only
 
<pre>
 
<pre>
 
wp wc product_attribute_term list
 
wp wc product_attribute_term list
</code>
+
</pre>
  
does nothing: A product attribute taxonomy ID is compulsory. Retrieve those with
+
does nothing: A product attribute taxonomy ID is compulsory.
  
Voorbeeld (taxonomy 29):
+
Retrieve product attribute taxonomy IDs through
 +
 
 +
<pre>
 +
$ wp --user=4 wc product_attribute list
 +
 
 +
+----+-----------------------+--------------------------+--------+------------+--------------+
 +
| id | name                  | slug                    | type  | order_by  | has_archives |
 +
+----+-----------------------+--------------------------+--------+------------+--------------+
 +
| 16 | As-code              | pa_as_code              | select | menu_order | 1            |
 +
| 17 | Stop?                | pa_automatische_stop    | select | menu_order | 1            |
 +
| 18 | Breedte (mm)          | pa_breedte              | text  | menu_order | 1            |
 +
| 19 | Connector?            | pa_connector            | select | menu_order | 1            |
 +
| 20 | Diagram              | pa_diagram              | text  | menu_order | 1            |
 +
| 21 | Diepte (mm)          | pa_diepte                | text  | menu_order | 1            |
 +
| 22 | Lengte (mm)          | pa_lengte                | text  | menu_order | 1            |
 +
| 23 | Originele Widget      | pa_originele_widget      | select | menu_order | 1            |
 +
| 24 | Stroomdraad?          | pa_stroomdraad          | select | menu_order | 1            |
 +
| 25 | Model                | pa_model                | select | menu_order | 1            |
 +
| 26 | Submodel              | pa_submodel              | select | menu_order | 1            |
 +
| 27 | Veer?                | pa_veer                  | select | menu_order | 1            |
 +
| 28 | Productlijn          | pa_productlijn          | select | menu_order | 1            |
 +
| 29 | Apparaat              | pa_apparaat              | select | menu_order | 1            |
 +
| 30 | Materiaal            | pa_materiaal            | select | name      | 1            |
 +
| 31 | Zoeken-op-afbeelding  | pa_zoeken-op-afbeelding  | select | menu_order | 1            |
 +
+----+-----------------------+--------------------------+--------+------------+--------------+
 +
</pre>
 +
 
 +
with <code>user 4</code> being my own user id with admin privileges.
 +
 
 +
Now that we figured out that e.g., ''29'' is the id of a product attribute taxonomy:
  
 
<pre>
 
<pre>
 
wp wc product_attribute_term list 29 --user=4
 
wp wc product_attribute_term list 29 --user=4
 
  
 
+-------+------------------+------------------+---------------------------------+------------+-------+
 
+-------+------------------+------------------+---------------------------------+------------+-------+

Versie van 18 okt 2022 09:27

wp wc product_attribute_term_list: Show all terms per taxonomy, with attribute_id being the ID of a product attribute taxonomy.

$ wp help wc product_attribute_term list

NAME

  wp wc product_attribute_term list

DESCRIPTION

  List all items.

SYNOPSIS

  wp wc product_attribute_term list <attribute_id> [--attribute_id=<attribute_id>] [--context=<context>]
  [--page=<page>] [--per_page=<per_page>] [--search=<search>] [--exclude=<exclude>] [--include=<include>]
  [--offset=<offset>] [--order=<order>] [--orderby=<orderby>] [--hide_empty=<hide_empty>] [--parent=<parent>]
  [--product=<product>] [--slug=<slug>] [--fields=<fields>] [--field=<field>] [--format=<format>]

OPTIONS

  <attribute_id>
    Attribute ID.

  [--attribute_id=<attribute_id>]
    Unique identifier for the attribute of the terms.

  [--context=<context>]
    Scope under which the request is made; determines fields present in response.

  [--page=<page>]
    Current page of the collection.

  [--per_page=<per_page>]
    Maximum number of items to be returned in result set.

  [--search=<search>]
    Limit results to those matching a string.

  [--exclude=<exclude>]
    Ensure result set excludes specific IDs.

  [--include=<include>]
    Limit result set to specific ids.

  [--offset=<offset>]
    Offset the result set by a specific number of items. Applies to hierarchical taxonomies only.

  [--order=<order>]
    Order sort attribute ascending or descending.

  [--orderby=<orderby>]
    Sort collection by resource attribute.

  [--hide_empty=<hide_empty>]
    Whether to hide resources not assigned to any products.

  [--parent=<parent>]
    Limit result set to resources assigned to a specific parent. Applies to hierarchical taxonomies only.

  [--product=<product>]
    Limit result set to resources assigned to a specific product.

  [--slug=<slug>]
    Limit result set to resources with a specific slug.

  [--fields=<fields>]
    Limit response to specific fields. Defaults to all fields.

  [--field=<field>]
    Get the value of an individual field.

  [--format=<format>]
    Render response in a particular format.
    ---
    default: table
    options:
      - table
      - json
      - csv
      - ids
      - yaml
      - count
      - headers
      - body
      - envelope
    ---

Examples

Only

wp wc product_attribute_term list

does nothing: A product attribute taxonomy ID is compulsory.

Retrieve product attribute taxonomy IDs through

$ wp --user=4 wc product_attribute list

+----+-----------------------+--------------------------+--------+------------+--------------+
| id | name                  | slug                     | type   | order_by   | has_archives |
+----+-----------------------+--------------------------+--------+------------+--------------+
| 16 | As-code               | pa_as_code               | select | menu_order | 1            |
| 17 | Stop?                 | pa_automatische_stop     | select | menu_order | 1            |
| 18 | Breedte (mm)          | pa_breedte               | text   | menu_order | 1            |
| 19 | Connector?            | pa_connector             | select | menu_order | 1            |
| 20 | Diagram               | pa_diagram               | text   | menu_order | 1            |
| 21 | Diepte (mm)           | pa_diepte                | text   | menu_order | 1            |
| 22 | Lengte (mm)           | pa_lengte                | text   | menu_order | 1            |
| 23 | Originele Widget      | pa_originele_widget      | select | menu_order | 1            |
| 24 | Stroomdraad?          | pa_stroomdraad           | select | menu_order | 1            |
| 25 | Model                 | pa_model                 | select | menu_order | 1            |
| 26 | Submodel              | pa_submodel              | select | menu_order | 1            |
| 27 | Veer?                 | pa_veer                  | select | menu_order | 1            |
| 28 | Productlijn           | pa_productlijn           | select | menu_order | 1            |
| 29 | Apparaat              | pa_apparaat              | select | menu_order | 1            |
| 30 | Materiaal             | pa_materiaal             | select | name       | 1            |
| 31 | Zoeken-op-afbeelding  | pa_zoeken-op-afbeelding  | select | menu_order | 1            |
+----+-----------------------+--------------------------+--------+------------+--------------+

with user 4 being my own user id with admin privileges.

Now that we figured out that e.g., 29 is the id of a product attribute taxonomy:

wp wc product_attribute_term list 29 --user=4

+-------+------------------+------------------+---------------------------------+------------+-------+
| id    | name             | slug             | description                     | menu_order | count |
+-------+------------------+------------------+---------------------------------+------------+-------+
| 45244 | Alternator       | alternator       | Alle widgets voor alternators   | 0          | 12    |
| 34601 | Blazer           | blazer           | Alle widgers voor Blazer        | 0          | 26    |
| 45246 | Boorhamer        | boorhamer        | Alle widgets voor boorhamers    | 0          | 0     |
| 34582 | Boormachine      | boormachine      | Alle widgets - Boormachine      | 0          | 2929  |
+-------+------------------+------------------+---------------------------------+------------+-------+

See also