Adding word price before the value - by buscape

This topic has 6 replies, 3 voices, and was last updated 4 years, 7 months ago ago by buscape

  • Avatar: buscape
    buscape
    Participant
    May 2, 2021 at 11:36

    Hello,
    is it possible to add “Price:” before 35$ for example?
    https://prnt.sc/12dzhsh

    5 Answers
    Avatar: Robert Hall
    Robert Hall
    Participant
    May 2, 2021 at 17:43

    Hello

    Thank you so much for contacting us!

    You can add Word Price by adding this code in functions.php file

    /**
     * Add text before the  price
     */ 
    
    add_filter( 'woocommerce_get_price_html', 'xstore_text_before_price' );
    
    function xstore_text_before_price($price){
    
        $text_to_add_before_price  = ' Price ' ; //change text in bracket to your preferred text 
    		  
    	return $text_to_add_before_price . $price   ;
    		  
    }

    Robert Hall

    Avatar: buscape
    buscape
    Participant
    May 4, 2021 at 20:13

    How can I translate it with WPML?

    Avatar: buscape
    buscape
    Participant
    May 5, 2021 at 12:39
    Avatar: Olga Barlow
    Olga Barlow
    Participant
    May 5, 2021 at 17:45

    Hello,

    Yes, wrap price string within a __() function and add child theme text domain, for example
    $text_to_add_before_price = __( 'Price', 'xstore-child' ); //change text in bracket to your preferred text and translate it using string translator https://prnt.sc/12j6i94

    Regards

    Avatar: buscape
    buscape
    Participant
    May 5, 2021 at 19:32

    Great, thank you!

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

The issue related to '‘Adding word price before the value’' has been successfully resolved, and the topic is now closed for further responses

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