Product Description at Checkout Page
-
Hi,
I would like to display Product Description at Checkout page, i found that the code below can help:
***************************************************************
add_filter( ‘woocommerce_get_item_data’, ‘customizing_cart_item_data’, 10, 2 );
function customizing_cart_item_data( $cart_data, $cart_item ) {$custom_items = array();
$label = __( ‘Description’, ‘woocommerce’ );// Get the product description
$description = $cart_item[‘data’]->get_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 description
$description = $product->get_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;
}***************************************************************
The code will display Product Description as shown at screenshot below:
https://drive.google.com/file/d/14oWXrdpZN7AHvQeszHf_b549Qs2eg_fx/view?usp=sharingHowever, it look not very neat. Thus, may i ask, how can we modify the code, in order to move down the Product Description value below the title “Description:”?
Hope can show the result like this:
Description:
1.Statement of Income and Expenses (Profit & Loss Statement);
2.Balance Sheet;
3.Schedule of Fixed Assets;
4.Summary of Financial Information
5.Form P***************************************************************
Thank you!
- The topic ‘Product Description at Checkout Page’ is closed to new replies.