This topic has 7 replies, 2 voices, and was last updated 8 years by Laura.

  • Author
  • #174716
     fradesimon
    Participant

    Hi, Could you please provide the css code to change the Woocommerce “Out of stock” badge text to “SOLD!”.

    Just to clarify i’m trying to change the ribbon text that’s displayed on the top left side of the product image and not the text displayed on the product page itself.

     

    I have tried to use this snippet:

    COPY CODE
    add_filter('woocommerce_stock_html', 'change_stock_message', 10, 2);
    function change_stock_message($message, $stock_status) {
        if ($stock_status == "Out of stock") {
            $message = '<p class="stock out-of-stock">Sold</p>';    
        } else {
            $message = '<p class="stock in-stock">Available</p>';           
        }
        return $message; 

    }

    But this just changes the text on the product page and not the ribbon badge.

     

    Any help you could offer would be really appreciated. Thanks 🙂

    #174796
     Laura
    Moderator

    Hello have you tried using Loco Translate? It help changing theme and plugin strings 🙂

    Theme strings and plugins strings can easily be changed by using Loco Translate plugin https://wordpress.org/plugins/loco-translate/
    <h3>A small introduction on how translations work</h3>
    Translatable strings can come from the theme or from the installed plugins. You need to translate the theme or the plugin depending on what section of the site your string is found.

    For example if your string is on your BuddyPress profile then most probably you will need to translate BuddyPress plugin. If you are on the Forums section of your site then bbPress plugin should be the one that needs to be translated. Another example is the rtMedia plugin that adds the Media links to BuddyPress and if you want to translate it then this plugin will contain the string.
    <h3>Follow these steps to get you started:</h3>

    • Install Loco Translate plugin
    • Go to the plugin dashboard: WP Admin – Tools – Manage translations
    • Find the theme or plugin in the list.
    • If the language isn’t already in the list then click Add new language, choose your language and if you are asked where you want to save the language files choose global language directory ( wp-content/languages/ ).
    • Press SYNC button to synchronise your translation with the provided .pot file
    • Search for the string you want to translate and add your translated string.
    • Press Save when you finished your translation.

    Note: You will have to set the language for your blog from WP-admin – Settings – General – Site Language – Choose your language

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #174800
     fradesimon
    Participant

    Hi Laura,

    Was this meant for me because i don’t see how this solves my issue?

    #174939
     Laura
    Moderator

    Hello, yes, it can be used so instead of using a function, you just change the string using a translation plugin 🙂 Let me know if you need more help, if you share access i can do it for you

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #174941
     fradesimon
    Participant

    Yeah that’s going beyond my knowledge i’m afraid so if you could login and do that for me that would be fantastic!

    Also once you have made the change would i need to keep the plugin installed or could i then uninstall it without effecting the changes you have made?

    http://shop.frade.co.uk

    Username: Simon
    Password: master22

    #175067
     Laura
    Moderator

    Hello, done 🙂 You can uninstall the plugin now

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #175069
     fradesimon
    Participant

    Awesome! Thanks Laura 🙂

    #175157
     Laura
    Moderator

    Glad to help 🙂 If you can rate us 5 stars at themeforest that would help a lot 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 8 posts - 1 through 8 (of 8 total)

The forum ‘Plugins questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?