I was building a custom form for my client where I wanted to create a shortcode that generates a button where a user could add a Subscription to their cart.
Each subscription product has a number of variations. Variations are stored as posts but meta information is stored as if they are product options.
If you try to retrieve the post_title of a variation by its ID, it will display something like the following.
Variation #0000 of Some Product
Here is how to retrieve the product option title rather than the variation post title.
// Assuming you already have $variation_id set get_post_meta($variation_id, 'attribute_options'); |
Returns an array
[attribute_options] => Array ( [0] => Some Variation Title )
With thanks http://stackoverflow.com/questions/29741270/woocommerce-get-product-variation-title/33495560#33495560
no, I think the best you can do here is the slug