Support » Plugin: WooCommerce » How to Change Stock Status Out of Stock into SOLD OUT

  • Resolved Jed

    (@jerrald)


    Good day people. Have a question regarding the Woocommerce stock status, how can I change Stock Status “Out of stock” into “Sold Out” to display in the frontend to a specific product. Thanks in advance, God bless everyone.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support AJ

    (@amandasjackson)

    Hi @jerrald

    You can try using this code snippet

    add_filter( 'woocommerce_get_availability', 'wcs_custom_get_availability', 1, 2);
    function wcs_custom_get_availability( $availability, $_product ) {
      
        // Change Out of Stock Text
        if ( ! $_product->is_in_stock() ) {
            $availability['availability'] = __('Sold Out', 'woocommerce');
        }
        return $availability;
    }


    Link to image: http://cld.wthms.co/cmcbxC

    Thanks so much, is it okay if I will add it directly to my functions.php file on my child theme?

    Plugin Support AJ

    (@amandasjackson)

    Yes 🙂 that is indeed what we recommend. Or you can always us a plugin like this one: https://wordpress.org/plugins/code-snippets/

    Thank you again. 🙂

    Hi Amanda. Is it okay if I can add some additional text on the Sold out status? something like “Sold Out: To reserve, pls email us at @example.com”

    if ( ! $_product->is_in_stock() ) {
    $availability[‘availability’] = __(‘Sold Out: To reserve, pls email us at @example.com’, ‘woocommerce’);
    }

    I tried to add additional text after the Sold Out status just like the codes above but it didnt show up on the frontend. Thank you again

    @amandasjackson

    Please disregard my last reply. Already solved the issue, website took so long to respond for the changes. Thank you Again.

    can this code be modified to make the text clear/white instead of saying sold out, I would like to hide the sold out text

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to Change Stock Status Out of Stock into SOLD OUT’ is closed to new replies.