Code Duplication    Length = 11-14 lines in 2 locations

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

@@ 298-311 (lines=14) @@
295
		}
296
297
		// All current filters
298
		if ( $_chosen_attributes = WC_Query::get_layered_nav_chosen_attributes() ) {
299
			foreach ( $_chosen_attributes as $name => $data ) {
300
				if ( $name === $taxonomy ) {
301
					continue;
302
				}
303
				$filter_name = sanitize_title( str_replace( 'pa_', '', $name ) );
304
				if ( ! empty( $data['terms'] ) ) {
305
					$link = add_query_arg( 'filter_' . $filter_name, implode( ',', $data['terms'] ), $link );
306
				}
307
				if ( 'or' == $data['query_type'] ) {
308
					$link = add_query_arg( 'query_type_' . $filter_name, 'or', $link );
309
				}
310
			}
311
		}
312
313
		return $link;
314
	}

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
	}