Reputation: 29650
I using the following WooCommerce hook
function dvpi_available_variation( $variations ) {
echo '<pre class="debug">', print_r($variations), '</pre>';
return $variations;
}
add_filter( 'woocommerce_available_variation', 'dvpi_available_variation' );
This gives me all sorts of details about the variations, but suppose I want to know the (parent) id of the product itself, how do I do this best?
Upvotes: 1
Views: 583
Reputation: 320
there is 3 parameters on this filter, the 2nd is the product :
add_filter("woocommerce_available_variation", function (array $details, \WC_Product $product, \WC_Product_Variation $variation) {
return $details;
}, 10, 3);
Upvotes: 2