Skip to content

Instantly share code, notes, and snippets.

@mahdi-alavi
Last active June 15, 2017 20:21
Show Gist options
  • Save mahdi-alavi/bb7133e68209d731e6c1 to your computer and use it in GitHub Desktop.
Save mahdi-alavi/bb7133e68209d731e6c1 to your computer and use it in GitHub Desktop.
Woocommerce Display Product Attribute Variations
<?php
global $product;
$attributes = $product->get_attributes();
foreach ( $attributes as $attribute ) {
$terms = wp_get_post_terms( $product->id, $attribute['name'], 'all' );
foreach ( $terms as $term ) {
echo $term->name .'<br>';
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment