> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - 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
};
```

---