How to change the Grid Gallery filter settings programmatically

Hello Ahmad,
The Grid Gallery widget filter options are based on the products’ collections. See a live example here: https://www.bboptic.com/okulary-korekcyjne
So, I want to filter based on the product’s collection.