i have set new custom stock status in woocommerce as:
add_filter('woocommerce_product_stock_status_options', 'add_custom_stock_statuses');
function add_custom_stock_statuses($statuses) {
$statuses['4_10_days'] = __( 'Διαθέσιμο από 4 έως 10 ημέρες', 'custom-stock-status' );
return $statuses;
}
It’s working perfect for simple products but not for variable.
Once i set all variation to this new stock status, the product is display with an outofstock badge in the frontend and as outofstock in the products admin list.
Wierd thing is that the product is purchasable.
I have even tried:
add_filter( 'woocommerce_is_purchasable', 'wpsh_disable_outofstock_variations', 10, 2 );
add_filter( 'woocommerce_variation_is_purchasable', 'wpsh_disable_outofstock_variations', 10, 2 );
function wpsh_disable_outofstock_variations( $is_active, $variation ) {
if ( $variation->get_stock_status() == '4_10_days' ) {
return true;
}
return $is_active;
}
but yielded the same results.
Any clues?
New contributor
Menelaos pc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.