Viewing 11 posts - 1 through 11 (of 11 total)
  • Posted in: Dante
  • #61873
    simon888
    Member
    Post count: 13

    First of all great work on the dante theme!

    Is there a way to change the ‘out of stock badge to display SOLD in the same style as the Sale badge?

    Many thanks

    -Si

    #61966
    Melanie – SUPPORT
    Member
    Post count: 11032

    Hey,

    you can open up content-product.php and change the text there. Simply search for “out of stock” and it will bring you to that section.

    #62109
    simon888
    Member
    Post count: 13

    hi Melanie,

    I changed the text to sold in content-product.php but the badge still displays out of stock,

    ‘<span class=”out-of-stock-badge”>’ . __( ‘SOLD’, ‘swiftframework’ ) . ‘</span>’;’

    any sugestions?

    Thanks

    -Si

    #62121
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please put this code at functions.php

    add_filter('woocommerce_get_availability', 'availability_filter_func'); 
    function availability_filter_func($availability) { $availability['availability'] = str_ireplace('Out of stock', 'SOLD', $availability['availability']); return $availability; }

    Hope it should work 100% .

    Thanks ๐Ÿ™‚
    With Best Regards
    Swift Ideas

    #62164
    simon888
    Member
    Post count: 13

    Thank you

    how do I also get the Badge to also display SOLD?

    -Si

    #62199
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Did you try my last reply code ?
    Thanks

    #62207
    simon888
    Member
    Post count: 13

    yes I have it in the theme functions.php and it changed the ‘out of stock’ (the one that appears above the description tab) text to SOLD but i also need the badge to change.

    Thanks in advanced for the help
    -Si

    #62214
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please use this code

    add_filter('woocommerce_sale_flash', 'woocommerce_sale_flashmessage', 10, 2);
    function woocommerce_sale_flashmessage($flash){
        global $product;
        $availability = $product->get_availability();
    
        if ($availability['availability'] == 'Out of stock') :
            $flash = '<span class="out-of-stock-badge">'.__( 'SOLD', 'woocommerce' ).'</span>';
    
        endif;
        return $flash;
    }

    Thanks

    #62219
    simon888
    Member
    Post count: 13

    hi,

    thanks for the quick reply but it didn’t work. the badge still says out of stock ๐Ÿ™

    -Si

    #62231
    simon888
    Member
    Post count: 13

    hi,

    its working now the main shop page Thank you both very much! but when I navigate to the single product page it still displays out of stock.

    Thanks again

    -Si

    #62556
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please open to edit product-image.php at /dante/woocommerce/single-product/

    Find this code at line 23
    echo '<span class="out-of-stock-badge">' . __( 'Out of Stock', 'swiftframework' ) . '</span>';
    
    Replace with 
    echo '<span class="out-of-stock-badge">' . __( 'SOLD', 'swiftframework' ) . '</span>';

    Hope it will fix your issue easily .

    Thanks

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register