Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

216
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!