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 Professional Support for Your Website Problems?

Whether you're facing website issues or struggling with code implementation, our team is here to assist. Hire us to get your website back on track.

Hire Us