Support » Plugin: WooCommerce Blocks » How can I change “Sale Badge” text?

  • Resolved warinplus

    (@warinplus)


    Hello Team,

    I have a problem changing sale badge’s text of Woocommerce Blocks widget on first page.

    I want to change text in following element but I can’t find the way to change it.
    <span class=”wc-block-grid__product-onsale”>Sale!</span>

    but in the shop page I can use following wordpress add_filter function to change it
    add_filter(‘woocommerce_sale_flash’, ‘woocommerce_custom_sale_text’, 10, 3);

    I don’t have any idea to change it. please help.

    Thank you in advance

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Fernando

    (@fhaps)

    Automattic Happiness Engineer

    To change that label, I’d recommend using a translation plugin like Loco Translate.

    These type of plugins are generally used to change text from one language to another, but they can also be used to edit text within the same language. I know it may sound strange to “translate” your own language, but it works.

    Here’s what you’ll need to do once you’ve installed and activated the plugin:

    `
    1. From the administration sidebar, click on “Loco translate” option and click on “Plugins”.
    2. Select the WooCommerce Blocks plugin from the list.
    3. Choose the option “New Language”.
    4. Select the current language for your site (if you’re using an English version of WordPress, use English, etc.)
    5. Find the strings that you want to change with the filter box.
    6. In the second box on the left, add your replacement texts.
    7. Click on Save, and then on Sync.
    8. Reload your site.
    `

    Here’s a video about that plugin that outlines how it is used: https://www.youtube.com/watch?v=ZUPhsoUm-QE

    I have the same issue.
    WooCommerce itself offers a filter to change the Sales-Badge Text.
    It is important to do it that way fr us becaus ethe text is dynamic and replaces SDALES with the actual percentage that the customer gets off.

    WooCommerce blocks seems to have its own sales bade with “SALE!” as text that does not change when using the filter on the WooCommerce standard badge.
    It would be very helpful to get this aligned.

    Best regards
    Oliver

    Plugin Support Stuart Duff

    (@stuartduff)

    Automattic Happiness Engineer

    Hi @stoffpalast,

    For reference, the product sales badge for blocks is added from the component/product file which is this one below. Currently, I’m not seeing any filters for that and only some localized text.

    https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/master/assets/js/atomic/components/product/sale-badge/index.js

    Plugin Support Stuart Duff

    (@stuartduff)

    Automattic Happiness Engineer

    As we’ve not heard back from you on this I’ll set the topic to resolved for the time being!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.