• Resolved tashalong

    (@tashalong)


    trawling web for 2 days trying to see if i can change this ‘sale’ button to a different word. tries 4 plugins and 2 bits of code. nothing working so far

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter tashalong

    (@tashalong)

    maybe swap the word ‘sale’ and replace it with ‘special offer’

    briskwebservices

    (@briskwebservices)

    @tashalong

    You can use a WooCommerce filter to change the “Sale” text. This method doesn’t require a plugin and is generally lightweight.

    Thread Starter tashalong

    (@tashalong)

    sorry to be a noob but what is a filter and where do i find one?

    briskwebservices

    (@briskwebservices)

    @tashalong

    No worries at all—happy to explain!

    In WordPress, filters are a type of hook that allow you to modify data before it’s sent to the database or displayed on the screen. Essentially, they let you change how WordPress outputs content, processes data, or behaves in specific situations without modifying core files.What is a Filter Hook?

    A filter hook is used to filter or modify the default behavior of WordPress or a plugin. For example, if you want to change the text that is displayed for the “Sale” badge in WooCommerce, you can use a filter to alter that output.

    Filters are a way to customize WordPress without directly changing core files, which is a good practice because updates won’t override your changes.

    Does this help ?

    Thread Starter tashalong

    (@tashalong)

    how do i apply a filter?

    threadi

    (@threadi)

    Try this code:

    add_filter('woocommerce_sale_flash', 'ds_change_sale_text');
    function ds_change_sale_text() {
    return '<span class="onsale">Custom!</span>';
    }

    Found on: https://wpzone.co/wordpress-and-divi-code-snippets/woocommerce-change-sale-badge-text/

    This filter ist part of WooCommerce, see: https://woocommerce.github.io/code-reference/files/woocommerce-templates-loop-sale-flash.html

    Alternative no-code-solution: use the plugin Loco Translate to change this text in the language file of WooCommerce.

    Moderator bcworkz

    (@bcworkz)

    Yet another way to change wording is through the “gettext” filter. This method can alter any word or phrase that’s translatable in WP. All translations pass through this filter, so your callback would need to watch for the specific translatable phrase you want to change. You can then return your desired “translation”, even if it’s still the same language but a different phrase.

    Thread Starter tashalong

    (@tashalong)

    problem sorted thank guys

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