Search code examples
wordpresswoocommercehook-woocommerce

Change "backordered" text on WooCommerce order received page


I’m trying to modify the word “reservado” or “backordered” in the order details page.


I use the following code, unfortunately without the desired result. The "backordered" text does not change, any advice?

function custom_backorder_message( $text, $product ){
    if ($product->is_on_backorder( 0 ) ) {
        $text = __( 'This item may take 3-4 weeks to deliver' );
    }
    return $text;
}
add_filter( 'woocommerce_get_availability_text', 'custom_backorder_message', 10, 2 );

Solution

  • If you want to change it via code you can use the woocommerce_backordered_item_meta_name filter hook.

    So you get:

    function filter_woocommerce_backordered_item_meta_name( $string, $item ) {  
        // Replace with new text
        $string = 'My new text';
        
        return $string;
    }
    add_filter( 'woocommerce_backordered_item_meta_name', 'filter_woocommerce_backordered_item_meta_name', 10, 2 );
    

    But you could also change it in the language file.