woocommerce getting variable product attribute value from order
-
Hello I need to retrieve value of selected variable product from an order and used the following code:
$attributes = $product->get_attributes(); $variation_names = array(); if( $attributes ){ foreach ( $attributes as $key => $value) { $variation_key = end(explode('-', $key)); $variation_names[] = ucfirst($variation_key) .' : '. $value; error_log(print_r(array("VARIATIONNAMES",$variation_names), true)); } }
With that, I am able to retrieve properly the name but the value is empty:
[04-May-2021 07:59:21 UTC] Array
(
[0] => VARIATIONNAMES
[1] => Array
(
[0] => pa_module :
))
I can’t find the reason why, could you please help me ?
Thank you
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘woocommerce getting variable product attribute value from order’ is closed to new replies.