Last active
May 19, 2016 14:06
-
-
Save iampearce/6412150 to your computer and use it in GitHub Desktop.
Get WooCommerce Product Variables in $post Form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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