Author: super_admin_v3x
Update prices in bulk
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
Preorder
Layout (Menu Items, General)
Checkout Formfields
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; }
If you require more granular control over email parameters, you can also use the ‘wppizza_filter_email_settings’ filter (I believe the attributes are self-explanatory)
add_filter('wppizza_filter_email_settings', 'prefix_filter_email_settings', 10 , 3); function prefix_filter_email_settings($email_settings, $recipient_key, $order_formatted){ /* do your thing */ return $email_settings; }