Skip to content

Commit

Permalink
Updates to 2.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Woo committed May 28, 2024
1 parent 1e71139 commit aa39293
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
3 changes: 2 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
11 changes: 5 additions & 6 deletions public/class-woocommerce-role-based-methods.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions woocommerce-role-based-methods.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit aa39293

Please sign in to comment.