WooCommerce Cart Product Link & Description

Modified on Wed, 11 Mar at 9:44 AM

When a SimulArt item is added to a WooCommerce cart, there is no link back to the product details page, the product description is also omitted leaving only the product name. 

Here's how to include the product page links to your cart template:
Edit the file /wp-content/plugins/woocommerce/templates/cart/cart.php
Around line 44, replace
$product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key );

by

$product_permalink = $_product->get_permalink( $cart_item );

This will force the cart links for SimulArt hidden items without making them visible in pages and searches.



Here's how to include the product descriptions to your cart template:
Locate the cart item loop in /wp-content/plugins/woocommerce/templates/cart/cart.php
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
    $_product = $cart_item['data']; 

Insert the code below inside the loop and <td></td> tags, right after the product name:

$description = $_product->get_short_description();
if ( $description ) : ?>
    <p class="cart-item-description"><?php echo wp_kses_post( $description ); ?></p>
<?php endif; 

This will force the cart to display the item descriptions including frame components and dimensions. You can optionally style the descriptions in your theme's CSS with:

.cart-item-description {
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
}

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article