Changeset 3372376
- Timestamp:
- 10/03/2025 01:05:10 PM (5 months ago)
- Location:
- b2bking-private-store-for-woocommerce/trunk
- Files:
-
- 3 edited
-
b2bking.php (modified) (3 diffs)
-
includes/class-b2bking.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
b2bking-private-store-for-woocommerce/trunk/b2bking.php
r2971486 r3372376 5 5 * Plugin URI: https://kingsplugins.com/woocommerce-wholesale/b2bking/ 6 6 * Description: B2BKing is the ultimate plugin solution for B2B and Wholesale stores with 137+ features, handling everything from business registration, to wholesale pricing, catalog visibility, tax exemptions, and much more. 7 * Version: 1. 1.27 * Version: 1.2.0 8 8 * Author: WebWizards 9 9 * Author URI: webwizards.dev … … 11 11 * Domain Path: /languages 12 12 * WC requires at least: 5.0.0 13 * WC tested up to: 8.1.013 * WC tested up to: 10.2.1 14 14 */ 15 15 … … 38 38 } 39 39 40 register_activation_hook(__FILE__, function() { 41 // Check if B2BKing constants are defined 42 if (defined('B2BKING_VERSION') || defined('B2BKING_DIR')) { 43 wp_die( 44 '<h3>B2BKing Pro is already active!</h3>' . 45 '<p>B2BKing Pro includes all features from the Private Store plugin. There\'s no need to activate both.</p>' . 46 '<p>Please use B2BKing Pro only to avoid conflicts.</p>', 47 'Plugin Activation Stopped', 48 ['back_link' => true] 49 ); 50 } 51 }); 52 40 53 add_action( 'before_woocommerce_init', function() { 41 54 if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { -
b2bking-private-store-for-woocommerce/trunk/includes/class-b2bking.php
r2619075 r3372376 13 13 $public = new B2bkingpriv_Public(); 14 14 } 15 16 add_action('plugins_loaded', function(){ 17 18 // Only load if WooCommerce is activated 19 if ( class_exists( 'woocommerce' ) ) { 20 21 // Check that plugin is enabled 22 if ( get_option('b2bking_plugin_status_setting', 'disabled') !== 'disabled' ){ 23 24 /* Guest access restriction settings: */ 25 // Hide prices 26 if (!is_user_logged_in()){ 27 if (get_option('b2bking_guest_access_restriction_setting', 'hide_prices') === 'hide_prices'){ 28 add_filter( 'woocommerce_get_price_html', array($this, 'b2bking_hide_prices_guest_users'), 9999, 2 ); 29 add_filter( 'woocommerce_variation_get_price_html', array($this, 'b2bking_hide_prices_guest_users'), 9999, 2 ); 30 // Hide add to cart button as well / purchasable capabilities 31 add_filter( 'woocommerce_is_purchasable', array($this, 'b2bking_disable_purchasable_guest_users')); 32 add_filter( 'woocommerce_variation_is_purchasable', array($this, 'b2bking_disable_purchasable_guest_users')); 33 } 34 } 35 } 36 } 37 }); 15 38 16 39 } … … 23 46 } 24 47 48 function b2bking_hide_prices_guest_users( $price, $product ) { 49 // if user is guest 50 if (!is_user_logged_in()){ 51 return wp_kses(get_option('b2bking_hide_prices_guests_text_setting', esc_html__('Login to view prices','b2bking')), array('a' => array('href' => array()))); 52 } else { 53 return $price; 54 } 55 } 56 57 function b2bking_disable_purchasable_guest_users($purchasable){ 58 // if user is guest 59 if (!is_user_logged_in()){ 60 return false; 61 } else { 62 return $purchasable; 63 } 64 } 65 25 66 } 26 67 -
b2bking-private-store-for-woocommerce/trunk/readme.txt
r3269158 r3372376 9 9 Tested up to: 6.8 10 10 Requires PHP: 5.6.20 11 Stable tag: 1. 0.012 Version: 1. 1.011 Stable tag: 1.2.0 12 Version: 1.2.0 13 13 License: GPLv2 or later 14 14 License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.