Changeset 3048574
- Timestamp:
- 03/10/2024 12:10:31 PM (2 years ago)
- Location:
- user-role-based-shipping-method
- Files:
-
- 6 edited
- 3 copied
-
tags/3.0.0 (copied) (copied from user-role-based-shipping-method/trunk)
-
tags/3.0.0/includes/class-pvalley-user-role-based-shipping-manage-shipping.php (modified) (1 diff)
-
tags/3.0.0/includes/class-pvalley-user-role-based-shipping-settings.php (modified) (2 diffs)
-
tags/3.0.0/pvalley-user-role-based-shipping.php (copied) (copied from user-role-based-shipping-method/trunk/pvalley-user-role-based-shipping.php) (2 diffs)
-
tags/3.0.0/readme.txt (copied) (copied from user-role-based-shipping-method/trunk/readme.txt) (8 diffs)
-
trunk/includes/class-pvalley-user-role-based-shipping-manage-shipping.php (modified) (1 diff)
-
trunk/includes/class-pvalley-user-role-based-shipping-settings.php (modified) (2 diffs)
-
trunk/pvalley-user-role-based-shipping.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
user-role-based-shipping-method/tags/3.0.0/includes/class-pvalley-user-role-based-shipping-manage-shipping.php
r2673900 r3048574 26 26 $this->shipping_based_on = ! empty(self::$settings['general_settings_shipping_based_on']) ? self::$settings['general_settings_shipping_based_on'] : array(); 27 27 add_filter( 'woocommerce_package_rates', array( $this, 'manage_shipping_methods'), 10, 2 ); 28 add_filter("woocommerce_package_rates", array($this, "hide_shipping_methods"), 999); 29 } 30 31 /** 32 * Hide shipping methods based on the selected option. 33 * 34 * @param $rates 35 * 36 * @return array|mixed 37 */ 38 public function hide_shipping_methods($rates) { 39 $show_only = ! empty(self::$settings['show_only']) ? self::$settings['show_only'] : ""; 40 switch ($show_only) { 41 case "free_shipping": 42 return $this->show_only_free_shipping( $rates ); 43 default: 44 return $rates; 45 } 46 } 47 48 /** 49 * Hide all the shipping methods other than Free Shipping method. 50 * 51 * it will be applicable only when Free Shipping is available. 52 * 53 * It won't hide any shipping methods when there is no Free Shipping methods. 54 * 55 * @param $rates 56 * 57 * @return array|mixed 58 */ 59 public function show_only_free_shipping($rates) { 60 $free = array(); 61 foreach ( $rates as $rate_id => $rate ) { 62 if ( 'free_shipping' === $rate->method_id ) { 63 $free[ $rate_id ] = $rate; 64 break; 65 } 66 } 67 return ! empty( $free ) ? $free : $rates; 28 68 } 29 69 -
user-role-based-shipping-method/tags/3.0.0/includes/class-pvalley-user-role-based-shipping-settings.php
r2278152 r3048574 10 10 */ 11 11 public function __construct() { 12 13 12 $this->id = 'pvalley_role_based_shipping'; 14 13 $this->label = __( 'Role Baed Shipping', 'pvalley-user-role-based-shipping' ); … … 74 73 'type' => 'checkbox', 75 74 'id' => 'pvalley_user_role_based_shipping[general_settings_enable]' 75 ), 76 "general_settings_hide_shipping_methods" => array( 77 "name" => __("Hide shipping methods", "pvalley-user-role-based-shipping"), 78 "type" => "select", 79 "options" => array( 80 "" => __("Select"), 81 "free_shipping" => __("Show Free Shipping Only, hide other shipping methods", "pvalley-user-role-based-shipping") 82 ), 83 "class" => "wc-enhanced-select", 84 "id" => "pvalley_user_role_based_shipping[show_only]", 85 "desc" => "It will be applied only if Free Shipping is available during checkout. It's not related to rule matrix. It can be used without rule matrix." 76 86 ), 77 87 'general_settings_shipping_based_on' => array( -
user-role-based-shipping-method/tags/3.0.0/pvalley-user-role-based-shipping.php
r3036404 r3048574 4 4 * Plugin URI: 5 5 * Description: Hide/show shipping methods based on user role and destination country. 6 * Version: 2.0.16 * Version: 3.0.0 7 7 * Author: Pluginvalley 8 8 * Author URI: … … 11 11 * Requires at least: 5.0 12 12 * WC requires at least: 3.0.0 13 * WC tested up to: 8. 5.213 * WC tested up to: 8.6.1 14 14 */ 15 15 -
user-role-based-shipping-method/tags/3.0.0/readme.txt
r3036411 r3048574 6 6 Requires at least: 5.0 7 7 Tested up to: 6.4 8 Stable tag: 2.0.18 Stable tag: 3.0.0 9 9 License: GPLv3 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html 11 11 12 Role based Shipping Method Plugin for WooCommerce. Manage Shipping Rates based on User Roles and destination country.12 Display WooCommerce shipping methods based on User Role and Country. Globally compatible. 13 13 14 14 == Introduction == 15 15 16 Hide/show woocommerce shipping methods based on user role and destination country.16 Display WooCommerce shipping methods based on User Role and country, Option to hide all other shipping methods when Free Shipping is available. 17 17 18 18 == Description == 19 It will allow you to hide/show the WooCommerce Shipping methods based on User Role. It will also allow you to manage the WooCommerce Shipping methods based on Shipping Country. You can use it with Flat Rate / Free Shipping / Local Pickup or any other third party shipping plugin. 19 It will allow you to hide WooCommerce Shipping methods based on user role and country. It is globally compatible i.e. You can use it with Flat Rate / Free Shipping / Local Pickup or any other third party shipping plugin. 20 It also provides you an option to show only Free Shipping when Free Shipping is available during checkout by removing all other shipping methods. 20 21 21 22 Do you wish to provide Woocommerce Shipping Cost based on User Role ? 23 Do you wish to provide WooCommerce Shipping Cost based on Shipping Country ? 24 Are you still struggling to setup the Woocommerce Shipping Cost based on User Role and Destination Country ? 22 Do you want to show shipping methods based on user role? 23 Do you want to show shipping methods based on shipping country? 24 Are you still struggling to set up the Woocommerce Shipping Cost based on User Role and Destination Country ? 25 25 26 26 Here's the solution for your requirement. Setup Flat Rate / Free Shipping or Shipping Cost using any third Party Plugin and Manage them Which Shipping Cost need to be shown to which user and for which country. 27 27 28 28 = Features = 29 * Manage WooCommerce Shipping Method based on User role. 30 * Manage WooCommerce Shipping Method based on Country. 31 * Manage Woocommerce Shipping Method based on User role and Destination Country. 32 * Manage shipping method based on shipping method name or label 29 * Display shipping methods based on user role 30 * Display shipping methods based on shipping country 31 * Option to hide all other shipping methods and shown only Free Shipping when Free Shipping is available during checkout 33 32 34 33 == Installation == … … 43 42 == Frequently Asked Questions == 44 43 44 = Compatibility? = 45 46 Globally Compatible. It is compatible with all the shipping methods offered by WooCommerce and third party plugins. 47 48 = How to display Free Shipping only? = 49 50 Go to General section in plugin settings page. 51 Enable the plugin and under Hide shipping methods select option to Show Free Shipping Only, hide other shipping methods. 52 Note It's independent of rule matrix. 53 It will only work when Free Shipping is available during checkout. 54 45 55 = How to setup the plugin? = 46 56 … … 51 61 Woocommerce store info: Assume our store offer three shipping methods - Standard Delivery, Express Shipping, One Day Shipping. 52 62 53 Case 1: I want to show One Day Shipping method to Administrator user role in USA.63 Case 1: I want to show One Day Shipping method to Administrator user role in the USA. 54 64 55 To ach eive it add a new rule in Rules settings page.65 To achieve it add a new rule in Rules settings page. 56 66 * Select Administrator in User Role field. 57 67 * Select United States in Countries field. … … 61 71 * Now go to shop page add any product and recalculate the shipping cost by changing the address, Standard Delivery and Express Shipping method won't be shown. 62 72 63 Case 2: I want to show Standard Delivery, Express Shipping method to Guest user role in USA.73 Case 2: I want to show Standard Delivery, Express Shipping method to Guest user role in the USA. 64 74 65 To ach eive it add a new rule in Rules settings page.75 To achieve it add a new rule in Rules settings page. 66 76 * Select Guest in User Role field. 67 77 * Select United States in Countries field. … … 76 86 77 87 = Plugin not working after setting the plugin? = 78 If you have done the plugin setup and you still don't see any change in cart/checkout page then please try to recalculate the shipping cost by changing the address because by default woocommerce will show you the cached shipping methods. 88 If you have done the plugin setup, and you still don't see any change in cart/checkout page then please try to recalculate the shipping cost by changing the address because 89 by default woocommerce will show you the cached shipping methods. 79 90 80 91 = Sample Video = … … 88 99 3. Value of Shipping Method to hide 89 100 4. Shipping method hidden 90 5. Multiple shipping method rule configuration for si gle user role101 5. Multiple shipping method rule configuration for single user role 91 102 6. Shipping method hidden based on label / name 92 103 … … 114 125 * Compatibility with WordPress 5.9 115 126 * Compatibility with WooCommerce 6.1.1 116 * New option to hide shipping method based on shipping method name / title / lab le127 * New option to hide shipping method based on shipping method name / title / label 117 128 118 129 = 2.0.1 = … … 124 135 * Tested with WooCommerce 8.5.2 125 136 137 = 3.0.0 = 138 * Feature to hide all the shipping methods, and show only free shipping method, when free shipping is available during checkout 139 * Readme content change 140 * Tested with WooCommerce 8.6.1 141 126 142 == Upgrade Notice == 127 143 128 = 2.0.1 = 129 * Handled PHP compatibility issue 130 * Tested with WordPress 6.4.3 131 * Tested with WooCommerce 8.5.2 144 = 3.0.0 = 145 * Feature to hide all the shipping methods, and show only free shipping method, when free shipping is available during checkout 146 * Tested with WooCommerce 8.6.1 -
user-role-based-shipping-method/trunk/includes/class-pvalley-user-role-based-shipping-manage-shipping.php
r2673900 r3048574 26 26 $this->shipping_based_on = ! empty(self::$settings['general_settings_shipping_based_on']) ? self::$settings['general_settings_shipping_based_on'] : array(); 27 27 add_filter( 'woocommerce_package_rates', array( $this, 'manage_shipping_methods'), 10, 2 ); 28 add_filter("woocommerce_package_rates", array($this, "hide_shipping_methods"), 999); 29 } 30 31 /** 32 * Hide shipping methods based on the selected option. 33 * 34 * @param $rates 35 * 36 * @return array|mixed 37 */ 38 public function hide_shipping_methods($rates) { 39 $show_only = ! empty(self::$settings['show_only']) ? self::$settings['show_only'] : ""; 40 switch ($show_only) { 41 case "free_shipping": 42 return $this->show_only_free_shipping( $rates ); 43 default: 44 return $rates; 45 } 46 } 47 48 /** 49 * Hide all the shipping methods other than Free Shipping method. 50 * 51 * it will be applicable only when Free Shipping is available. 52 * 53 * It won't hide any shipping methods when there is no Free Shipping methods. 54 * 55 * @param $rates 56 * 57 * @return array|mixed 58 */ 59 public function show_only_free_shipping($rates) { 60 $free = array(); 61 foreach ( $rates as $rate_id => $rate ) { 62 if ( 'free_shipping' === $rate->method_id ) { 63 $free[ $rate_id ] = $rate; 64 break; 65 } 66 } 67 return ! empty( $free ) ? $free : $rates; 28 68 } 29 69 -
user-role-based-shipping-method/trunk/includes/class-pvalley-user-role-based-shipping-settings.php
r2278152 r3048574 10 10 */ 11 11 public function __construct() { 12 13 12 $this->id = 'pvalley_role_based_shipping'; 14 13 $this->label = __( 'Role Baed Shipping', 'pvalley-user-role-based-shipping' ); … … 74 73 'type' => 'checkbox', 75 74 'id' => 'pvalley_user_role_based_shipping[general_settings_enable]' 75 ), 76 "general_settings_hide_shipping_methods" => array( 77 "name" => __("Hide shipping methods", "pvalley-user-role-based-shipping"), 78 "type" => "select", 79 "options" => array( 80 "" => __("Select"), 81 "free_shipping" => __("Show Free Shipping Only, hide other shipping methods", "pvalley-user-role-based-shipping") 82 ), 83 "class" => "wc-enhanced-select", 84 "id" => "pvalley_user_role_based_shipping[show_only]", 85 "desc" => "It will be applied only if Free Shipping is available during checkout. It's not related to rule matrix. It can be used without rule matrix." 76 86 ), 77 87 'general_settings_shipping_based_on' => array( -
user-role-based-shipping-method/trunk/pvalley-user-role-based-shipping.php
r3036404 r3048574 4 4 * Plugin URI: 5 5 * Description: Hide/show shipping methods based on user role and destination country. 6 * Version: 2.0.16 * Version: 3.0.0 7 7 * Author: Pluginvalley 8 8 * Author URI: … … 11 11 * Requires at least: 5.0 12 12 * WC requires at least: 3.0.0 13 * WC tested up to: 8. 5.213 * WC tested up to: 8.6.1 14 14 */ 15 15 -
user-role-based-shipping-method/trunk/readme.txt
r3036411 r3048574 6 6 Requires at least: 5.0 7 7 Tested up to: 6.4 8 Stable tag: 2.0.18 Stable tag: 3.0.0 9 9 License: GPLv3 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html 11 11 12 Role based Shipping Method Plugin for WooCommerce. Manage Shipping Rates based on User Roles and destination country.12 Display WooCommerce shipping methods based on User Role and Country. Globally compatible. 13 13 14 14 == Introduction == 15 15 16 Hide/show woocommerce shipping methods based on user role and destination country.16 Display WooCommerce shipping methods based on User Role and country, Option to hide all other shipping methods when Free Shipping is available. 17 17 18 18 == Description == 19 It will allow you to hide/show the WooCommerce Shipping methods based on User Role. It will also allow you to manage the WooCommerce Shipping methods based on Shipping Country. You can use it with Flat Rate / Free Shipping / Local Pickup or any other third party shipping plugin. 19 It will allow you to hide WooCommerce Shipping methods based on user role and country. It is globally compatible i.e. You can use it with Flat Rate / Free Shipping / Local Pickup or any other third party shipping plugin. 20 It also provides you an option to show only Free Shipping when Free Shipping is available during checkout by removing all other shipping methods. 20 21 21 22 Do you wish to provide Woocommerce Shipping Cost based on User Role ? 23 Do you wish to provide WooCommerce Shipping Cost based on Shipping Country ? 24 Are you still struggling to setup the Woocommerce Shipping Cost based on User Role and Destination Country ? 22 Do you want to show shipping methods based on user role? 23 Do you want to show shipping methods based on shipping country? 24 Are you still struggling to set up the Woocommerce Shipping Cost based on User Role and Destination Country ? 25 25 26 26 Here's the solution for your requirement. Setup Flat Rate / Free Shipping or Shipping Cost using any third Party Plugin and Manage them Which Shipping Cost need to be shown to which user and for which country. 27 27 28 28 = Features = 29 * Manage WooCommerce Shipping Method based on User role. 30 * Manage WooCommerce Shipping Method based on Country. 31 * Manage Woocommerce Shipping Method based on User role and Destination Country. 32 * Manage shipping method based on shipping method name or label 29 * Display shipping methods based on user role 30 * Display shipping methods based on shipping country 31 * Option to hide all other shipping methods and shown only Free Shipping when Free Shipping is available during checkout 33 32 34 33 == Installation == … … 43 42 == Frequently Asked Questions == 44 43 44 = Compatibility? = 45 46 Globally Compatible. It is compatible with all the shipping methods offered by WooCommerce and third party plugins. 47 48 = How to display Free Shipping only? = 49 50 Go to General section in plugin settings page. 51 Enable the plugin and under Hide shipping methods select option to Show Free Shipping Only, hide other shipping methods. 52 Note It's independent of rule matrix. 53 It will only work when Free Shipping is available during checkout. 54 45 55 = How to setup the plugin? = 46 56 … … 51 61 Woocommerce store info: Assume our store offer three shipping methods - Standard Delivery, Express Shipping, One Day Shipping. 52 62 53 Case 1: I want to show One Day Shipping method to Administrator user role in USA.63 Case 1: I want to show One Day Shipping method to Administrator user role in the USA. 54 64 55 To ach eive it add a new rule in Rules settings page.65 To achieve it add a new rule in Rules settings page. 56 66 * Select Administrator in User Role field. 57 67 * Select United States in Countries field. … … 61 71 * Now go to shop page add any product and recalculate the shipping cost by changing the address, Standard Delivery and Express Shipping method won't be shown. 62 72 63 Case 2: I want to show Standard Delivery, Express Shipping method to Guest user role in USA.73 Case 2: I want to show Standard Delivery, Express Shipping method to Guest user role in the USA. 64 74 65 To ach eive it add a new rule in Rules settings page.75 To achieve it add a new rule in Rules settings page. 66 76 * Select Guest in User Role field. 67 77 * Select United States in Countries field. … … 76 86 77 87 = Plugin not working after setting the plugin? = 78 If you have done the plugin setup and you still don't see any change in cart/checkout page then please try to recalculate the shipping cost by changing the address because by default woocommerce will show you the cached shipping methods. 88 If you have done the plugin setup, and you still don't see any change in cart/checkout page then please try to recalculate the shipping cost by changing the address because 89 by default woocommerce will show you the cached shipping methods. 79 90 80 91 = Sample Video = … … 88 99 3. Value of Shipping Method to hide 89 100 4. Shipping method hidden 90 5. Multiple shipping method rule configuration for si gle user role101 5. Multiple shipping method rule configuration for single user role 91 102 6. Shipping method hidden based on label / name 92 103 … … 114 125 * Compatibility with WordPress 5.9 115 126 * Compatibility with WooCommerce 6.1.1 116 * New option to hide shipping method based on shipping method name / title / lab le127 * New option to hide shipping method based on shipping method name / title / label 117 128 118 129 = 2.0.1 = … … 124 135 * Tested with WooCommerce 8.5.2 125 136 137 = 3.0.0 = 138 * Feature to hide all the shipping methods, and show only free shipping method, when free shipping is available during checkout 139 * Readme content change 140 * Tested with WooCommerce 8.6.1 141 126 142 == Upgrade Notice == 127 143 128 = 2.0.1 = 129 * Handled PHP compatibility issue 130 * Tested with WordPress 6.4.3 131 * Tested with WooCommerce 8.5.2 144 = 3.0.0 = 145 * Feature to hide all the shipping methods, and show only free shipping method, when free shipping is available during checkout 146 * Tested with WooCommerce 8.6.1
Note: See TracChangeset
for help on using the changeset viewer.