Home > OS >  How do you change subscription's text in WooCommerce my account?
How do you change subscription's text in WooCommerce my account?

Time:10-07

I created a subscription product pay $1 today and $99 after a month of trial but since there was no such option I used the "every 6 years" option. Now when people go to subscriptions to cancel the 99 charge they see "$99.00 every 6 years". Both in my-account/view-subscription/4619/ and my-account/subscriptions Is there a way to change this text without installing the translator app which will further bulk my already overbulked with plugins installation? enter image description here

CodePudding user response:

To answer your point that there was no such option, if you edit a product and scroll down to the Product settings, as long as the product type is "Simple Subscription" then the general tab has settings for free trial, so you can set your sign up fee as $1, your free trial as 30 days, then your subscription price as $99 per month or year, whatever it is you are wanting to do.

CodePudding user response:

add_filter('woocommerce_get_formatted_subscription_total', 'woocommerce_get_formatted_subscription_total', 10, 2);

function woocommerce_get_formatted_subscription_total($formatted_total, $subscription_obj) {
    if (is_wc_endpoint_url('subscriptions')) { // On subscriptions page, return only the price
        return wc_price($subscription_obj->get_total());
    }
    return $formatted_total;
}
  • Related