Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Jan 11, 2022
1 parent 75c4e20 commit 27315f9
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 84 deletions.
77 changes: 34 additions & 43 deletions bin/hook-docs/data/filters.json
Original file line number Diff line number Diff line change
Expand Up @@ -815,94 +815,85 @@
"args": 1
},
{
"name": "woocommerce_store_api_item_quantity_minimum",
"file": "StoreApi/Schemas/CartItemSchema.php",
"name": "woocommerce_store_api_product_quantity_limit",
"file": "StoreApi/Utilities/QuantityLimits.php",
"type": "filter",
"doc": {
"description": "Filters the quantity minimum for a cart item in Store API.",
"long_description": "",
"description": "Filters the quantity limit for a product being added to the cart via the Store API.",
"long_description": "Filters the variation option name for custom option slugs.",
"tags": [
{
"name": "param",
"content": "Cart item array.",
"content": "Quantity limit which defaults to 99 unless sold individually.",
"types": [
"array"
"integer"
],
"variable": "$cart_item"
"variable": "$quantity_limit"
},
{
"name": "return",
"content": "",
"types": [
"\\Automattic\\WooCommerce\\Blocks\\StoreApi\\Schemas\\number"
]
}
],
"long_description_html": ""
}
},
{
"name": "woocommerce_store_api_item_quantity_step",
"file": "StoreApi/Schemas/CartItemSchema.php",
"type": "filter",
"doc": {
"description": "Filters the quantity increment for a cart item in Store API.",
"long_description": "",
"tags": [
{
"name": "param",
"content": "Cart item array.",
"content": "Product instance.",
"types": [
"array"
"\\WC_Product"
],
"variable": "$cart_item"
"variable": "$product"
},
{
"name": "return",
"content": "",
"types": [
"\\Automattic\\WooCommerce\\Blocks\\StoreApi\\Schemas\\number"
"integer"
]
}
],
"long_description_html": ""
}
"long_description_html": "<p>Filters the variation option name for custom option slugs.</p>"
},
"args": 2
},
{
"name": "woocommerce_store_api_product_quantity_limit",
"file": "StoreApi/Schemas/ProductSchema.php",
"name": "woocommerce_store_api_product_quantity_{$value_type}",
"file": "StoreApi/Utilities/QuantityLimits.php",
"type": "filter",
"doc": {
"description": "Filters the quantity limit for a product being added to the cart via the Store API.",
"long_description": "Filters the variation option name for custom option slugs.",
"description": "Filters the quantity minimum for a cart item in Store API. This allows extensions to control the minimum qty of items already within the cart.",
"long_description": "The suffix of the hook will vary depending on the value being filtered. For example, minimum, maximum, multiple_of, editable.",
"tags": [
{
"name": "param",
"content": "Quantity limit which defaults to 99 unless sold individually.",
"content": "The value being filtered.",
"types": [
"integer"
"mixed"
],
"variable": "$quantity_limit"
"variable": "$value"
},
{
"name": "param",
"content": "Product instance.",
"content": "The product object.",
"types": [
"\\WC_Product"
],
"variable": "$product"
},
{
"name": "param",
"content": "The cart item if the product exists in the cart, or null.",
"types": [
"array",
"null"
],
"variable": "$cart_item"
},
{
"name": "return",
"content": "",
"types": [
"integer"
"mixed"
]
}
],
"long_description_html": "<p>Filters the variation option name for custom option slugs.</p>"
"long_description_html": "<p>The suffix of the hook will vary depending on the value being filtered. For example, minimum, maximum, multiple_of, editable.</p>"
},
"args": 2
"args": 3
},
{
"name": "woocommerce_variation_option_name",
Expand Down
60 changes: 19 additions & 41 deletions docs/extensibility/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
- [woocommerce_shipping_package_name](#woocommerce_shipping_package_name)
- [woocommerce_show_page_title](#woocommerce_show_page_title)
- [woocommerce_store_api_disable_nonce_check](#woocommerce_store_api_disable_nonce_check)
- [woocommerce_store_api_item_quantity_minimum](#woocommerce_store_api_item_quantity_minimum)
- [woocommerce_store_api_item_quantity_step](#woocommerce_store_api_item_quantity_step)
- [woocommerce_store_api_product_quantity_limit](#woocommerce_store_api_product_quantity_limit)
- [woocommerce_store_api_product_quantity_{$value_type}](#woocommerce_store_api_product_quantity_-value_type)
- [woocommerce_variation_option_name](#woocommerce_variation_option_name)

---
Expand Down Expand Up @@ -694,89 +693,68 @@ apply_filters( 'woocommerce_store_api_disable_nonce_check', boolean $disable_non

---

## woocommerce_store_api_item_quantity_minimum
## woocommerce_store_api_product_quantity_limit


Filters the quantity minimum for a cart item in Store API.
Filters the quantity limit for a product being added to the cart via the Store API.

```php
apply_filters( 'woocommerce_store_api_item_quantity_minimum', array $cart_item )
apply_filters( 'woocommerce_store_api_product_quantity_limit', integer $quantity_limit, \WC_Product $product )
```

### Parameters

| Argument | Type | Description |
| -------- | ---- | ----------- |
| $cart_item | array | Cart item array. |

### Returns


`\Automattic\WooCommerce\Blocks\StoreApi\Schemas\number`

### Source


File: [StoreApi/Schemas/CartItemSchema.php](../src/StoreApi/Schemas/CartItemSchema.php)

---

## woocommerce_store_api_item_quantity_step


Filters the quantity increment for a cart item in Store API.
### Description

```php
apply_filters( 'woocommerce_store_api_item_quantity_step', array $cart_item )
```
<p>Filters the variation option name for custom option slugs.</p>

### Parameters

| Argument | Type | Description |
| -------- | ---- | ----------- |
| $cart_item | array | Cart item array. |
| $quantity_limit | integer | Quantity limit which defaults to 99 unless sold individually. |
| $product | \WC_Product | Product instance. |

### Returns


`\Automattic\WooCommerce\Blocks\StoreApi\Schemas\number`
`integer`

### Source


File: [StoreApi/Schemas/CartItemSchema.php](../src/StoreApi/Schemas/CartItemSchema.php)
- [StoreApi/Utilities/QuantityLimits.php](../src/StoreApi/Utilities/QuantityLimits.php)

---

## woocommerce_store_api_product_quantity_limit
## woocommerce_store_api_product_quantity_{$value_type}


Filters the quantity limit for a product being added to the cart via the Store API.
Filters the quantity minimum for a cart item in Store API. This allows extensions to control the minimum qty of items already within the cart.

```php
apply_filters( 'woocommerce_store_api_product_quantity_limit', integer $quantity_limit, \WC_Product $product )
apply_filters( 'woocommerce_store_api_product_quantity_{$value_type}', mixed $value, \WC_Product $product, array|null $cart_item )
```

### Description

<p>Filters the variation option name for custom option slugs.</p>
<p>The suffix of the hook will vary depending on the value being filtered. For example, minimum, maximum, multiple_of, editable.</p>

### Parameters

| Argument | Type | Description |
| -------- | ---- | ----------- |
| $quantity_limit | integer | Quantity limit which defaults to 99 unless sold individually. |
| $product | \WC_Product | Product instance. |
| $value | mixed | The value being filtered. |
| $product | \WC_Product | The product object. |
| $cart_item | array, null | The cart item if the product exists in the cart, or null. |

### Returns


`integer`
`mixed`

### Source


- [StoreApi/Schemas/ProductSchema.php](../src/StoreApi/Schemas/ProductSchema.php)
- [StoreApi/Utilities/QuantityLimits.php](../src/StoreApi/Utilities/QuantityLimits.php)

---

Expand Down

0 comments on commit 27315f9

Please sign in to comment.