import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.promotion.listRules("promo_123", "rules")
.then(({ rules }) => {
console.log(rules)
}){
"rules": [
{
"id": "<string>",
"values": [
"cusgroup_123"
],
"description": "<string>",
"attribute": "customer_group_id",
"operator": "gt"
}
]
}Retrieve a list of rules in a promotion. The type of rules retrieved depend on the value of the rule_type path parameter:
If rule_type is rules, the promotion’s rules are retrivied. - If rule_type is target-rules, the target rules of the promotion’s application method are retrieved.
If rule_type is buy-rules, the buy rules of the promotion’s application method are retrieved.
import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.promotion.listRules("promo_123", "rules")
.then(({ rules }) => {
console.log(rules)
}){
"rules": [
{
"id": "<string>",
"values": [
"cusgroup_123"
],
"description": "<string>",
"attribute": "customer_group_id",
"operator": "gt"
}
]
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The promotion's ID.
The type of rules to retrieve.
rules, target-rules, buy-rules Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.
The type The promotion's type.
standard, buyget The promotion's application method type.
fixed, percentage The promotion's application method target type.
items, shipping_methods, order OK
The list of promotion rules.
The list of promotion rules.
Show child attributes
The promotion rule's ID.
The promotion rule's description.
The promotion rule's attribute.
"customer_group_id"
The rule's operator.
gt, lt, eq, ne, in, lte, gte