• Resolved Sania Mohammadi

    (@saniamohammadi)


    Hi WooCommerce community, hope you’re all doing great!

    I’m reaching out on behalf of one of our clients with a specific request we’ve been trying to address.

    We’ve successfully implemented the code for removing double quotes when adding products to the cart. However, we’re hoping to find a similar solution for when products are removed.

    Could anyone share advice?

    Thanks a million in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi Sania,

    Thank you for reaching out to the WooCommerce community and for providing a clear description of your issue. It’s great to hear that you’ve successfully implemented the code for removing double quotes when adding products to the cart.

    As you mentioned, this will require custom coding. Please note that writing or providing custom code is not within the scope of our support policy. For development and custom coding questions, it’s best to ask for insight related to those on either the WooCommerce Advanced Facebook group or the WooCommerce Community Slack. You can also seek help from the following:

    I wish I could help more, but hopefully, this gets you going in the right direction to get the job done.

    Hey Sania,

    I was curious so I searched the code reference on https://woocommerce.github.io/code-reference/files/woocommerce-includes-class-wc-form-handler.html#source-view.623

    You’ll need to hook into

    'woocommerce_cart_item_removed_title'

    so you would come up with something like this

    add_filter( 'woocommerce_cart_item_removed_title', 'custom_remove_quotes_from_item_removed_title', 10, 2 );
    
    function custom_remove_quotes_from_item_removed_title( $item_removed_title, $cart_item ) {
        // Remove the quotes from the item name
        $product_name = isset( $cart_item['data'] ) ? $cart_item['data']->get_name() : __( 'Item', 'woocommerce' );
        $item_removed_title = apply_filters( 'woocommerce_cart_item_removed_title_without_quotes', $product_name, $cart_item );
    
        return $item_removed_title;
    }

    basically the _x() function was removed

    Hope this helps.

    Thread Starter Sania Mohammadi

    (@saniamohammadi)

    Sure Afzal (woo-hc), thanks!

    Many thanks boylaban!

    Hi Sania,

    Thanks for getting back to us. Just so you know – we will now close this ticket as solved. If you have any other questions or issues, please feel free to open a new ticket and we’ll be happy to assist you.

    Thank you for choosing WooCommerce and have a great day!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Removing double quotes when products are removed from cart’ is closed to new replies.