PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, February 17, 2022

[FIXED] Change "backordered" text on WooCommerce order received page

 February 17, 2022     hook-woocommerce, woocommerce, wordpress     No comments   

Issue

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.



Answered By - 7uc1f3r
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing