Delivery By Post/Zipcode
Shortcodes
If you wish to display the delivery by post/zip-code selection in a different location
[wppizza_dbp]
- Available attributes:
-
redirect
– page/post id to redirect to when submitting selection from shortcode widget (since v5.3). Omit attribute to not redirect.
- Example:
[wppizza_dbp redirect="6"]
If using google maps option: displaying the *dashboard map widget* showing your orders elsewhere:
- Shortcode:
[wppizza_dbp_map]
- Available attributes:
-
orders
– orders to display according to status set. default: “new,delivered”. Available: “new,acknowledged,on_hold,processed,delivered,rejected,refunded”polling
– interval, in minutes, to query for new ordersfullscreen
– omit (default), if the map should *not* be full screen.statustoggle
– if set, adds a button to each order displayed that allows an order to be marked as delivered
- Example:
[wppizza_dbp_map orders="new,delivered" polling="1" fullscreen="1" statustoggle="1"]
Note: If you use this particular shortcode in the frontend somewhere, you most likely want to put this on a page that has been (password) protected !
Examples that will NOT require the “Delivery By Post/Zipcode” plugin
There are certain – relatively simple – situations where the “Delivery By Post/Zipcode” plugin would be unnecessary or indeed complete overkill if you want to achieve some of the below outcomes
Ask customer to select a delivery area/postcode
If you do NOT have DIFFERENT delivery prices for different postcodes or delivery areas but ONLY want to check that your customer has at least selected from a list of selectable delivery area/postcodes
- goto: wppizza->orderform
- rename/relabel one of the custom fields
- check enabled
- check required
- choose type->select
- enter a comma separated list of your delivery areas or postcodes.
- save
Same site, multiple branches
If you want to use the same site for multiple branches and/but want to send the order email to the associated branches email address depending on the branch selected by the customer
- goto: wppizza->orderform
- rename/relabel one of the custom fields (let’s say ccustom6 – hover your mouse over the “enable” button to get the relevant id)
- check enabled
- check required
- choose type->select
- enter a comma separated list of your branches (let’s say “Branch 1, Branch 2, Branch 3” – without the quotes).
- save
Then add the following filter to your [child] themes functions.php (see here if you don’t know about wordpress filters/actions).
add_filter( 'wppizza_filter_email_settings', 'myprefix_filter_email_settings', 10, 3 ); function myprefix_filter_email_settings($email_settings, $recipient, $order) { // only filter emails to the shop if($recipient === 'shop'){ //set shop email depending on branch selected if($order['sections']['customer']['ccustom6']['value'] === 'Branch 1'){//Branch 1 $email_settings['AddAddress'][0]['email'] = '[email protected]'; } elseif($order['sections']['customer']['ccustom6']['value'] === 'Branch 2'){//Branch 2 $email_settings['AddAddress'][0]['email'] = '[email protected]'; } /* and so forth */ else{ /* all others - set as required here along the lines above, i.e $email_settings['AddAddress'][0]['email'] = '[email protected]'; or simply don't set anything / ignore to send to the default email address set for the shop in your order settings */ } } return $email_settings ; }
PS: If you do NOT need different shop email addresses to send the order to but only want to allow the customer to select from the available branches, you can simply omit the filter above entirely
Troubleshooting
Cart empty on checkout when changing post/zipcode
If the above is the case, the required column in the database was not created. This might be due to some permission issue somewhere at time of installation or an outdated mysql version. If this is the case, try the following
- goto WPPizza -> Post/Zipcodes
- click on “Settings” [Tab at the top]
- enable “Verify table column”
- save
Typically this solves the issue but get in contact if it does not, but make sure you enable debug first and check your debug.log for any related entries