Author: super_admin_v3x

Set Pickup/Delivery using link

Adding a _GET parameter to any link to set user option to be pickup or delivery (Requires WPPizza v3.19.3+) This will only work if – your delivery options are not set to “No delivery offered / pickup only” – have “Allow order pickup by customer” 

Update prices in bulk

Update WPPizza menu item prices in bulk , adding 10% to all prices (change values as required) example function myprefix_update_wppizza_prices: /* IMPORTANT: RUN THIS ONE TIME ONLY AND DELETE/DISABLE THIS SCRIPT AGAIN WHEN YOU ARE DONE OR YOU WILL CONTINUALLY BE ADDING 10% ON TOP 

WPPizza Mailinglists

Customisations of selected WPPizza Mailinglists

Freshmail

@param: array
@return: array

/*
Adding preconfigured custom fields
*/
add_filter('wppizza_mll_freshmail_custom_fields', 'myprefix_freshmail_customfields');
function myprefix_freshmail_customfields($custom_fields){ 
	/*
		a) Assign the appropriate field in "WPPizza -> Order Settings -> Mailinglists : Customers Name Formfield"
		b) Create a custom field for your selected mailinglist with a "Field Name" of "name" - type text. (The tag will be $$name$$)
		c) Set  $custom_fields['name'] below to boolean true to enable. 
	*/
	$custom_fields['name'] = false;
	/*
		a) Assign the appropriate field in "WPPizza -> Order Settings -> Mailinglists : Customers Phone Formfield"
		b) Create a custom field for your selected mailinglist with a "Field Name" of "phone" - type text. (The tag will be $$phone$$)
		c) Set  $custom_fields['phone'] below to boolean true to enable.
	*/
	$custom_fields['phone'] = false;
	
	/*
		a) Assign the appropriate field in "WPPizza -> Order Settings -> Mailinglists : Customers Address Formfield"
		b) Create a custom field for your selected mailinglist with a "Field Name" of "address" - type text. (The tag will be $$address$$)
		c) Set $custom_fields['address'] below to boolean true to enable.
	*/
	$custom_fields['address'] = false;

return $custom_fields;
}

Note: As of writing there’s a bug (known to Freshmail) – in the api that does not allow to fill the “name” field that exists by default associated to an email address.
If you need to avoid confusion (perhaps by using something like “Full Name” instead of using ‘name’ in the preconfigured filter above), use the full filter below instead to use a “Full Name” custom field for example (or any other custom filed you would like to add)

@param: array
@return: array

/*
Example, adding a full name custom field.
*/
add_filter('wppizza_mll_freshmail_parameters ', 'myprefix_freshmail_parameters', 10 ,  2);
function myprefix_freshmail_parameters($parameters, $customer_data){ 

	/*
		a) Create a customfield  - type text - for your selected mailinglist with a "Field Name" of "Full Name". (The tag will be $$full_name$$)
		b) Add the a $custom_fields['full_name'] like so . 
	*/
	$parameters['custom_fields']['full_name'] = (!empty($customer_data['name']) ? $customer_data['name'] : '' );//Set full name from customer_data parameters
	

return $parameters;
}

Coupons and Discounts

Filters available for WPPizza Coupons and Discounts wppizza_cad_filter_discounts Allow to filter (unset) applied discounts – identified by their ID – depending on custom conditions related to cart contents. As with all customisations, use at your own risk. You should test this thoroughly /* @since 2.1.4 

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: 

Plugin Options

Display a set WPPizza plugin option
Display the (raw, unformatted) value of an option set in the WPPizza plugin (strings only).
Use your browsers element inspector on an input element to determine the page/parameter combination.
If you need access to other parameters not returned by this shortcode (i.e something that would return an array or similar) use the global $wppizza_options; in your php code in whichever way you need to (and then do something like echo $wppizza_options['localization']['common_label_order_order_id']; for example).
type=’options’ required string  
page=’localization’ required string The admin page (slug) this option can be found on
parameter=’common_label_order_order_id’ required string The option key you want to display
Examples
 
[wppizza type='options' page='localization' parameter='common_label_order_order_id']
– Would simply output what you have set in “Wppizza -> Localization -> Common [Order Labels] -> order id”.
(I.e smething like “Order ID:”)
[wppizza type='options' page='order_settings' parameter='order_pickup_preparation_time']
– Display the order preparation time as set in “WPPizza->Order Settings->Pickup->Preparation Time”.
(I.e something like “30”)

Layout (Menu Items, General)

If you wish to alter the display of the WPPizza menu items – alongside many other layout elements – from the installed default, use any of the options below Goto “WPPizza ->Layout” Goto “Style” on that page and choose from one of the style options 

Checkout Formfields

Modify the customer form fields available on the checkout page A few examples as to how you can show/hide/add/modify input formfields available on the checkout page Simple show/hide formfields using css selectors If you wish to simply show hide some formfields when an order is 

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;
}

As of version 3.6.7+ an additional parameter has been added to the filter with the order details already formatted

add_filter('wppizza_filter_email_subject', 'prefix_filter_email_subject', 10 , 3);
function prefix_filter_email_subject($subject, $order, $order_formatted){

	/* 
	$subject is an array made up of 
	$subject['prefix'] - typically contains blogname followed by items added to subject line in wppizza->order form 
	$subject['main'] - typically contains "your order" localization string (wppizza->localization)
	$subject['suffix'] - typically contains date of order according to date/time format set in WP->settings
	*/
	
	/* example: adding the label of a gateway as set in wppizza->gateways after the prefix , tweak as required*/	
	$subject['prefix'] .= ' '.$order_formatted['ordervars']['payment_type']['value_formatted'];
	
	/* example2: adding the paymet method (i.e typically simply  "Cash" or "Credit Card" ) , tweak as required*/	
	$subject['prefix'] .= ' '.$order_formatted['ordervars']['payment_method']['value_formatted'];
	
	/* see $order_formatted for all available parameters */

	return $subject;
}

Enable Debug

In your wp-config.php you will find a line that reads (most likely) like this: define(‘WP_DEBUG’, false); REPLACE this with (or if it does not exist simply add the below) define(‘WP_DEBUG’, true); define(‘WP_DEBUG_LOG’, true); define(‘WP_DEBUG_DISPLAY’, false);/*this should NEVER be true for production sites*/ Note: this MUST