Product
- Type
- Class
- Namespace
- craft\commerce\helpers
- Inherits
- craft\commerce\helpers\Product
- Since
- 2.0
Product helper
View source (opens new window)
# Public Methods
| Method | Description |
|---|---|
| populateProductFromPost() | Populates a product from the post data. |
| populateProductVariantModel() | Populates all Variant Models from HUD or POST data |
| productFromPost() | Instantiates the product specified by the post data. |
# populateProductFromPost()
Populates a product from the post data.
View source (opens new window)
Arguments
$product(craft\commerce\elements\Product, null (opens new window))$request(craft\web\Request (opens new window), null (opens new window))
Returns
craft\commerce\elements\Product
Throws
# populateProductVariantModel()
Populates all Variant Models from HUD or POST data
View source (opens new window)
Arguments
$product(craft\commerce\elements\Product)$variant$key
Returns
craft\commerce\elements\Variant
# productFromPost()
- Since
- 3.1.3
Instantiates the product specified by the post data.
View source (opens new window)
Arguments
Returns
craft\commerce\elements\Product