Preorder

Customisations WPPizza Preorder

Highlighting preorders for days after today in *emails* sent (for print templates, simply use css declarations)

Your email template(s) selected MUST be set to “Html” for this to make any difference set conditionals as required

@param: array
@param: array
@param: str
@param: int
@param: array
@return: array

add_filter( 'wppizza_filter_template_section_customer_styles', 'myprefix_set_email_styles', 10, 5 );
function myprefix_set_email_styles($template_styles, $parameters, $template_type, $template_id, $order){
	/*
	restricting to email templates here 
	*/
	if($template_type == 'emails'){
	
		/*
			set as variable for ease of use 
		*/
		$pluginSlug = 'wppizza_preorder';
	
		/*
			get preorder meta value / timestamp
			this will be something like '2021-02-11 13:45:00' OR 'asap' if nothing was selected
		*/
		$preorder =  wppizza_get_order_meta($order['ordervars']['order_id']['value'], $pluginSlug, true );
		
		/*
			end of day today, based on wordpress timezone settings current time
		*/
		$eod = date('Y-m-d 23:59:59', WPPIZZA_WP_TIME);
		
		/*
			as an example, make the preorder text in the emails red if 
			preorder time is on/after midnight tonight and set fontsize
			set your conditionals as required
		*/
		if($preorder !='asap' && $preorder > $eod ){
			$template_styles[''.$pluginSlug.'-tdall'] = 'color:red;font-size:120%';
		}
		
	}
return $template_styles;
}