Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $wc_products = wc_get_products(array(
- 'status' => 'publish',
- 'stock_status' => 'instock'
- ));
- foreach ($wc_products as $product){
- $product_array[] = [
- 'id' => (string)$product->get_id(),
- 'name' => $product->get_name(),
- 'price' => (float)$product->get_price(),
- ];
- }
- //Do some other things with the data here
Add Comment
Please, Sign In to add comment