includes/class-wc-stripe-apple-pay.php 1 location
|
@@ 263-273 (lines=11) @@
|
| 260 |
|
throw new Exception( __( 'Unable to find shipping method for address.', 'woocommerce-gateway-stripe' ) ); |
| 261 |
|
} |
| 262 |
|
|
| 263 |
|
foreach ( $package['rates'] as $key => $rate ) { |
| 264 |
|
$data[] = array( |
| 265 |
|
'id' => $rate->id, |
| 266 |
|
'label' => $rate->label, |
| 267 |
|
'amount' => array( |
| 268 |
|
'currency' => $currency, |
| 269 |
|
'value' => $rate->cost, |
| 270 |
|
), |
| 271 |
|
'selected' => false, |
| 272 |
|
); |
| 273 |
|
} |
| 274 |
|
} |
| 275 |
|
|
| 276 |
|
// Auto select the first shipping method. |
includes/class-wc-stripe-payment-request.php 1 location
|
@@ 181-193 (lines=13) @@
|
| 178 |
|
// Set the shipping options. |
| 179 |
|
$currency = get_woocommerce_currency(); |
| 180 |
|
$data = array(); |
| 181 |
|
foreach ( WC()->shipping->get_packages() as $package_key => $package ) { |
| 182 |
|
foreach ( $package['rates'] as $key => $rate ) { |
| 183 |
|
$data[] = array( |
| 184 |
|
'id' => $rate->id, |
| 185 |
|
'label' => $rate->label, |
| 186 |
|
'amount' => array( |
| 187 |
|
'currency' => $currency, |
| 188 |
|
'value' => $rate->cost, |
| 189 |
|
), |
| 190 |
|
'selected' => false, |
| 191 |
|
); |
| 192 |
|
} |
| 193 |
|
} |
| 194 |
|
|
| 195 |
|
// Auto select when have only one shipping method available. |
| 196 |
|
if ( 1 === count( $data ) ) { |