1

I have created this function in WooCommerce that replaces the current price in with some proceeding text followed by the price. It works great.

However, we have two different languages setup in WPML and nothing shows up for either of these languages.

How can I make this translatable with WPML?

add_filter( 'woocommerce_get_price_html', 'new_custom_price_message' );
function new_custom_price_message( $price ) {
    $regular_price = get_post_meta( get_the_ID(), '_price', true);
    $s = 100000;
    if ( $regular_price >= $s ) {
        $ss = __('Starting at: Price Upon Request', 'my-theme-slug');
        return $ss;
    }
    else if ($regular_price < $s ){
        $price_text = __('Starting at: ', 'my-theme-slug');
        return $price_text . $price;
   }
}

Thanks.

Alan Carr
  • 322
  • 2
  • 9
  • 25
  • why you are getting price like that `$regular_price = get_post_meta( get_the_ID(), '_price', true);` while you have it provided by filter (see `$price` in `function new_custom_price_message( $price )`)? – kkarpieszuk Aug 18 '16 at 10:40

0 Answers0