Code Duplication    Length = 9-10 lines in 2 locations

includes/class-wc-cart.php 2 locations

@@ 409-418 (lines=10) @@
406
			foreach ( $this->applied_coupons as $code ) {
407
				$coupon = new WC_Coupon( $code );
408
409
				if ( ! $coupon->is_valid() ) {
410
					// Error message
411
					$coupon->add_coupon_message( WC_Coupon::E_WC_COUPON_INVALID_REMOVED );
412
413
					// Remove the coupon
414
					$this->remove_coupon( $code );
415
416
					// Flag totals for refresh
417
					WC()->session->set( 'refresh_totals', true );
418
				}
419
			}
420
		}
421
@@ 1685-1693 (lines=9) @@
1682
								$usage_count = $usage_count + sizeof( array_keys( $used_by, $check_email ) );
1683
							}
1684
1685
							if ( $usage_count >= $coupon->usage_limit_per_user ) {
1686
								$coupon->add_coupon_message( WC_Coupon::E_WC_COUPON_USAGE_LIMIT_REACHED );
1687
1688
								// Remove the coupon
1689
								$this->remove_coupon( $code );
1690
1691
								// Flag totals for refresh
1692
								WC()->session->set( 'refresh_totals', true );
1693
							}
1694
						}
1695
					}
1696
				}