I have a Woocommmerce plugin that alters the text of the single add to cart button text.
The function in question does the following:
public function single_add_to_cart_text() {
$price = $this->get_price();
if ( $price ){
$price = apply_filters( 'formatted_woocommerce_price', number_format( $price, wc_get_price_decimals(), wc_get_price_decimal_separator(), wc_get_price_thousand_separator() ), $price, wc_get_price_decimals(), wc_get_price_decimal_separator(), wc_get_price_thousand_separator() );
}
$text = sprintf(__( 'Participate now for <span class="atct-price" data-price="%s" data-id="%d">%s</span>', 'wc_lottery' ), $price, $this->get_id(), $price ? wc_price($price) : __('free', 'woocommerce'));
return apply_filters( 'woocommerce_product_single_add_to_cart_text',$text, $this );
}
How can I update the text in my functions.php file? I need to override the returned $text value.
2
Answers
Update: Put bellow code to your theme’s functions.php file:
Please use following snippet on your functions.php