Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

218
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda