Skip to content

Commit 118d183

Browse files
khliengkidunot89
andauthored
fix: warnings in fillCart with empty coupons/shippingMethods (#613)
* fix: warnings in fillCart with empty coupons/shippingMethods * chore: WPCS compliance met Co-authored-by: Geoff Taylor <[email protected]>
1 parent 223bde6 commit 118d183

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

includes/mutation/class-cart-fill.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ public static function mutate_and_get_payload() {
194194
throw new UserError( __( 'Failed to add any cart items. Please check input.', 'wp-graphql-woocommerce' ) );
195195
}
196196

197-
$applied = array();
197+
$applied = array();
198+
$invalid_coupons = array();
198199
if ( ! empty( $input['coupons'] ) ) {
199-
$invalid_coupons = array();
200200
foreach ( $input['coupons'] as $code ) {
201201
$reason = '';
202202
// If validate and successful applied to cart, return payload.
@@ -224,15 +224,15 @@ public static function mutate_and_get_payload() {
224224
}
225225
}//end if
226226

227-
$chosen_shipping_methods = array();
227+
$chosen_shipping_methods = array();
228+
$invalid_shipping_methods = array();
228229
if ( ! empty( $input['shippingMethods'] ) ) {
229230
$posted_shipping_methods = $input['shippingMethods'];
230231

231232
// Get current shipping methods.
232233
$chosen_shipping_methods = \WC()->session->get( 'chosen_shipping_methods' );
233234

234235
// Update current shipping methods.
235-
$invalid_shipping_methods = array();
236236
foreach ( $posted_shipping_methods as $package => $chosen_method ) {
237237
if ( empty( $chosen_method ) ) {
238238
continue;

0 commit comments

Comments
 (0)