'product' ); $products = new WP_Query( $args ); $post_meta_record = array(); foreach ( $products->posts as $prod ){ $array = wc_get_product ( $prod ->ID ); if( !$array->is_in_stock () ){ $post_meta_record[] = $prod; } } if( isset( $post_meta_record ) ){ foreach ( $post_meta_record as $k=> $val ){ $status = 'Disabled'; $test_sts = get_post_meta( $val->ID, '_waitlist_button' ); if($test_sts[0] == 'yes'){ $status = 'Enabled'; $html = ''; }else{ $html = ''; } $detail[$k] = array( $val->post_title, $status, $html, $val->ID ); } function test_prod_waitlisted($get_waitlisted_product1, $det_val){ $id = get_post_meta($det_val, CED_AWL_PREFIX.'ced_waitlist_id',true); foreach ( $get_waitlisted_product1 as $kop => $vop ){ return ($id == $vop['ID']) ? 'yes': 'no'; } } function get_ID_prod_waitlisted($get_waitlisted_product1, $det_val){ foreach ( $get_waitlisted_product1 as $kop => $vop ){ if($vop['post_title'] == $det_val){ return $vop['ID']; }else{ return false; } } } ?>

Status of all Out Of Stock Products

$det_val ){?> $det_val[0], 'post_type' => 'Wait_list', 'post_content' => 'This is my Waitlist.', 'post_status' => 'publish', 'post_author' => 1, ); $get_waitlisted_product = get_posts($my_post); $get_waitlisted_product1 = array(); foreach ( $get_waitlisted_product as $kep => $det_valp ){ $get_waitlisted_product1[] = (array)$det_valp; } ?>
Product Status Edit
Waitlisted Not Waitlisted

There are No Out Of Stock Products