/** * Constructor. * * @version 2.5.7 */ public function __construct() { $this->customer_country_group_id = null; if ('no' === get_option('wcj_price_by_country_for_bots_disabled', 'no') || !wcj_is_bot()) { // `add_hooks()` moved to `init` hook, so in case we need to call `get_customer_country_by_ip()` `WC_Geolocation` class is ready add_action('init', array($this, 'add_hooks')); } }
/** * Constructor. * * @version 2.5.7 * @since 2.5.0 */ function __construct() { $this->id = 'price_by_user_role'; $this->short_desc = __('Price by User Role', 'woocommerce-jetpack'); $this->desc = __('Display WooCommerce products prices by user roles.', 'woocommerce-jetpack'); $this->link = 'http://booster.io/features/woocommerce-price-by-user-role/'; parent::__construct(); add_action('init', array($this, 'add_settings_hook')); if ($this->is_enabled()) { if ('yes' === get_option('wcj_price_by_user_role_per_product_enabled', 'yes')) { add_action('add_meta_boxes', array($this, 'add_meta_box')); add_action('save_post_product', array($this, 'save_meta_box'), PHP_INT_MAX, 2); } if (!is_admin() || defined('DOING_AJAX') && DOING_AJAX) { if ('no' === get_option('wcj_price_by_user_role_for_bots_disabled', 'no') || !wcj_is_bot()) { $this->add_hooks(); } } add_filter('wcj_save_meta_box_value', array($this, 'save_meta_box_value'), PHP_INT_MAX, 3); add_action('admin_notices', array($this, 'admin_notices')); } }