From aa39293c684fd0ec611836d1728016db0c93ab99 Mon Sep 17 00:00:00 2001 From: Woo Date: Tue, 28 May 2024 10:12:37 +0000 Subject: [PATCH] Updates to 2.5.1 --- changelog.txt | 3 ++- public/class-woocommerce-role-based-methods.php | 11 +++++------ readme.txt | 4 ++-- woocommerce-role-based-methods.php | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/changelog.txt b/changelog.txt index eb2e1a2..f8d6bd1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,7 @@ *** WooCommerce Role Based Methods *** -Unreleased +2024-05-27 - version 2.5.1 +* Fix issue where no methods are available on initial install 2023-07-17 - version 2.5.0 * HPOS compatibility (no significant code changed) diff --git a/public/class-woocommerce-role-based-methods.php b/public/class-woocommerce-role-based-methods.php index 00dfd57..d2bba18 100755 --- a/public/class-woocommerce-role-based-methods.php +++ b/public/class-woocommerce-role-based-methods.php @@ -171,13 +171,12 @@ public function get_available_shipping_methods( $rates ) { public function check_rolea_methods( $the_role, $rate_id ) { $rate_id = apply_filters( 'wc_role_based_rate_id', $rate_id ); - // The role isn't even defined in here, get out - if ( isset( $this->shipping_options[ $the_role ] ) ) { - $role_options = $this->shipping_options[ $the_role ]; - } else { - return false; + if ( ! $this->shipping_options || ! isset( $this->shipping_options[ $the_role ] ) ) { + return true; } + $role_options = $this->shipping_options[$the_role]; + // Check if user is in one of the allowed groups, but only if groups plugin is installed. $active_in_groups = false; if ( function_exists( '_groups_get_tablename' ) && $this->allowed_shipping_groups ) { @@ -188,7 +187,7 @@ public function check_rolea_methods( $the_role, $rate_id ) { } } - if ( ( isset( $role_options[ $rate_id ] ) && 'on' === $role_options[ $rate_id ] ) || ! $this->shipping_options ) { + if ( ( isset( $role_options[ $rate_id ] ) && 'on' === $role_options[ $rate_id ] ) ) { $active_in_roles = true; } else { $active_in_roles = false; diff --git a/readme.txt b/readme.txt index 8bd8025..5c82a61 100755 --- a/readme.txt +++ b/readme.txt @@ -2,8 +2,8 @@ Contributors: brianjhanson Tags: woocommerce Requires at least: 4.0 -Tested up to: 7.5 -Stable tag: 2.5.0 +Tested up to: 8.9 +Stable tag: 2.5.1 This plugin adds role-based control of shipping and payment methods for WooCommerce diff --git a/woocommerce-role-based-methods.php b/woocommerce-role-based-methods.php index cb897a8..4fdd4a0 100755 --- a/woocommerce-role-based-methods.php +++ b/woocommerce-role-based-methods.php @@ -3,7 +3,7 @@ * Plugin Name: WooCommerce Role Based Methods * Plugin URI: https://woocommerce.com/products/role-based-payment-shipping-methods/ * Description: This plugin provides an interface for role-based control over WooCommerce payment and shipping methods. - * Version: 2.5.0 + * Version: 2.5.1 * Author: WPBackOffice * Author URI: http://www.wpbackoffice.com * Developer: Brian Hanson @@ -13,7 +13,7 @@ * * Woo: 18732:ea88b3bd7b5c2de3924b6291ff598710 * WC requires at least: 4.0 - * WC tested up to: 7.7 + * WC tested up to: 8.9 * * Copyright: © 2015-2018 WPBackOffice. * License: GNU General Public License v3.0