public function admin_init() { add_filter('wc_rbpsection_aelia-currencyswitcher-integration', array($this, 'add_settings')); add_action('woocommerce_role_based_price_fields', array($this, 'add_fields'), 5, 5); add_action('woocommerce_role_based_price_data_save', array($this, 'save_data')); add_filter('woocommerce_role_based_product_price_value', array($this, 'change_price'), 1, 5); add_filter('wc_rbp_sections', array($this, 'add_section')); // Override the product prices on the frontend if (!is_admin() || WooCommerce_Role_Based_Price::doing_ajax()) { add_filter('wc_aelia_currencyswitcher_product_currency_prices', array($this, 'my_custom_prices'), 15, 3); } }
public function wc_init() { /* Integration with Currency Switcher. * When the Currency Switcher is active, it already overrides the pricing * filters. Instead of overriding all of them again, it's only necessary * to set a single filter for the "wc_aelia_currencyswitcher_product_currency_prices" * hook. * * @author Aelia * @since 2.1.1 */ if (!WooCommerce_Role_Based_Price::is_currency_switcher_active()) { add_filter('woocommerce_get_regular_price', array($this, 'get_regular_price'), 10, 2); add_filter('woocommerce_get_sale_price', array($this, 'get_selling_price'), 10, 2); add_filter('woocommerce_get_price', array($this, 'get_price'), 10, 2); add_filter('woocommerce_get_variation_regular_price', array($this, 'get_variation_regular_price'), 10, 4); add_filter('woocommerce_get_variation_price', array($this, 'get_variation_price'), 10, 4); add_filter('woocommerce_get_price_html', array($this, 'get_price_html'), 1, 2); } add_filter('init', array($this, 'check_remove_add_to_cart'), 99); }
/** * Inits Admin Class */ public function admin_init() { self::$admin_instance = WooCommerce_Role_Based_Price_Admin::get_instance(); }