Description
-
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)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Description’ is closed to new replies.