Change backorder text on WooCommerce

 

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

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!

11 thoughts on “Change backorder text on WooCommerce

  1. 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. 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

Leave a Reply