foreach($res as $item) {
if($item['data']['StockOnHand'] > 0.0 || $item['data']['StockOnHand'] > 0) {
$product_id = wc_get_product_id_by_sku($item['data']['MfgPartNumber ']);
update_post_meta($product_id, '_stock', $item['data']['StockOnHand']);
update_post_meta($product_id, '_stock_status', 'instock');
update_post_meta($product_id, '_price', $item['data']['RetailPrice']);
}
}
foreach($res as $item) {
if($item['data']['StockOnHand'] > 0.0 || $item['data']['StockOnHand'] > 0) {
$product_id = wc_get_product_id_by_sku($item['data']['MfgPartNumber ']);
update_post_meta($product_id, '_stock', $item['data']['StockOnHand']);
update_post_meta($product_id, '_stock_status', 'instock');
update_post_meta($product_id, '_price', $item['data']['RetailPrice']);
}
}