Title: Description
Last modified: September 25, 2020

---

# Description

 *  [pinkbirch](https://wordpress.org/support/users/pinkbirch/)
 * (@pinkbirch)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/description-39/)
 * We’d like to be able to pull the short description into the popup window after
   adding the product to the cart.
 * We found a function to pull it into the cart itself but we’d like to also include
   it in the popup:
 *     ```
       function customizing_cart_item_data( $cart_data, $cart_item ) {
   
           $custom_items = array();
           $label = __( 'Description', 'woocommerce' );
   
           // Get the product description
           $description = $cart_item['data']->get_short_description();
   
           // For product variations when description is empty
           if( $cart_item['data']->is_type('variation') && empty( $description ) ){
               // Get the parent variable product object
               $product = wc_get_product( $cart_item['data']->get_parent_id() );
               // Get the variable product short description
               $description = $product->get_short_description();
           }
   
           // If product or variation description exists we display it
           if( ! empty( $description ) ){
               $custom_items[] = array(
                   'key'      => $label,
                   'display'  => $description,
               );
           }
   
           // Merging description and product variation attributes + values
           if( ! empty( $cart_data ) ) $custom_items = array_merge( $custom_items, $cart_data );
   
           return $custom_items;
       }
       ```
   
 * Would you be able to help?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [YITHEMES](https://wordpress.org/support/users/yithemes/)
 * (@yithemes)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/description-39/#post-13508917)
 * Hi,
    and thank you for writing in!
 * You can achieve your goal by adding the following code snippet to your theme **
   functions.php**
 *     ```
       if ( ! function_exists( 'yith_wacp_customization_show_product_description' ) ) {
       	add_filter( 'woocommerce_add_to_cart_fragments', 'yith_wacp_customization_show_product_description', 999, 1 );
       	function yith_wacp_customization_show_product_description( $fragments ) {
       		$product = isset( $_REQUEST['product_id'] ) ? wc_get_product( intval( $_REQUEST['product_id'] ) ) : false;
       		if ( $product && ! empty( $fragments['yith_wacp_message'] ) ) {
       			$description = $product->get_short_description();
       			$description = "<div class='customization-product-description'>{$description}</div>";
   
       			$fragments['yith_wacp_message'] = preg_replace(
       					'/<\/div>\s+<div class=\"actions\">/',
       					$description . '</div><div class="actions">',
       					$fragments['yith_wacp_message'] );
       		}
   
       		return $fragments;
       	}
       }
       ```
   
 * Please try this solution and let us know if everything works fine!
 *  Thread Starter [pinkbirch](https://wordpress.org/support/users/pinkbirch/)
 * (@pinkbirch)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/description-39/#post-13535614)
 * Thank you for your response!That doesn’t appear to be working though. I added
   to to the functions file and it’s not adding to the popup. Take a look:
 * [https://www.shopzhirnova.com/](https://www.shopzhirnova.com/)
 *  Plugin Author [YITHEMES](https://wordpress.org/support/users/yithemes/)
 * (@yithemes)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/description-39/#post-13577871)
 * Hi there,
 * Can you check if the function “yith_wacp_customization_show_product_description”
   exists in your installation?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Description’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/yith-woocommerce-added-to-cart-popup_9b9498.
   svg)
 * [YITH WooCommerce Added to Cart Popup](https://wordpress.org/plugins/yith-woocommerce-added-to-cart-popup/)
 * [Support Threads](https://wordpress.org/support/plugin/yith-woocommerce-added-to-cart-popup/)
 * [Active Topics](https://wordpress.org/support/plugin/yith-woocommerce-added-to-cart-popup/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yith-woocommerce-added-to-cart-popup/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yith-woocommerce-added-to-cart-popup/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [YITHEMES](https://wordpress.org/support/users/yithemes/)
 * Last activity: [5 years, 7 months ago](https://wordpress.org/support/topic/description-39/#post-13577871)
 * Status: not resolved