woocommerce_product_read_download
Filter product download after initialization.
Usage
add_filter( 'woocommerce_product_read_download', 'wp_kama_woocommerce_product_read_download_filter', 10, 3 );
/**
* Function for `woocommerce_product_read_download` filter-hook.
*
* @param WC_Product_Download $download The attribute object.
* @param array $meta_value The meta value.
* @param WC_Product $product The product object.
*
* @return WC_Product_Download
*/
function wp_kama_woocommerce_product_read_download_filter( $download, $meta_value, $product ){
// filter...
return $download;
}
- $download(WC_Product_Download)
- The attribute object.
- $meta_value(array)
- The meta value.
- $product(WC_Product)
- The product object.
Changelog
| Since 10.6.0 | Introduced. |
Where the hook is called
woocommerce_product_read_download
woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php 691
$downloads[] = apply_filters( 'woocommerce_product_read_download', $download, $meta_value, $product );