Change text in quantity discount on a specific page

This topic has 2 replies, 2 voices, and was last updated 5 hours, 5 minutes ago ago by Luca Rossi

  • Avatar: Juergen
    Juergen
    Participant
    January 26, 2025 at 19:44

    I have the following question:

    We sell an article (HEAT.me Pad) in 10 pieces. So 10 pieces cost 9,95€.

    The quantity discount shows the following:

    Buy 3 items get 5% OFF
    on each product

    I would like to change this to
    Buy 3 x 10 HEAT.me pads get 5% OFF
    on each Pad.

    I would like to change this for this specific product page. Is there a work around for this?

    1 Answer
    Avatar: Justin
    Luca Rossi
    Support staff
    January 27, 2025 at 08:11

    Hi @Juergen,

    Please try adding this custom code under functions.php file locates in your child theme:

    
    function n2t_text_strings( $translated_text, $text, $domain ) {
        global $product;
    	switch ( $translated_text ) {
    		case '%1s Buy %2s items and get %3s OFF %4s %5s on each product %6s' :
    			$translated_text = '%1s Buy %2s x '.$product->get_title().' and get %3s OFF %4s %5s on each Pad %6s';
    			break;
    		case '%1s Buy from %2s to %3s items and get %4s OFF %5s %6s on each product %7s' :
    			$translated_text = '%1s Buy from %2s to %3s '.$product->get_title().' and get %4s OFF %5s %6s on each Pad %7s';
    			break;
    		case '%1s Buy %2s items get %3s OFF %4s %5s on each product %6s' :
    			$translated_text = '%1s Buy %2s '.$product->get_title().' get %3s OFF %4s %5s on each Pad %6s';
    			break;
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'n2t_text_strings', 20, 3 );
    

    https://prnt.sc/glCQ8QrFBza-

    Hope it helps!

  • Viewing 2 results - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.