Im trying to create various different custom backorder messages based on product category for specific products. e.g.
If product is under category X and on backorder display custom backorder message X on product page. If product is under category Y and on backorder display custom backorder message Y on product page. If product is under category Z and on backorder display custom backorder message Z on product page.
I know you can normally hook into filter:
woocommerce_get_availability_text
and do something like below. But this applies to all backorders. Anyone know how i'd go about doing category specific?
function custom_backorder_message( $text, $product ){
if ( $product->managing_stock() && $product->is_on_backorder( 1 ) ) {
$text = __( 'Please allow 28 days for delivery of this item' );
}
return $text;
}
add_filter( 'woocommerce_get_availability_text', 'custom_backorder_message', 10, 2 );