• Resolved seotaro

    (@seotaro)


    Hi,

    I am using Woocommerce block and i saw when shipping cost set as free shipping that displied as $0 in Cart and Checkout page.

    I want to change $0 to Free.

    So i applied below JS code but it not works.

    <script>
    let text = document.querySelector("#radio-control-0-free_shipping\\:2__description > span").innerHTML;
    document.querySelector("#radio-control-0-free_shipping\\:2__description > span").innerHTML = text.replace("$0", "Free !");
    </script>
    <script>
    let text = document.querySelector(".wc-block-formatted-money-amount.wc-block-components-formatted-money-amount
    ").innerHTML;
    document.querySelector(".wc-block-formatted-money-amount.wc-block-components-formatted-money-amount
    ").innerHTML = text.replace("$0", "Free !");
    </script>

    I’ve tried this code in different cases, and it worked.

    But I don’t know why it doesn’t work on the cart page in WooCommerce.

    Please let me know what am i missed.

    Thank you.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Tamirat B. (a11n)

    (@tamirat22)

    Hello @seotaro!

    Thanks for reaching out!

    I’ve tried this code in different cases, and it worked.

    But I don’t know why it doesn’t work on the cart page in WooCommerce.

    This is a forum to support queries related to WooCommerce Core features. Your Javascript inquiry is outside the scope of support for this form.

    I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    Here is also a public resource to customize your child theme’s function file and override its output when free shipping is involved.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    We haven’t heard back from you in a while, (I think that at this point you have been able to find a solution) so I’m going to mark this as resolved – we’ll be here if and/or when you are ready to continue.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to change shipping cost label as $0 to Free ?’ is closed to new replies.