0) ? "instock" : "outofstock"; wc_update_product_stock_status($id, $new_stock_status); $trid = $sitepress->get_element_trid( $id, 'post_product' ); if (is_numeric($trid)) { $translations = $sitepress->get_element_translations( $trid, 'post_product' ); if (is_array($translations)) { foreach ($translations as $translation) { if ( !isset($translation->element_id) || $translation->element_id == $id) { continue; } update_post_meta($translation->element_id, '_stock', $new_quantity); wc_update_product_stock_status($translation->element_id, $new_stock_status); } } } } } }