Support » Everything else WordPress » I need some help with a code snippet

  • Resolved jokubas2000k

    (@jokubas2000k)


    Hi,

    I need some help with a code snippet.

    I’m using WooCommerce. I want to display the product’s short description below the product’s name at checkout.

    I found a code snippet that helps me achieve that. It allows me to display the Product short description below the Product’s name at checkout.

    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;
    }

    However, it adds a colon (:) at the end of the description and makes it bold.

    My product’s short description: https://ibb.co/NjD92Fv
    Result: https://ibb.co/xJFTHxh

    Could someone help me remove the colon (:) and bold style?

    Thanks in advance

    Edit: I also noticed that it capitalizes each word. I would like to fix this as well.

    • This topic was modified 3 years, 4 months ago by jokubas2000k. Reason: Adding information
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘I need some help with a code snippet’ is closed to new replies.