How to make returned text translatable in WooCommerce product add to cart filter
I have the following code where I need to make the 'Pas de Stock' string translatable. I tried changing the line to the following, but it throws a syntax error: return <?php _e('Pas de Stock','veho'); ?> Is there a standard way to return translatable text in this filter? add_filter( 'woocommerce_product_add_to_cart_text', 'bbloomer_archive_custom_cart_button_text' ); function bbloomer_archive_custom_cart_button_text( $text ) { global $product; if ( $product && ! $product->is_in_stock() ) { return 'Pas de Stock'; } return $text; }
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.