Code Duplication    Length = 5-5 lines in 2 locations

includes/class-wc-ajax.php 2 locations

@@ 239-243 (lines=5) @@
236
237
		$chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods' );
238
239
		if ( isset( $_POST['shipping_method'] ) && is_array( $_POST['shipping_method'] ) ) {
240
			foreach ( $_POST['shipping_method'] as $i => $value ) {
241
				$chosen_shipping_methods[ $i ] = wc_clean( $value );
242
			}
243
		}
244
245
		WC()->session->set( 'chosen_shipping_methods', $chosen_shipping_methods );
246
@@ 282-286 (lines=5) @@
279
280
		$chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods' );
281
282
		if ( isset( $_POST['shipping_method'] ) && is_array( $_POST['shipping_method'] ) ) {
283
			foreach ( $_POST['shipping_method'] as $i => $value ) {
284
				$chosen_shipping_methods[ $i ] = wc_clean( $value );
285
			}
286
		}
287
288
		WC()->session->set( 'chosen_shipping_methods', $chosen_shipping_methods );
289
		WC()->session->set( 'chosen_payment_method', empty( $_POST['payment_method'] ) ? '' : $_POST['payment_method'] );