Skip to main content

Weight Filter via URL Parameters

The Weight Filter via URL Parameters plugin enables filtering of product listings by weight via URL parameters. Customers and external systems can restrict product listings to a specific weight range by passing min-weight and max-weight directly in the URL. The plugin is ready to use immediately after activation and requires no further configuration.

How It Works

The plugin registers an event subscriber on the ProductListingCriteriaEvent. Every time a product listing is loaded, the handler checks the incoming URL parameters. If min-weight or max-weight are set, a RangeFilter on the product.weight field is added to the listing criteria. Filtering takes place server-side before the database query is executed.

URL ParameterDescription
min-weightMinimum weight in kilograms (inclusive)
max-weightMaximum weight in kilograms (inclusive)

Both parameters can be used independently or combined. If only max-weight is set, the minimum value is automatically set to 0.

Installation

Requirements:

  • Shopware 6.5 or higher
  • Composer

Install via Composer:

composer require jjideenschmiede/shopware6-weight-filter-plugin

Then activate the plugin in the Shopware Admin under Settings → System → Plugins.

Usage

Filtering is done exclusively via URL parameters on product listing URLs. No changes to the Shopware Admin or theme are required.

Minimum weight only:

/category?min-weight=2.5

Shows all products weighing at least 2.5 kg.

Maximum weight only:

/category?max-weight=10

Shows all products weighing at most 10 kg.

Weight range:

/category?min-weight=2&max-weight=10

Shows all products weighing between 2 kg and 10 kg.