Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

215
Vistas
Remove double quotes from add to cart message in WooCommerce

I am trying to find out how to remove or replace the double quotes from the WooCommerce add to cart message.

“UNF #10 x 1/4″” has been added to your CART.

Here is my Notice

I am dealing with some Imperial Measurements, and the double quotes look untidy surrounding the " for inch in the Product Name.

I have added filters at every stage of the message display

  • my last attempt is shown below
  • but I've also tried

add_filter ( 'wc_add_to_cart_message_html', 'wc_add_to_cart_message_html_filter', 10, 2 );

I have tried the find string

  • as "“"
  • and escaped "\“"
  • and as Unicode

I can replace any other part of the message.

But I can't remove or replace those pesky quotes.

add_filter ( 'woocommerce_add_success', 'woocommerce_add_success_filter', 10, 1 );
function woocommerce_add_success_filter ( $message ) {

    $message = str_replace("basket","CART", $message);
    $message = str_replace("\“","[ ", $message);

    return $message;
}

Any help or clues?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Use the woocommerce_add_to_cart_item_name_in_quotes hook to remove double quotes from the added to cart messages.

Replace this part

_x( '“%s”', 'Item name in quotes', 'woocommerce' )

With

_x( '%s', 'Item name in quotes', 'woocommerce' )

So you get:

function filter_woocommerce_add_to_cart_item_name_in_quotes( $item_name, $product_id ) {
    // Item name 
    $item_name = sprintf( _x( '%s', 'Item name in quotes', 'woocommerce' ), strip_tags( get_the_title( $product_id ) ) );
    
    return $item_name;
}
add_filter ( 'woocommerce_add_to_cart_item_name_in_quotes', 'filter_woocommerce_add_to_cart_item_name_in_quotes', 10, 2 );
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda