Can anyone teach me how to translate strings from my custom code in function.php of child theme?
I want to have the strings 'Gift Receiver:' and 'Contact No:' to be translatable in Polylang 'Strings Translation' Tab.
Regards
function gift_receiver( $cart_item, $cart_item_key ) {
$greceiver = isset( $cart_item['greceiver'] ) ? $cart_item['greceiver'] : '';
printf(
'<div><label>Gift Receiver:</label> <textarea class="%s" id="rcart_notes_%s" data-cart-id="%s">%s</textarea></div>',
'prefix-cart-notes',
$cart_item_key,
$cart_item_key,
$greceiver
);
}
add_action( 'woocommerce_after_cart_item_name', 'gift_receiver', 10, 2 );
function gift_sender( $cart_item, $cart_item_key ) {
$gsender = isset( $cart_item['gsender'] ) ? $cart_item['gsender'] : '';
printf(
'<div><label>Contact No:</label> <textarea class="%s" id="cart_notes_%s" data-cart-id="%s">%s</textarea></div>',
'prefix-cart-notes',
$cart_item_key,
$cart_item_key,
$gsender
);
}
add_action( 'woocommerce_after_cart_item_name', 'gift_sender', 10, 2 );