Docs Returns for WooCommerce How to change the exchange status instructions for customer

How to change the exchange status instructions for customer

Use the customer_exchange_status_instructions filter hook to customise the instruction text shown to customers for each exchange status — Exchange Requested, Exchange Approved, and Exchange Rejected. Follow the steps below to add the filter to your child theme.

1. Open your theme's functions.php file

Navigate to your child theme’s directory and locate the functions.php file. If it doesn’t exist, create one.

2. Insert the following code snippet

Copy and paste the code snippet below into your functions.php file:

/*
* Change the instruction based exchange status for customer
*/

add_filter( 'customer_exchange_status_instructions', 'change_instruction_based_exchange_status', 10, 2 );

function change_instruction_based_exchange_status( $instruction, $exchange_status ) {

    //for Exchange Requested
    if ( 'exchange-requested' == $exchange_status ) {
        $instruction = esc_html__('Please enter the instruction for the requested items.', 'zorem-returns-exchanges');
    }

    //for Exchange Approved
    if ( 'exchange-approved' == $exchange_status ) {
        $instruction = esc_html__('Please enter the instruction for the approved items.', 'zorem-returns-exchanges');
    }

    //for Exchange Rejected
    if ( 'exchange-rejected' == $exchange_status ) {
        $instruction = esc_html__('Please enter the instruction for the rejected items.', 'zorem-returns-exchanges');
    }

    return $instruction;
}
3. Save the file

Save the changes to your functions.php file.

By following these steps, you’ve successfully changed the exchange status instructions for customer.

Next Steps