> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: getEligibleTriggers(options: Options, context: Context) # Method package: wixEcom # Method menu location: wixEcom --> EcomCustomDiscountTriggers --> getEligibleTriggers # Method Link: https://dev.wix.com/docs/velo/events-service-plugins/e-commerce/service-plugins/ecom-custom-discount-triggers/get-eligible-triggers.md # Method Description: Retrieves eligible custom discount triggers based on the provided items. The retrieved custom triggers are based on your own business logic. The `getEligibleTriggers()` function determines whether a cart or checkout's items meet the conditions for a discount to apply to an item. The function is automatically called by Wix eCommerce when actions are performed on the cart or checkout entities/pages. For example, when adding an item to the cart. ### Where to find `getEligibleTriggers()` When you [add the Custom Discount Trigger plugin](https://dev.wix.com/docs/develop-websites/articles/code-tutorials/wix-e-commerce-stores/tutorial-custom-discount-trigger-service-plugin.md#step-1-create-a-new-custom-discount-trigger-plugin), a folder is automatically added to your site. Use the `.js` file in the folder to write the code to retrieve custom triggers. For more information on setting up your custom triggers, see [Tutorial: Custom Discount Trigger Service Plugin](https://dev.wix.com/docs/develop-websites/articles/code-tutorials/wix-e-commerce-stores/tutorial-custom-discount-trigger-service-plugin.md#custom-triggersjs). # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Return trigger based on the color of an item ```javascript export const getEligibleTriggers = (options) => { const colors = options.lineItems.map(item => item.catalogReference.options.options.Color); let result; if (colors.includes("Grey")) { result = { eligibleTriggers: [ { customTriggerId: "1", identifier: options.triggers[0].identifier } ] } } else { result = { eligibleTriggers: [] } } return result }; ``` ---