/** * Load Product subclasses */ private function init() { // pos only products if (wc_pos_get_option('general', 'pos_only_products')) { new WC_POS_Products_Visibility(); } // decimal quantities if (wc_pos_get_option('general', 'decimal_qty')) { remove_filter('woocommerce_stock_amount', 'intval'); add_filter('woocommerce_stock_amount', 'floatval'); } }
/** * POS Status for each gateway * * @param object $gateway */ public function pos_status($gateway) { $settings = wc_pos_get_option('checkout', 'enabled'); $enabled = is_array($settings) ? array_keys($settings, true) : array(); echo '<td class="pos_status">'; if (in_array($gateway->id, $enabled)) { echo '<span class="status-enabled tips" data-tip="' . __('Enabled', 'woocommerce') . '">' . __('Enabled', 'woocommerce') . '</span>'; } else { echo '-'; } echo '</td>'; }
/** * WC email notifications * @param WC_Emails $wc_emails */ public function woocommerce_email(WC_Emails $wc_emails) { if (!wc_pos_get_option('checkout', 'customer_emails')) { $this->remove_customer_emails($wc_emails); } if (!wc_pos_get_option('checkout', 'admin_emails')) { $this->remove_admin_emails($wc_emails); } }
/** * Get the default customer + guest * * @return object $customer */ private function customers() { $user_id = wc_pos_get_option('general', 'logged_in_user') ? get_current_user_id() : wc_pos_get_option('general', 'default_customer'); if ($user_id) { $user = get_userdata($user_id); $customers['default'] = array('id' => $user->ID, 'first_name' => esc_html($user->first_name), 'last_name' => esc_html($user->last_name), 'email' => esc_html($user->user_email), 'username' => esc_html($user->user_login)); } $customers['guest'] = array('id' => 0, 'first_name' => __('Guest', 'woocommerce')); return $customers; }
/** * Get the default customer + guest * * @return object $customer */ private function customers() { $settings = wc_pos_get_option('general'); $user_id = false; if (isset($settings['customer']['id'])) { $user_id = $settings['customer']['id']; } if (isset($settings['logged_in_user']) && $settings['logged_in_user']) { $user_id = get_current_user_id(); } if ($user_id) { $user = get_userdata($user_id); $customers['default'] = array('id' => $user->ID, 'first_name' => esc_html($user->first_name), 'last_name' => esc_html($user->last_name), 'email' => esc_html($user->user_email), 'username' => esc_html($user->user_login)); } $customers['guest'] = array('id' => 0, 'first_name' => __('Guest', 'woocommerce')); return $customers; }