0
votes

On my website I am using woocommerce with product variations on. If someone adds a product to the cart with the variations on it will show what variations they chose in the cart page, I don't want that because it messes up the spacing of the cart table. I want to remove this from the css code so that only the product name is remaining and not all the additional variations but I don't know where to start. If this is not descriptive enough please go to my website and add a product to the cart and you will see what I mean.

1

1 Answers

0
votes

in my opinion as a buyer I would like to see what kind of variation I'm ordering, but if you really want to do that: go to your woocommerce templates folder inside your chosen theme, then inside the cart folder you'll find cart-item-data.php either comment everything between line 21-28 or remove it entirely.

<?php    
if ( ! defined( 'ABSPATH' ) ) {
   exit;
}
?>
<!-- <dl class="variation">
<?php foreach ( $item_data as $data ) : ?>
    <div>
        <dt class="variation-<?php echo sanitize_html_class( $data['key'] ); ?>"><?php echo wp_kses_post( $data['key'] ); ?>:</dt>
        <dd class="variation-<?php echo sanitize_html_class( $data['key'] ); ?>"><?php echo wp_kses_post( wpautop( $data['display'] ) ); ?></dd>
    </div>
<?php endforeach; ?>
</dl>-->

if you prefer to hide it with CSS, then you can use this piece of css:

.woocommerce-cart td.product-name dl.variation dt {
   display: none;
}
.woocommerce-checkout td.product-name dl.variation dt {
   display: none;
}