Wix stores filter by category

Hi,
Would like to set a filter for products category.
Can’t find out how.
The products collection doesn’t include ‘category’ or a reference to category.

Please advise:)
Thanks, Dafna

Hi Dafna,

Here’s how you do it:
wixData.query(“Stores/Products”).hasSome(“collections.id”, [“62d6aa3c-51d8-2fd7-98c8-bf6f862ac0e5”]).find().then(console.log)
You can apply the same for a dataset is that’s what you need

You can get the collection id by opening the collection, clicking on “visible fields” in order to show the id column and then copy if from there.

I will make sure this gets added to the documentation.
Also, just FYI, we are working on a better way to allow this filter but it isn’t available yet.

Thanks,
Oded

Thanks Oded!!!
Wish me luck:)

Good luck :slight_smile:

It’s working!!!
Sooo happy:)
many many thanks!

trying to save CustomTextFields.
It seemd like the choices, but I didn’t succeed to save it.
Do you have a code example?

let myCustomText = {
“הערות” : $w(“#inputRemark”).value
};

if ($w(“#choiceUnitsKillo”).hidden === false) {
//set units / killo
let selection;
if ($w(“#unitRadio”).src === radioSelected) {
selection = “units”;
} else {
selection = “killo”;
}
//console.log("selection: " + selection);

let myChoices = {
“choice”: selection
};

$w(“#myShoppingCartIcon”).addToCart(currentId, Number($w(“#inputQuantuty”).value), {choices: myChoices}, {customTextFields: {myCustomText}})
.then(() => {

Thanks!

There’s a code example under the WixCode documentation site - http://www.wix.com/code/reference/$w.CartIcon.html#addToCart

Please let me know if you need further assistance

Thanks,
Oded

Hi Oded,
I issued a new post:

Can you please advise?
Thanks!
Dafna:)

Hi Oded, further discussion to Wix stores filter. Is there a code to take of the “all” option from the filter? TIA!

Hi,
Maybe I missing something here, but it seems like you just want to get all products?
If so, either using a dataset or wixData.query without a filter will get you exactly that.

Thanks,
Oded

@odeda Hi again, I meant take off the “all” option in the filter. I have a client who thinks having “all” is confusing and asks if Wix code can take care of taking it.

Hi,

You don’t need code to do this - in the gallery filter settings hide the collections filter and instead create a custom filter, name it “collections” and select all collections.

Thanks,
Oded

@odeda Thank you so MUCH! That was very helpful - and easy! :slight_smile:

Hi Dafna, can you share your code?
I tried to use nasSome() but this doesn’t work for me.

Is there a way to change the store filter to “and” from “or”, so the user can select multiple collections/filters. As it is now, If you select more than one filter it doesn’t work - it says “No items matched your search criteria. Try widening your search…” See here (select more than one collection) https://pauledesign.wixsite.com/sportours/liveaboard-diving