Program Custom Condition

You can review complex example coded by one of our users (thanks to Tom Benway). This plugin seeks for past orders based on address or name, it’s usefull for orders made by guests.


Or start developing your custom condition step-by-step:

  • Download this sample addon.
  • Unzip it and change the files. Note: Use hook “wdp_conditions” to append new condition + load new PHP class and html template.
  • Install changed addon to the site as usually through uploading .zip to the Plugins > Add New tab or copy to the ‘wp-content/plugins’ folder.
    Note: if you need many custom conditions, use one plugin anyway.
  • Create a new rule with the condition section. Find your custom condition name in the list and use it.

For example, there is custom product field “area” (different for each product).

Sample addon embeds new condition to section “Cart Conditions”.
Template custom-template-area-size.php describes supported operations and input for comparable value.

The addon uses method check (class WDP_Custom_Condition_Area_Size) to get total area and compare with defined value.