0

With Woocommerce, I am using Woocommerce subscriptions plugin. On the product page, cart, and checkout it shows the monthly fee and signup fee like this:

"$49.00 / month and a $50.00 sign-up fee"

How can I rearrange the order so it says:

"$50.00 sign-up fee and $49.00 / month"

Any help is appreciated.

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
javier
  • 77
  • 1
  • 6
  • Welcome to SO. It is diffecult to help you because you have not supplied additional information like coding examples, what you have tried already that is not working etc. With that said [this question may be helpful to you](https://stackoverflow.com/questions/35005462/how-do-i-change-sign-up-fee-text-in-woocommerce-subscriptions). – crazymatt Mar 06 '19 at 22:17

1 Answers1

0

To invert the displayed Signup fee and Monthly Fee text, you can use WordPress gettext filter hook:

add_filter(  'gettext',  'invert_subscription_signup_fee_and_monthly_fee_text', 10, 3 );
add_filter(  'ngettext',  'invert_subscription_signup_fee_and_monthly_fee_text', 10, 3 );
function invert_subscription_signup_fee_and_monthly_fee_text( $translated, $text, $domain  ) {
    if( $text === '%1$s and a %2$s sign-up fee' && $domain === 'woocommerce-subscriptions' ){
        $translated = __( '%2$s sign-up fee and a %1$s', $domain );
    }
    return $translated;
}

Code goes in function.php file of your active child theme (or active theme). Tested and works.

You will get something like:

enter image description here

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
  • Thank you @LoicTheAztec, I am also using your other code from this page: https://stackoverflow.com/questions/50751569/hide-free-trial-text-from-woocommerce-subscriptions-price-but-keep-the-sign-up. This seems to interfere with this code. What should I do? – javier Mar 10 '19 at 23:36