Am new to woocommerce, by using gettext hook am able to replace the text "paid" with "placed" but i want to display this text based on one condition i.e when customer pick wire transfer(bacs) as there was no payment received then only text needs to replace with placed
here you go
First let add the Change Text function :
function change_text($translated_text, $text, $domain)
{
switch ($translated_text) {
case 'Paid on %1$s @ %2$s':
$translated_text = __('Placed on %1$s @ %2$s', 'woocommerce');
break;
}
return $translated_text;
}
The Condition:
Now let's create our condition by getting all order id with payment method wire transfer and if the current post id match our order id then we can call the changing text function as following:
add_action('admin_head', 'current_screen');
function current_screen()
{
global $post;
if (empty($post)) {
return;
} else {
$postid = $post->ID;
}
$args = array(
'payment_method' => 'bacs',
'return' => 'ids',
);
$ordersid = wc_get_orders($args);
if (!empty($postid) && in_array($postid, $ordersid)) {
add_filter('gettext', 'change_text', 20, 3);
}
}