Missing product name in cart

Hello Team

I have a weird error were the product name is not visable on either destop or mobile.

I need the product name for both destop and mobile with the product image removed for both.

I have naarrowed it down to when adding remove product button on the checkout page. I used the code below:

/* Remove Item Button in Checkout Page */
add_filter('woocommerce_cart_item_name', 'custom_filter_wc_cart_item_remove_link', 10, 3);
function custom_filter_wc_cart_item_remove_link($product_name, $cart_item, $cart_item_key)
{
  
    if (is_checkout()) {

        $product_name .= apply_filters('woocommerce_cart_item_remove_link', sprintf(
            '<a href="%s" rel="nofollow" class="remove" style="float:left; padding: 0px 5px 0px 5px;">&times;</a>',
            esc_url(WC_Cart::get_remove_url($cart_item_key)),
            __('Remove this item', 'woocommerce'),
            esc_attr($cart_item['product_id']),
            esc_attr($cart_item['data']->get_sku())
        ), $cart_item_key);

        return $product_name;
    }

} 

This seems to be causing isssues with the cart page. Is there away to add a remove product button on the checkout page without this causing issues on the cart page?

Hello Stefan,

Thanks for writing in!

Please be advised that custom development is way beyond the scope of our support. If you got this code from someone, please ask them to check it instead.

Please note that custom coding is outside the scope of our support. Issues that might arise from the use of custom code and further enhancements should be directed to a third party developer.

Best Regards.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.