$product = wc_get_product( $product_id ); $variation_ids = $product->get_children();
Get an array of variation IDs for a given product ID (all possible variations)
This post brought to you by RocketGeek, ButlerBlog, and the following:
A curated collection of code snippets for WordPress