create
This call creates a trigger. The arguments that must be included in the doc are described below:
Name | Type | Required | Description |
---|---|---|---|
action | string | true | create |
group_id | integer | true | The project the product is in |
doc | array | false | See doc parameters below |
Name | Type | Required | Description |
---|---|---|---|
reverse_trigger | boolean | false | If the user first meets a trigger condition and then later changes a value so the condition is not met, True will ensure the product is removed from the cart. This is generally the behavior you'd expect, and the default is True. |
action | associative array | true | Contains two variables product_id and action_type; see below for more. Ex. {
"action": {
product_id: [1, 2, etc...],
action_type:
"show_prod_in_list"
}
} |
product_id | array | true | A list of product id's you'd like the trigger to be set for. |
action_type | string | true | One of four actions the product can take when the trigger condition is met: add_product_no_show: This adds the product to the user's cart automatically when the conditions are met. Additionally it ensures that users who do not meet the condition can not select the product on the product selection widget. When adding automatically to a user, this is the most common option. show_prod_in_list: The product shows in the product selection widget where the user has the option can select it. remove_prod_from_list: Ensures that the product does not appear for users to select on the product selection widget. add_product: This adds the product automatically if they meet the conditions, but also shows the product to users who do not meet the condition on the product selection widget. |
conditions | associative array | true | Contains two variables andor and condition_list; see below for more. Ex. "conditions": {
"andor": "and",
"condition_list": [
{
"field_id": "instrument",
"field_value": "guitar"
},
{
etc...
}
]
} |
andor | string | true | When setting a trigger you can include one or more conditions. If adding multiple, "and" means all of the conditions must me true while "or" means that only one of the conditions must be true. Default is "and". |
condition_list | array | true | This is an array of associative arrays, each of which describes the trigger condition which must be met. To trigger on a field, you include field_id and field_value. To trigger on a status being applied to a user, you include status_id and action. action only has one argument, "set_status". This is met when a status is applied to a user. To trigger on the addition of some other product, include product_id and action. action only has one argument, "product_added". This is met when a product is added to a users cart, either through the API, manually by an admin, or by the user. Values are case sensitive. |