Documentation > Developers > Filter Examples > Set a Custom Approved Message

Set a Custom Approved Message

Using the picu_approved_message filter, you can change the message, which is displayed to the client after they approved a collection or placed an order.

In the example below we are replacing the default message with a custom one, only shown if the client made a successful purchase:

/**
 * Set a custom approved message.
 *
 * In this case it is only used after a successful purchase.
 */
function my_picu_approved_message( $message ) {
	$collection_id = get_the_ID();

	if ( ! empty( $collection_id) ) {
		$uses_ecommerce = get_post_meta( $collection_id, '_picu_collection_ecommerce', true ) == 1;

		if ( $uses_ecommerce ) {
			$message = '<h1>Thank you for your purchase</h1><p>We will be in touch regarding your images shortly.</p>';
		}
	}

	return $message;
}

add_filter( 'picu_approved_message', 'my_picu_approved_message', 11 );Code language: PHP (php)

Need help?

If you couldn’t find what you were looking for and need more assistance, please get in touch with us directly and we’re happy to help.