Product attribute empty value from order item in Woocommerce 3
Product attribute empty value from order item in Woocommerce 3 I know that there are a lot of questions already for that matter but im not able to figure out how to get a custom product attribute from an woocommerce order. here is what i have try: $order = wc_get_order( $order_id ); $order_data = $order->get_data(); foreach ($order->get_items() as $item_key => $item_values) { $product = $item_values->get_product(); // Get the product $product_id = $item_values->get_product_id(); // the Product id $tokens = get_post_meta($product_id, 'Tokens', true); } I have also try: $tokens = $product->get_attribute( 'Tokens' ); and $tokens = array_shift( wc_get_product_terms( $product_id, 'Tokens', array( 'fields' => 'names' ) ) ); My custom product attribute has the name " Tokens " and the value 5000 but im getting an empty return, what am i doing wrong? That can h...