Commit 998eaf31 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer

store the post meta name in a class member variable instead of hardcoding it in each function

parent 9d2047da
......@@ -31,6 +31,8 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
if (!class_exists("OpenToolsOrdernumbers")) {
class OpenToolsOrdernumbers {
public $ordernumber_meta = "Order Number";
/**
* Construct the plugin object
*/
......@@ -277,7 +279,7 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
$this->_setCounter($type, $counterfmt, $count);
// return the format with the counter inserted
$number = str_replace ("#", sprintf('%0' . $padding . 's', $count), $format);
update_post_meta( $orderid, 'Order Number', $number );
update_post_meta( $orderid, $this->ordernumber_meta, $number );
return $number;
} else {
return $orderid;
......@@ -288,7 +290,7 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
* The hook to customize order numbers (requests the order number from the database; creates a new ordernumber if no entry exists in the database)
*/
function get_ordernumber($orderid, $order) {
$stored_number = get_post_meta( $orderid, 'Order Number', 'true');
$stored_number = get_post_meta( $orderid, $this->ordernumber_meta, 'true');
if (!empty($stored_number)) {
return $stored_number;
} elseif (get_option('customize_ordernumber', 'false')) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment