Email Subject Line

Change the default subject line used in emails

wppizza_filter_email_subject

/*** 
	email subject lines are made up of 3 parts 
	filter each part as required based on your preferences

****/
add_filter('wppizza_filter_email_subject', 'myprefix_filter_email_subject', 10, 2);
function myprefix_filter_email_subject($subject, $order_formatted){

	/*
		defaults

		//dynamic depending on settings in wppizza order form , but typically its the site name plus perhaps some personal info */
		$subject['prefix'] 	= '[--------- conditional/dynamic text ---------------]' ;
	
		//from wppizza->localization
		$subject['main'] 	= $order_formatted['localization']['your_order'];
	
		//date/time according to wordpress date/time settings */	
		$subject['suffix'] 	= date_i18n($order_formatted['date_format']['date'], WPPIZZA_WP_TIME)." ".date_i18n($order_formatted['date_format']['time'], WPPIZZA_WP_TIME)."";

		//This typically produces something like
		"My Shop Your Order March 25, 2020 6:31 pm" 
		where:
		$subject['prefix'] = 'My Shop';
		$subject['main']= 'Your Order';
		$subject['suffix']= 'March 25, 2020 6:31 pm';
	*/

	// example: if you want to not add the date/time at the end
	$subject['suffix'] = '';	
	//or simply
	unset($subject['suffix']);	

	// example: change the typically main "My Order"
	$subject['main'] 	= 'whatever it is you want';

	// example: add something after it all
	$subject['some_additional_key'] 	= 'something added to the end of the subject line;

	/*
		for conditionals depending on order values, 
		you can use the 2nd "$order_formatted" parameter
	*/

return $subject;
}