Skip to content

Instantly share code, notes, and snippets.

@iampearce
Last active May 19, 2016 14:06
Show Gist options
  • Save iampearce/6412150 to your computer and use it in GitHub Desktop.
Save iampearce/6412150 to your computer and use it in GitHub Desktop.
Get WooCommerce Product Variables in $post Form
<?php
// lets talk variations here
$available_variations = $product->get_available_variations();
foreach($available_variations as $prod_variation) {
$post_id = $prod_variation['variation_id'];
$post_object = get_post($post_id);
// do what you like with the post object here
// you can add the variation to the product cart by linking to ?add-to-cart={variation_id}&quantity=xxx
echo $post_object->post_title;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment