Remove html tags from cart item name in WooCommerce cart and checkout

36 views Asked by At

See the image for how it is getting My installed plugins in WP

I wanted to remove the "span" element from the add to cart product title. I provided the both images one with problem and the other are my installed plugins. I think its in the Boostify Header Footer Builder(The client says that).

1

There are 1 answers

1
LoicTheAztec On

To remove HTML tags from product names in cart and in checkout, you can use the following:

add_filter('woocommerce_cart_item_name', 'strip_html_tags_from_cart_item_name', 9000, 1 );
function strip_html_tags_from_cart_item_name( $product_name ) {
    $product_name = wp_strip_all_tags( $product_name, true );

    return $product_name;
}

Code goes in functions.php file of your active child theme (or active theme). Tested and works.