Could you confirm the exact functionality you are looking to build.
If you are looking for all products to be discounted that are in certain collections this can be done with the built in discount configurations, and does not need to be implemented with functions.
Hi
We build widget for merchants and we need to apply auto-discount only for specific products in collections. Now we use one-time discount codes for this purposes, but it’s a bit mess and also inconvenient for clients.
It will be cool to have an option to apply function discount for specific collection in the cart as we have in code-discounts.