Codesnippets

Codesnippets, using hooks and filters for the wppizza plugin to use in your own development as required

Unconfirmed Orders

Mark orders as unconfirmed initially until some script/user interaction accepts the order. Requires wppizza 3.3 (but might also work with slightly earlier versions) Note: the basics of this are tested, but further modifications will be required. Read the notes for each filter/action below. This might …

Add file attachment to email

Adding an arbitrary file attachment to an email – REQUIRES WPPizza v3.2.10 wppizza_filter_mail_attachments alter the filepath and file contents as well as the recipient key according to your requirements. @param: array (current attachments) @param: str (recipient) @param: array (email settings) @param: array (formatted order details) …

Create your own sales report

Modify the sales report generated when clicking the export link in WPPizza -> Reports The sales report can be manipulated using a variety of filters/actions according to the examples below. Depending on your requirements, you might need to use one, more or all of them. …

Get only todays orders on order history page

Only display todays orders in WPPizza -> Orderhistory if you only ever want to get todays orders on admin order history page, something like this might work for you wppizza_filter_orders_query @param: str (the query string) @return: str example: add_filter(‘wppizza_filter_orders_query’, ‘myprefix_admin_orderhistory_query_filter’); function myprefix_admin_orderhistory_query_filter($query){ $today = date(‘Y-m-d’,current_time(‘timestamp’)); …

Email/Print Templates

Email / Print template functions – Requires WPPizza v3.9.3+ wppizza_template_parameters / wppizza_template_markup (functions) query for a certain set of orders and return print or email template markup – according to template selected – for each order example : /********************************************************* * [get email or print template …

On (admin) order status update

Sending an email whenever you change the status of an order in WPPizza -> Orderhistory send an email (or whatever else it is you would like to do) when you change the status of an order in the order history wppizza_on_orderstatus_change @param: array (order details) …

Customise order id

A filter to further ( or use instead) modify the order number than is possible in WPPizza->Order Settings->Global Note, this will NOT change the entry in the db. Only in emails and order history. if you change this filter at any time later , the …

Gateway filters frontend

Conditionally display gateways if you wanted to disable a gateway conditionally (lets say no cash on delivery for non logged in users) you could add this to your themes functions.php wppizza_filter_gateways_orderpage @param: array @return: array example: add_filter(‘wppizza_filter_gateways_orderpage’, ‘my_custom_gateways_filter’); function my_custom_gateways_filter($gateways){ /* disable Cash on delivery …

Get (logged in) users previous order details

Gettings ome info about a logged in users previous orders programatically the ‘wp’ action hooks is only for demonstration purposes. you will probably want to use another action or filter hook as required /* change wp hook to whatever is appropriate */ add_action(‘wp’, ‘my_custom_loggedin_customer’); function …