WC_Product_Variation::get_variation_attributes( bool $with_prefix = true )
Get variation attribute values. Keys are prefixed with attribute_, as stored, unless $with_prefix is false.
Description Description
Parameters Parameters
- $with_prefix
-
(Optional) Whether keys should be prepended with attribute_ or not,
Default value: true
Return Return
(array) of attributes and their values for this variation.
Source Source
File: includes/class-wc-product-variation.php
public function get_variation_attributes() {
$attributes = $this->get_attributes();
$variation_attributes = array();
foreach ( $attributes as $key => $value ) {
$variation_attributes[ 'attribute_' . $key ] = $value;
}
return $variation_attributes;
}