Code Duplication    Length = 11-14 lines in 2 locations

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

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

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

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