CART with Short Decription

css
29 Posts
css posted this 20 December 2017

Hi Support

I want to display the Woocommerce Short Description on the CART page!
I can't edit the cart table in Themler so therefore...

I have inserted this code in the end of the functions.php witch is found under Themes files under the Editor!

The code:
add_filter( 'woocommerce_get_item_data', 'wc_checkout_description_so_15127954', 10, 2 );
function wc_checkout_description_so_15127954( $other_data, $cart_item )
{

$post_data = get_post( $cart_item['product_id'] );
$other_data[] = array( 'name' =>  $post_data->post_excerpt );
return $other_data;

}

And now the Cart is displaying the Short Description... nice!

But when I save the Theme again the code is removed from the functions.php!

Where can I insert the code in the Themler Editor so it is inserted in the functions.php after a save?

Regards
Claus

Hi Support I want to display the Woocommerce Short Description on the CART page! I can't edit the cart table in Themler so therefore... I have inserted this code in the end of the functions.php witch is found under Themes files under the Editor! The code: add_filter( 'woocommerce_get_item_data', 'wc_checkout_description_so_15127954', 10, 2 ); function wc_checkout_description_so_15127954( $other_data, $cart_item ) { $post_data = get_post( $cart_item['product_id'] ); $other_data[] = array( 'name' => $post_data->post_excerpt ); return $other_data; } And now the Cart is displaying the Short Description... nice! But when I save the Theme again the code is removed from the functions.php! Where can I insert the code in the Themler Editor so it is inserted in the functions.php after a save? Regards Claus
Vote to pay developers attention to this features or issue.
3 Comments
Order By: Standard | Newest
Support Team
Support Team posted this 21 December 2017

Hello Claus,

Please try adding CMS Code control to the Shopping Cart template from the Insert tab >> More >> CMS Code, then click Edit CMS Code on the ribbon and add the same code using <?php... ?>, like:

<?php add_filter( 'woocommerce_get_item_data', 'wc_checkout_description_so_15127954', 10, 2 );
function wc_checkout_description_so_15127954( $other_data, $cart_item )
{

$post_data = get_post( $cart_item['product_id'] );
$other_data[] = array( 'name' =>  $post_data->post_excerpt );
return $other_data;
} ?>

This should help.

Sincerely,
Nettie,
BillionDigital Team

Hello Claus, Please try adding CMS Code control to the Shopping Cart template from the Insert tab >> More >> CMS Code, then click Edit CMS Code on the ribbon and add the same code using `<?php... ?>`, like: <?php add_filter( 'woocommerce_get_item_data', 'wc_checkout_description_so_15127954', 10, 2 ); function wc_checkout_description_so_15127954( $other_data, $cart_item ) { $post_data = get_post( $cart_item['product_id'] ); $other_data[] = array( 'name' => $post_data->post_excerpt ); return $other_data; } ?> This should help. Sincerely, Nettie, BillionDigital Team
css
29 Posts
css posted this 21 December 2017

Hi Nettie

Thanks... now it works;-)
Do you know something about this question ID 150143

Merry Christmas

/Claus

Hi Nettie Thanks... now it works;-) Do you know something about this question ID 150143 Merry Christmas /Claus
Support Team
Support Team posted this 21 December 2017

Claus, you are welcome. We have also answered in case 150143.
Happy holidays to you too!

Sincerely,
Nettie,
BillionDigital Team

Claus, you are welcome. We have also answered in case 150143. Happy holidays to you too! Sincerely, Nettie, BillionDigital Team
You must log in or register to leave comments