Created
July 31, 2017 17:43
-
-
Save thiagotmendes/cbe734d2832c21c4ad104c38b5814a8b to your computer and use it in GitHub Desktop.
This file contains 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
// Get product attributes | |
$attributes = $product->get_attributes(); | |
if ( ! $attributes ) { | |
echo ""; | |
} | |
foreach ( $attributes as $attribute ) { | |
$taxonomia = $attribute['name']; | |
$nomeAtributo = explode('pa_',$attribute['name']); | |
$product_attributes = array(); | |
$product_attributes = get_the_terms(get_the_ID(), $taxonomia); | |
//var_dump($product_attributes); | |
$attributes_dropdown = '<div class="form-group">'; | |
echo "<strong class='total left titl'>" .ucfirst($nomeAtributo[1]) ."</strong>"; | |
foreach ( $product_attributes as $pa ) { | |
$attributes_dropdown .= ' | |
<li> | |
<input id="id_'. $pa->slug .'" type="radio" name="attribute_'. $taxonomia. '" value="' . $pa->slug . '"> | |
<label for="id_'. $pa->slug .'">' . $pa->name . '</label> | |
</li>'; | |
} | |
$attributes_dropdown .= "</div>"; | |
echo $attributes_dropdown; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment