Code Duplication    Length = 5-5 lines in 2 locations

includes/class-wc-ajax.php 2 locations

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