Added filter on item name in quotes

Filter added to item in quotes. 

Initially was thinking that is it needed to translate the quotes only? I can't find any languages that do this specifically, but if it's a RTL language, perhaps you'd swap around the quote direction.

The function `wc_add_to_cart_message` gives you the filter `wc_add_to_cart_message` to play with, but is already set in stone as HTML, and if you truly want to change the HTML of this message, you would need to rewrite the function.

Simply adding `<strong>` to the product title is not possible without preg_replacing or hooking into gettext
This commit is contained in:
Andrew Lazarus 2018-07-05 16:10:32 +02:00 committed by GitHub
parent 3504732d6b
commit 97269fc5d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -107,7 +107,7 @@ function wc_add_to_cart_message( $products, $show_qty = false, $return = false )
foreach ( $products as $product_id => $qty ) {
/* translators: %s: product name */
$titles[] = ( $qty > 1 ? absint( $qty ) . ' &times; ' : '' ) . sprintf( _x( '&ldquo;%s&rdquo;', 'Item name in quotes', 'woocommerce' ), strip_tags( get_the_title( $product_id ) ) );
$titles[] = ( $qty > 1 ? absint( $qty ) . ' &times; ' : '' ) . apply_filters( 'wc_add_to_cart_item_name_in_quotes', sprintf( _x( '&ldquo;%s&rdquo;', 'Item name in quotes', 'woocommerce' ), strip_tags( get_the_title( $product_id ) ) ), $product_id );
$count += $qty;
}