Change backorder text

The default “Available for back order” message in WooCommerce is a little unhelpful to customers.
Use this function to change the message to something more suitable for your customers.

function change_backorder_message( $text, $product ){
    if ( $product->managing_stock() && $product->is_on_backorder( 1 ) ) {
        $text = __( 'Please allow 2 – 4 weeks for delivery of this item', 'your-textdomain' );
    return $text;
add_filter( 'woocommerce_get_availability_text', 'change_backorder_message', 10, 2 );



  • grace

    May 31, 2019

    Fantastic! What is meant to go in the ‘your-textdomain’ portion, and where does that bit show up on the front-end?

  • LWD

    May 31, 2019

    Have a read about the __ function in WordPress

    It relates to translating the string into different languages

  • Jo

    August 1, 2019

    Thanks for this, just what I needed.

  • Romain Olivier

    February 14, 2020

    Works great ! Thank you.

  • Kalle Hansson

    August 25, 2020

    What if I want to have the following options:

    Out of stock (normal out of stock mode, no change)
    1 week delivery (change the backorders_require_notification to this)
    2 week delivery (change is_on_backorder to this, this is the code you have supplied in this post)

    In addition to this I want to use the str_replace to remove “can be backordered”, like so:
    $availability = str_replace(‘(can be backordered)’, ”, $availability);

    How do I combine all these options into one snippet?

  • Zeth

    September 3, 2020

    It doesn’t change it in the cart. Any words of advice on how to do that?

  • Marcos Belloli

    November 6, 2020

    Where should I place the code above?

    I’m not a developer and my knowledge of coding is 0.

    Can anyone help me?

  • Jelle Marechal

    January 14, 2021

    Your comment is awaiting moderation.

    Sorry, but I get the following message when pasting your snippet in my functions.php file:

    Your PHP code changes were rolled back due to an error on line 7 of file wp-content/themes/flatsome-child/functions.php. Please fix and try saving again.

    syntax error, unexpected ‘}’, expecting end of file


    The entire snippet that returns the error message is:

    managing_stock() && $product->is_on_backorder( 1 ) ) {
    $text = __( ‘Please allow 2 – 4 weeks for delivery of this item’, ‘your-textdomain’ );
    return $text;
    add_filter( ‘woocommerce_get_availability_text’, ‘change_backorder_message’, 10, 2 );

  • JR Castor

    April 3, 2021

    How would I be able to apply html to certain parts of the text? Inserting html tags only returns the html tags as string. Hope you can help!


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.