For product filters when you use the checkbox option when you choose an option it should refresh the page and it seems to add [0] or another number if more than one of the same type of filter is used.
But in the URL it encodes it as %5B0%5D where ‘%5B’ is [ and ‘%5D’ is ]. The filter still works which is fine but I am trying to set conditional displays so it only shows certain things when the URL parameter equals a certain value.
For example let’s say you were filtering product attribute pa_heat-output it should be b_pa_heat-output[0] in the URL as a parameter but the conditions don’t recognize b_pa_heat-output[0], b_pa_heat-output or b_pa_heat-output%5B0%5D. Can you please fix this please.
Hi,
Thanks so much for your report, and welcome to the forum!
As far as I can see, this is the default Woo filter behavior and, accordingly, not a bug. Please compare the behavior with the official Woo Storefront Theme:
The reason why e.g. commas are encoded is the following:
The URI spec, RFC 3986, specifies that URI path components not contain unencoded reserved characters and comma is one of the reserved characters. For sub-delims such as the comma, leaving it unencoded risks the character being treated as separator syntax in the URI scheme. Percent-encoding it guarantees the character will be passed through as data.
Hi Timmise,
Thanks for the response. I think in this case square brackets ‘[]’ are added for checkbox options rather than commas and as far as I can tell makes it so you can’t check it as a parameter for conditions. For your Storefront link it renders checkbox filters of multiple inputs of the same attribute differently than on Bricks, please see screenshots below.
The Storefront for attributes adds them to the same group like with green and black selected in the URL it is filter_color=black,green. But with Bricks to select two brand attributes it is ?b_pa_brand%5B0%5D=16&b_pa_brand%5B1%5D=44. What it is trying to do is be ?b_pa_brand[0]=16&b_pa_brand[1]=44. Either way for conditions it cannot check for b_pa_brand, b_pa_brand[] or b_pa_brand[0] as a parameter. While if you change the checkbox to a radio selector, it works fine in the URL and can work with conditions, so the issue is with checkbox as a selector for filters.
As the checkbox is supporting multiple values, using brackets is pretty normal in the product filter form by Bricks.
May I know what you mean by parameters for conditions? Do you mean you are using the Bricks condition {url_parameter} to show/hide certain elements in Bricks?
Can you give more info like what you want to achieve by detecting the filtered value?
May I know what you mean by parameters for conditions? Do you mean you are using the Bricks condition {url_parameter} to show/hide certain elements in Bricks?
I guess the overall issue is that any value using {url_parameter} that has the square brackets using the checkbox filter does not work when showing as a value or using as a condition. I planned to use this in a custom function to display conditional content about that brand depending on the multiple selections, but for example ‘b_pa_brand’, ‘b_pa_brand%5B0%5D’ or ‘b_pa_brand[0]’ all do not work and return nothing even though it has a value in the URL. While if it was a radio button the URL parameter would just be ‘b_pa_brand’ and does work.
So the issue is {url_parameter} does not work with square brackets from what I can gather.