Code Duplication    Length = 11-14 lines in 2 locations

includes/widgets/class-wc-widget-rating-filter.php 1 location

@@ 78-88 (lines=11) @@
75
		}
76
77
		// All current filters
78
		if ( $_chosen_attributes = WC_Query::get_layered_nav_chosen_attributes() ) {
79
			foreach ( $_chosen_attributes as $name => $data ) {
80
				$filter_name = sanitize_title( str_replace( 'pa_', '', $name ) );
81
				if ( ! empty( $data['terms'] ) ) {
82
					$link = add_query_arg( 'filter_' . $filter_name, implode( ',', $data['terms'] ), $link );
83
				}
84
				if ( 'or' == $data['query_type'] ) {
85
					$link = add_query_arg( 'query_type_' . $filter_name, 'or', $link );
86
				}
87
			}
88
		}
89
90
		return $link;
91
	}

includes/widgets/class-wc-widget-layered-nav.php 1 location

@@ 307-320 (lines=14) @@
304
		}
305
306
		// All current filters
307
		if ( $_chosen_attributes = WC_Query::get_layered_nav_chosen_attributes() ) {
308
			foreach ( $_chosen_attributes as $name => $data ) {
309
				if ( $name === $taxonomy ) {
310
					continue;
311
				}
312
				$filter_name = sanitize_title( str_replace( 'pa_', '', $name ) );
313
				if ( ! empty( $data['terms'] ) ) {
314
					$link = add_query_arg( 'filter_' . $filter_name, implode( ',', $data['terms'] ), $link );
315
				}
316
				if ( 'or' == $data['query_type'] ) {
317
					$link = add_query_arg( 'query_type_' . $filter_name, 'or', $link );
318
				}
319
			}
320
		}
321
322
		return $link;
323
	}