Getting products information, in woocommerce based on products ID
You can get the WC_Product object for a product ID with the wc_get_product() function. So by using array_map() you can get the product data for those IDs like this: $product_ids = [ 1, 2, 3, 4 ]; $products = array_map( ‘wc_get_product’, $product_ids ); foreach ( $products as $product ) { echo $product->get_name(); }