woocommerce_product_read_attribute
Filter product attribute after initialization.
Usage
add_filter( 'woocommerce_product_read_attribute', 'wp_kama_woocommerce_product_read_attribute_filter', 10, 3 );
/**
* Function for `woocommerce_product_read_attribute` filter-hook.
*
* @param WC_Product_Attribute $attribute The attribute object.
* @param array $meta_value The meta value.
* @param WC_Product $product The product object.
*
* @return WC_Product_Attribute
*/
function wp_kama_woocommerce_product_read_attribute_filter( $attribute, $meta_value, $product ){
// filter...
return $attribute;
}
- $attribute(WC_Product_Attribute)
- 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_attribute
woocommerce_product_read_attribute
woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php 645
$attributes[] = apply_filters( 'woocommerce_product_read_attribute', $attribute, $meta_value, $product );
woocommerce/includes/data-stores/class-wc-product-variable-data-store-cpt.php 113
$attributes[] = apply_filters( 'woocommerce_product_read_attribute', $attribute, $meta_value, $product );