Skip to content
Docs
Get RestroPress

Filter

rpress_api_products_product_v2

Updated
On this page

Filters the data of a single product in the version 2 API response.

Runs for each menu item when the v2 API builds product data, after the v1 data and the SKU field (when SKUs are in use) have been added. Use it to add or remove fields from a product entry.

Parameters#

ParameterTypeDescription
$productarrayProduct data array, including an info key.

Return value#

array. The product data.

Example#

function my_api_product_v2( $product ) {
	$product['info']['my_flag'] = true;
	return $product;
}
add_filter( 'rpress_api_products_product_v2', 'my_api_product_v2' );

Source#

Applied in:

  • includes/api/class-rpress-api-v2.php (line 129), in RPRESS_API_V2::get_product_data()

See also#

Was this page helpful?