VirtueMart

WooCommerce

Others

Docs

Support

Demo

Blog

About

Extensions for Ordernumbers for WC

Extensions for the Advanced Ordernumbers Plugin for WooCommerce

Extensions for the Advanced Ordernumbers plugin for WooCommerce. These plugins provide custom variables or custom post-processing to the numbers.
OpenTools_AdvancedOrderNumbersExtensions_WooCommerce_Logo_200x200.pngOpenTools_AdvancedOrderNumbersExtensions_WooCommerce_Logo_200x200.png
WooCommerce Versions
  • woocommerce_logo_15x25
2.4, 2.5, 2.6, 3.x
Price : FREE
Product Product Price
Template for Extension Plugins for the Advanced Ordernumbers Plugin for WooCommerce
Price : FREE
UserOrderCount variable for the Advanced Ordernumbers Plugin for WooCommerce
Price : FREE

All these plugins are "normal" WordPress plugins and need to be installed via the WordPress plugin manager. After installation and activation, their functionality should be available in the Advanced Ordernumbers plugin for WooCommerce immediately. Typically, no further configuration is neccessary.

 

Template for Ordernumber Extensions Plugins

This is a template for developers who want to write their own plugins to extend the Advanced Ordernumbers for WooCommerce plugin. It can be installed, but does not provide any useful functionality, unless a programmer implements the corresponding functions.

Sometimes, order/invoice numbers have to depend on properties (e.g. custom values, values interfaced from some third-party system, etc.) that are not by default provided by this plugin. For this reason, the Advanced Ordernumbers plugin can be extended with plugins that add new variables, modify existing variables or post-process the generated order/invoice number. 

The template available for download has the complete file and code structure, which you can use as a starting point for such a plugin. You will need to adjust the file names, the readme file, the function name and the function contents. 

 

There is currently only one filter used by the Basic/Advanced Ordernumbers Plugin that can be reimplemented to provide/modify variables:

function opentools_ordernumber_replacements($reps, $details, $nrtype)

This filter is called before the variables in the number format are inserted and can be used to either add custom variables or modify existing replacement variables. 

Function arguments
$reps Associative array of all defined variables available for use in the formats. This array can be modified by adding new variables or changing existing entries. The variable name (including the square brackets!) is used as the key, its value is the array value of the entry in the associative array.
$details The Order / Invoice details (whole cart) or user information
$nrtype The type of number to be generated ("ordernumer"  or "invoice")
Return value: The $reps array with possible modifications and insertions applied. ATTENTION: If nothing is returned (because one forgets to return the $reps array), then NO variables will be available for the number formats, effectively erasing all standard variables!

Example (providing the variable [myvariable] as a fixed string and modifying the [seconds] variable):

add_filter('opentools_ordernumber_replacements', "ordernumber_replacements_example", 10, 3);
function ordernumber_replacements_example($reps, $details, $nrtype) {
$reps['[myvariable]'] = "My Value";
$reps['[seconds]'] = $reps['[seconds]'] + 15;
return $reps;
}

 

UserOrderCount Plugin

This plugin provides the variable [UserOrderCount] that holds the number of orders the current customer has already placed (including the new order). No further functionality or configuration provided.

 

Demo Server

License

These plugins are licenced unter the GNU GPLv3.