wordpress - WooCommerce get value of attribute -
how can value of specific attribute in woocommerce order?
i tried following code, attribute name. how value of attribute?
$items = $order->get_items(); foreach ( $items $item ) { $product_id = $item['product_id']; $product_variation_id = $item['variation_id']; $variation_data = get_post_meta( $product_variation_id ); foreach ( $variation_data $name => $value ) { if ( ! $value ) { continue; } if ( taxonomy_exists( esc_attr( str_replace( 'attribute_', '', $name ) ) ) ) { $attribute = $variation_data[$name][0]; $value_of_attribute = ???; } } }
Comments
Post a Comment