Display attribute terms using a variable
-
I’m trying to display the name and description for each attribute assigned to a given product. I guess the code would have to use $product->get_attributes(); and then I would like to use the name and description for each of the terms it finds as a variable which I can echo.
I can get it working for a single attribute called ‘arsenalho’ using the following code:
<?php $customepattributes = get_the_terms( $product->id, ‘pa_arsenalho’);
foreach ( $customepattributes as $customepattributes ) {
echo $customepattributes->name;
echo “
“;
echo $customepattributes->description;
}
?>How can I ‘get’ the value ‘pa_arsenalho’ and place it into a variable?
- The topic ‘Display attribute terms using a variable’ is closed to new replies.