Team! I have a site with WooCommerce and was wondering: 1.

Hello Team!

I have a site with WooCommerce and was wondering:

1. How can I edit the word month on woocommerce? (shows ‘$25 / month’ but I want it to show ‘$25 / m’:wink:

2. How can I hide the trial days? (shows $25 / month with a 5-day free trial but I want it to show ‘$25 / m’ only)

3. How can I minimize the ‘$’ on the price display so it appears smaller font than the price?

Cheers

  • Vinod Dalvi
    • WP Unicorn

    Hi Greg,

    I hope you are well today and thank you for your questions.

    1. How can I edit the word month on woocommerce? (shows ‘$25 / month’ but I want it to show ‘$25 / m’:wink:

    2. How can I hide the trial days? (shows $25 / month with a 5-day free trial but I want it to show ‘$25 / m’ only)

    I could edit it on your site by adding the following code in the functions.php file of your child theme.

    function add_custom_scripts(){ ?>
    <script type="text/javascript">
    jQuery(document).ready(function(){
    var subscription_details = jQuery('.product .subscription-details').html();
    if(subscription_details == ' / month with a 5-day free trial'){
    jQuery('.product .subscription-details').html(' / m');
    }
    });
    </script>
    <?php }
    add_action('wp_footer', 'add_custom_scripts');

    3. How can I minimize the ‘$’ on the price display so it appears smaller font than the price?

    I could change it on your site by adding the following code in the style.css file of your child theme.

    p.price::first-letter {
    font-size: 80%;
    }

    Could you please check it and let me know how it works for you now?

    Best Regards,

    Vinod Dalvi

  • Greg
    • The Incredible Code Injector

    Hello @vinod Dalvi

    Amazingly fast support as always :slight_smile: I see your code in my site, thank you! Unfortunately I do not see any changes with the code you added.

    You can see the price table on the “How It Works” page – please don’t give up mate!

    Cheers

  • Ash
    • WordPress Hacker

    Hello @greg

    I hope you are well today.

    Please try the following code:

    function add_custom_scripts(){ ?>
    <script type="text/javascript">
    jQuery(function($) {
    $('.subscription-details').html(' / m');
    $('.amount').each(function() {
    var html = $(this).html();
    var res = html.replace( "$", "<span style='font-size: 70%'>$</span>" );
    $(this).html( res );
    });
    });
    </script>
    <?php }
    add_action('wp_footer', 'add_custom_scripts');

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers

    Ash

  • Greg
    • The Incredible Code Injector

    Hello support!

    Thanks for trying to help me! However I input that code you gave and broke my site with an error:

    Fatal error: Cannot redeclare add_custom_scripts() (previously declared in /home/user/mysite.com/wp-content/themes/theme-child/functions.php:319) in /home/user/mysite.com/wp-content/themes/theme-child/functions.php on line 342

    Help!

  • Greg
    • The Incredible Code Injector

    @ashok

    That worked beautifully! Thank you so much mate!

    If I might add other requests to this thread since it’s on the same area:

    1. My free package appears as ‘FREE! / M’ is there a way to remove the ‘!’ exclamation point?

    2. On the same page as above (how-it-works) is there a way to make the dollar sign appear to be superscript?

    Cheers

  • Vinod Dalvi
    • WP Unicorn

    Hi @greg,

    1. My free package appears as ‘FREE! / M’ is there a way to remove the ‘!’ exclamation point?

    2. On the same page as above (how-it-works) is there a way to make the dollar sign appear to be superscript?

    I could make it work on your site by replacing the previously provided code with the following updated code.

    function add_custom_scripts(){ ?>
    <script type="text/javascript">
    jQuery(function($) {
    $('.job-package-price').each(function() {
    var jpp = $(this).html();
    if( typeof jpp !== 'undefined' ){
    jpp = jpp.replace("Free!", "Free");
    $(this).html(jpp);
    }
    });
    $('.subscription-details').html(' / M');
    $('.amount').each(function() {
    var html = $(this).html();
    var res = html.replace( "$", "<sup style='font-size: 35%; vertical-align: super;'>$ </sup>" );
    $(this).html( res );
    });
    });
    </script>
    <?php }
    add_action('wp_footer', 'add_custom_scripts');

    Could you please check it and let me know how it works for you?

    PS. May I delete the original css given to me since the previous code worked?

    Yes you can remove it now and actually i have removed it from your site.

    Regards,

    Vinod Dalvi

  • Greg
    • The Incredible Code Injector

    You guys are pure amazing you know that right?

    Thank you for helping out, it all looks amazing!

    Last question, can this only affect that page and not other products? Just wondering if this can apply to the pricing table and not the store where other vendors products are being shown.

    Cheers

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.