mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 14:57:26 +08:00
Fix more than 1 shipping option selected problem
This commit is contained in:
parent
1de6039d5b
commit
c011ce659f
1 changed files with 2 additions and 5 deletions
|
@ -50,9 +50,7 @@ class ShippingOptionFactory {
|
|||
$cart->calculate_shipping();
|
||||
|
||||
$chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods', array() );
|
||||
if ( ! is_array( $chosen_shipping_methods ) ) {
|
||||
$chosen_shipping_methods = array();
|
||||
}
|
||||
$chosen_shipping_method = $chosen_shipping_methods[0] ?? false;
|
||||
|
||||
$packages = WC()->shipping()->get_packages();
|
||||
$options = array();
|
||||
|
@ -62,11 +60,10 @@ class ShippingOptionFactory {
|
|||
if ( ! $rate instanceof \WC_Shipping_Rate ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$options[] = new ShippingOption(
|
||||
$rate->get_id(),
|
||||
$rate->get_label(),
|
||||
in_array( $rate->get_id(), $chosen_shipping_methods, true ),
|
||||
$rate->get_id() === $chosen_shipping_method,
|
||||
new Money(
|
||||
(float) $rate->get_cost(),
|
||||
get_woocommerce_currency()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue