Well I have resolved the issue and found its cause, so will post the solution which should be helpful to other users maybe. My theme was implementing a custom ajax cart so it was showing the html <span> tag in the product name. Here is how my product would look in the cart : ProductName <span>-</span> ProductVariation instead of normal ProductName – ProductVariation.
So the problem lies in this file in the plugin Translate Press translatepress-multilingual/includes/compatibility-functions.php
on line 230
in plugin version 1.7.9
add_filter( 'woocommerce_product_variation_title', 'trp_woo_wrap_variation', 8, 4);
function trp_woo_wrap_variation($name, $product, $title_base, $title_suffix){
$separator = '<span> - </span>';
return $title_suffix ? $title_base . $separator . $title_suffix : $title_base;
}
So of-course a simple fix would be to comment this code. But of-course you will lose separate translations for product name and product variation string. So I did not change here, but changed code in my theme file with custom ajax cart. So my theme had this piece of code for item title to display in cart:
<h3 class="title14 product-title"><a href="<?php echo esc_url($product_permalink)?>"><?php echo esc_html($product_name)?></a></h3>
Notice they are escaping the html of the product title (like anyone would normally do). So i just removed the esc_html(
call and it solved my problem. Now the <span>
tags are parsed as normal html instead of showing in the product title.