Change backorder text on WooCommerce

 

About Louis

Louis is a Developer and all round geek from the UK with a keen interest in web technologies and mobile applications. When not playing with code, he is probably rebuilding a Linux server or watching a Netflix marathon!

This entry was posted in woocommerce, wordpress. Bookmark the permalink.

14 Responses to Change backorder text on WooCommerce

  1. jd says:

    Hi,
    This is just what I’m looking for. It works on the product page. However, it still says “available on backorder” in the cart. Is there additional code I could add to have the same message in the cart?

  2. Louis says:

    Hi jd, The same filter should work for the checkout page as well. It might be worth clearing any cache and refreshing.

  3. Dxtrim says:

    I am also looking for this, and can’t find any solution. 🙁

  4. Jaimin says:

    This code will only change the text on product page but to change backorder text on cart page add the following code in the functions.php file of your child theme.

    function woocommerce_custom_cart_item_name( $_product_title, $cart_item, $cart_item_key ){
    if ( $cart_item['data']->backorders_require_notification() && $cart_item['data']->is_on_backorder( $cart_item['quantity'] ) ) {
    $_product_title .= '' . __( 'Custom order - allow 2 weeks', 'woocommerce' ) . '';
    }
    return $_product_title;
    }
    add_filter( 'woocommerce_cart_item_name', 'woocommerce_custom_cart_item_name', 10, 3);

    Also add the following CSS code in the style.css file of your child theme

    .backorder_notification{
    display: none;
    }
    .backorder_notification.custom{
    display: block;
    }

    PS: If you don’t add CSS code then it will not work.
    Good Luck

  5. Pete says:

    Thanks a bunch Louis and Jaimin.

  6. bmizoney says:

    Thanks guys, nailed it!

  7. Stu says:

    Hi Guys,

    So this is exactly what i’m trying to do. I have a wordpress site and use woocommerce etc etc. I want to change the backorder message on the product page to something like “please allow 2 – 4 weeks for delivery of this item” which i’m having issues with.

    I also want the same or similar text to show in the shopping cart page where the backorder message usually displays under the item name.

    Alternatively, but not my preference, just hide the backorder message from the cart page altogether???

    I’m inputting the php code through a plugin rather than using a child theme or muching about with other things. I usually manage ok, but completely stumped at this. I spent hours on this yesterday and managed to crash my site and everything! lol…

    Any help would be greatly appreciated, as i think it would give a much more professional look to my site.

    A link to one of the products on backorder on my site is below so that you can see exactly what i’m looking for.

    https://ascentsofscotland.co.uk/product/cormag-celtic-bangle/

    Thanks in advance to all you genius people out there! lol

    Stu

Leave a Reply