I'm doing an eCommerce where you can select a product with a selected variation attribute. In the variation, you will choose the day (Monday, Tuesday, etc) when you want to receive it (not the date, only day).

My issue is that I need to show in Cart page the products separated by day, like this.


Product 1 Product 2


Product 1 Product 3 Product 2

To do this I need to identify the value of the attribute of the product when I added in the cart.

In cart.php I add different codes to get the attributes, for all I can get the attribute name and id, but the value is always empty.

            $variation_attributes = $product->get_variation_attributes();
            foreach($variation_attributes as $attribute_taxonomy => $term_slug){
        $taxonomy = str_replace('attribute_', '', $attribute_taxonomy );
                // The name of the attribute
                $attribute_name = get_taxonomy( $taxonomy )->labels->singular_name;
                // The term name (or value) for this attribute
                $attribute_value = get_term_by( 'slug', term_slug, $taxonomy )->name;
                printf ('<br>Detalles de Variaciones: %s, Value %s',$attribute_name,$attribute_value);
            $variation_detail = woocommerce_get_formatted_variation( $variation_attributes, true );
            // printf ('<br>Detalles de Variaciones: %s',$variation_detail);
            $attributes = get_post_meta( $product->get_parent_id(), '_product_attributes', true );
            foreach ( $attributes as $attribute ) {
                echo '<br>Variable: '. $attribute['name'] . '<br> Value: '. $attribute['value'];

            foreach( $cart_item['variation'] as $attribute_val ){
               printf('<br>Lista de Variaciones: %s', $sttribute_val);


As I mentioned, I get the attributes name, but the value is empy, I think that I'm not sending the attribute value, How can I confirm that the value is sent to the cart?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.