WordPress   

Get list of all registered product attributes in Woocommerce

// Get all registered product attributes in Woocommerce
foreach(wc_get_attribute_taxonomies() as $attribs){
	$attributes = get_terms(array('taxonomy'=>'pa_' .$attribs->attribute_name,'hide_empty'=>false,'fields'=> 'all')); ?>
	<div class="attributes">
	<h3><?php echo $attribs->attribute_label; ?></h3>
	<ul class="attribute-list">
	<?php if(!empty($attributes)):
	foreach($attributes as $attribute): ?>
		<li data-value="<?php echo $attribute->taxonomy.'__'.$attribute->slug; ?>">
		<?php echo $attribute->name; ?>
		</li>
	<?php endforeach; endif; ?>
	</ul>
	</div>	
<?php }
Need a helping hand in fixing your website issues?

If you are facing any problems in implementing these code snippets and tutorials, you can hire us to fix your website issues.

Hire Us