WooCommerce Subscriptions translating the price string

Translating the WooCommerce Subscriptions price string is a frequently asked question we get in support.

EDIT: I made this into a mini plugin.

In order to achieve this you need to use a custom code snippet such as this.

function change_signup_string( $string, $product, $include ) {
 // customize $string here based on $product
return $string;
 }
 add_filter( 'woocommerce_subscriptions_product_price_string', 'change_signup_string', 10, 3 );

So for example

function change_signup_string( $string, $product, $include ) {
 $string = str_replace( 'and a', 'maybe and', $string );
 $string = str_replace( 'sign-up fee', 'or for free', $string );
 return $string;
 }
 add_filter( 'woocommerce_subscriptions_product_price_string', 'change_signup_string', 10, 3 );

Alternatively you can edit language file with http://poedit.net/ – find the language file in the plugin folder and after editing put it /wp-content/languages/woocommerce-subscriptions/.

Don’t know what to with these? Here is some guidance on how to use snippets: How to use WordPress custom code snippets

Further info on the Subscriptions hooks and filters can be found within the developer docs published on WooThemes.com: http://docs.woothemes.com/document/subscriptions/develop/filter-reference/

Also: Before you do that, please do make a full backup!

Related Posts

Powered By Related Posts for WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *