Login
Register

VirtueMart

WooCommerce

Others

Docs

Support

Blog

About

Ordernumbers for WooCommerce

IMPORTANT ANNOUNCEMENT: Plugin development ceased, all plugins made available freely (GPL)

With great sadness we have to announce that we are ceasing development of all our VirtueMart, WooCommerce and Joomla plugins. Effective immediately, all our plugins -- even those that were paid downloads -- are made available for free from our homepage (GPL license still applies), but we cannot and will not provide any support anymore.

It has been a great pleasure to be part of the thriving development communities of VirtueMart as well as WooCommerce. However, during the last year it became painstakingly clear that in addition to a full-time job, a young family and several other time-consuming hobbies at professional level (like being a professional singer) the plugin development and the support that it requires is not sustainable and is taking its toll. It has been an honor, but it is now time to say good bye!

×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Denote First Time Customer 23 Apr 2017 01:13 #1

  • brickford5
  • brickford5's Avatar Topic Author
Is there anyway to note a customers first order? ie normal order number would be 51516, 51517, 51518 etc. But if it is the customers first order on order 51517 the order number would be N51517.

I'm sure this is a little more custom, so if not an easy solution would you have a reference to anyone for hire for this kind of functionality?

Thanks!

Denote First Time Customer 23 Apr 2017 15:32 #2

Dear Brickford5,
You are not the first one to request such functionality. Fortunately, I have already implemented a little extension for our plugin that provides an additional variable UserOrderCount:
open-tools.net/woocommerce/advanced-orde...rnumbers-for-wc.html

Please install that userordercount extension and enable it. This will prove the variable UserOrderCount for use in the number format and in the conditions for new variables/repleacements. Using this variable, you can define some custom number format for first-time orders:

If variable userordercount <= 1 THEN set variable ordernumber_format to N#|#



The variable userordercount will have value 0 for all orders from unregistered users (i.e. no new account created during the checkout) and value 1 for the first order of a registered customer.

The new ordernumber_format in my example above is "N#|#" and should in your case always have the form "N....|....", where .... is your exact ordernumber format. E.g. if you use an ordernumber format [year][month]-#, then the new format in your custom definition should be "#[year][month]-#|[year][month]-#". The repeated format after the | is required to force the counter to use the same counter as all other orders (i.e. ignore the N prefix in the order number). In particular, "N#|#" means: Display the number as N#, but let the counter increase as if the format were only #.
If you omit the |# part, then orders from new customers would have their own counter, which is probably not what you want.

Best regards,
Reinhold
Attachments:
  • Page:
  • 1