woothemes/woocommerce — pull request #4099 by thenbrent (2013-11-13 05:04:39+00:00)
Title: New Notices API

Leading on from issue #4034 this is the first pass at a generic notices API.

There is now one function for [adding](https://github.com/thenbrent/woocommerce/commit/23cdafccd45e17fc4ac4d20378d11f21e581c4da), [counting](https://github.com/thenbrent/woocommerce/commit/b3aad6f6fed7e5e98f40aec6a53f40f5120169f6) & [clearing](https://github.com/thenbrent/woocommerce/commit/3707a9d017fa0ccfe005c805643c637cc2da0d28) any type of notice.

It's all working, but not ready to be merged as there are a few design considerations I'd like feedback on:

* It could be confusing having a plural and `wc_` prefixed session key, like `wc_errors` & `wc_messages`, and a different, singular `$notice_type` parameter for `wc_add_notice()`. However, a call like `wc_add_notice( $message, 'error' )` feels nicer than `wc_add_notice( $message, 'wc_errors' )`. We could potentially rename the `$notice_type` parameter to something like `$notice_queue` and accept matching internal names, like `'wc_errors'`.
* Supported `$notice_type` values for the `wc_add_notice()` function are `error`, `message` & `notice`. Replacing `message` with `confirmation` would be more accurate, but with the current implementation, that would mean the template would need to be renamed to `confirmation`. @mikej mentioned on #4034 that we could use a `notice-{$type}.php` template, but that would break backward compatibility.
* The *Returning customer?* & *Have a coupon?* notices on checkout could be brought into this new system (either calling the template directly or by adding a new function for printing just one notice).

#### Other notes

I came across some references to a `WC_Messages_Helper` class in the deprecated functions. Should I be adding something along the lines of that?