I'm trying to get products attribute of size in woocommerce
and here's my code :
<?php
$test = $_product->get_attributes();
if ( $test != NULL ) {
foreach($test['pa_size']['options'] as $size){
if ($size !== NULL) {
echo apply_filters( 'woocommerce_cart_item_size', $size , $cart_item, $cart_item_key );
} else {
echo "Not Specified";
}
}
} else {
echo "Not Specified";
}
?>
and here if the product has attributes it will check if has attribute of size.
then It will return this size in the var $size
the problem that I got the result not as the value of the attribute.
the value is ( small , medium or large )
but I got a key value like this.
48
So how can I get the value of the attribute not the key.
Thanks in Advance.