Code Duplication    Length = 5-5 lines in 2 locations

includes/class-wc-ajax.php 2 locations

@@ 244-248 (lines=5) @@
241
242
		$chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods' );
243
244
		if ( isset( $_POST['shipping_method'] ) && is_array( $_POST['shipping_method'] ) ) {
245
			foreach ( $_POST['shipping_method'] as $i => $value ) {
246
				$chosen_shipping_methods[ $i ] = wc_clean( $value );
247
			}
248
		}
249
250
		WC()->session->set( 'chosen_shipping_methods', $chosen_shipping_methods );
251
@@ 303-307 (lines=5) @@
300
301
		$chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods' );
302
303
		if ( isset( $_POST['shipping_method'] ) && is_array( $_POST['shipping_method'] ) ) {
304
			foreach ( $_POST['shipping_method'] as $i => $value ) {
305
				$chosen_shipping_methods[ $i ] = wc_clean( $value );
306
			}
307
		}
308
309
		WC()->session->set( 'chosen_shipping_methods', $chosen_shipping_methods );
310
		WC()->session->set( 'chosen_payment_method', empty( $_POST['payment_method'] ) ? '' : $_POST['payment_method'] );