AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Magento Promotions

skill-magendooro-magento-claude-skills-magento-promotions · by magendooro

Manage Magento cart price rules and coupons via admin REST API. Covers sales rule search, rule detail, coupon search, and coupon generation. Requires MAGENTO_ADMIN_TOKEN.

No reviews yet
0 installs
25 views
0.0% view→install

Install

$ agentstack add skill-magendooro-magento-claude-skills-magento-promotions

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access Used
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-magendooro-magento-claude-skills-magento-promotions)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
4mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Magento Promotions? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Magento Promotions & Coupons (REST)

Cart price rules define discount logic; coupons are codes that trigger specific rules.

Configuration

  • Base: ${MAGENTO_BASE_URL}/rest/${MAGENTO_STORE_CODE:-default}/V1/
  • Auth: Authorization: Bearer ${MAGENTO_ADMIN_TOKEN}

Operation 1: Search Sales Rules (Cart Price Rules)

curl -s -g "${MAGENTO_BASE_URL}/rest/${MAGENTO_STORE_CODE:-default}/V1/salesRules/search?searchCriteria[filterGroups][0][filters][0][field]=is_active&searchCriteria[filterGroups][0][filters][0][value]=1&searchCriteria[filterGroups][0][filters][0][conditionType]=eq&searchCriteria[pageSize]=20&searchCriteria[sortOrders][0][field]=rule_id&searchCriteria[sortOrders][0][direction]=DESC" \
  -H "Authorization: Bearer ${MAGENTO_ADMIN_TOKEN}" \
  -H "Content-Type: application/json"

Common filters:

| What | Field | Condition | |------|-------|-----------| | Active rules only | is_active | eq = 1 | | By name | name | like = %summer% | | By coupon type | coupon_type | eq = 1 (no coupon), 2 (specific coupon), 3 (auto-generated) | | Valid now | from_date | lteq today + to_date | gteq today (two filterGroups) |

Extract: rule_id, name, description, is_active, coupon_type, discount_amount, discount_step, simple_action, from_date, to_date, uses_per_customer, uses_per_coupon

Discount types (simple_action)

| Code | Meaning | |------|---------| | by_percent | % discount on cart | | by_fixed | Fixed amount off cart | | cart_fixed | Fixed discount applied to whole cart | | buy_x_get_y | Buy X get Y free | | by_percent on shipping | Shipping discount |


Operation 2: Get Sales Rule by ID

curl -s "${MAGENTO_BASE_URL}/rest/${MAGENTO_STORE_CODE:-default}/V1/salesRules/${RULE_ID}" \
  -H "Authorization: Bearer ${MAGENTO_ADMIN_TOKEN}" \
  -H "Content-Type: application/json"

Key fields:

  • discount_amount — value (% or fixed depending on simple_action)
  • discount_qty — max qty discounted per item
  • discount_step — buy-X step for buyxget_y
  • uses_per_coupon — max uses per coupon code (0 = unlimited)
  • uses_per_customer — max uses per customer
  • conditions_serialized — JSON rule conditions (product/cart conditions)
  • customer_group_ids[] — which customer groups qualify
  • website_ids[] — which websites the rule applies to

Operation 3: Search Coupons for a Rule

curl -s -g "${MAGENTO_BASE_URL}/rest/${MAGENTO_STORE_CODE:-default}/V1/salesRules/coupons/search?searchCriteria[filterGroups][0][filters][0][field]=rule_id&searchCriteria[filterGroups][0][filters][0][value]=${RULE_ID}&searchCriteria[filterGroups][0][filters][0][conditionType]=eq&searchCriteria[pageSize]=50" \
  -H "Authorization: Bearer ${MAGENTO_ADMIN_TOKEN}" \
  -H "Content-Type: application/json"

Extract: coupon_id, rule_id, code, usage_limit, usage_per_customer, times_used, created_at, expiration_date, is_primary


Operation 4: Search All Coupons (by code or rule)

# Find a specific coupon code
curl -s -g "${MAGENTO_BASE_URL}/rest/${MAGENTO_STORE_CODE:-default}/V1/salesRules/coupons/search?searchCriteria[filterGroups][0][filters][0][field]=code&searchCriteria[filterGroups][0][filters][0][value]=SUMMER20&searchCriteria[filterGroups][0][filters][0][conditionType]=eq" \
  -H "Authorization: Bearer ${MAGENTO_ADMIN_TOKEN}" \
  -H "Content-Type: application/json"

Operation 5: Generate Coupons (Write — Confirm First)

The rule must have coupon_type: 3 (auto-generated) for this endpoint to work.

Confirm: "I'll generate ${QTY} coupon(s) for rule ${RULE_NAME} (ID: ${RULE_ID}), length ${LENGTH} chars, prefix ${PREFIX}. Confirm? (yes/no)"

# Use jq to safely build JSON — prevents injection if RULE_ID/QTY are non-numeric
curl -s -X POST "${MAGENTO_BASE_URL}/rest/${MAGENTO_STORE_CODE:-default}/V1/salesRules/${RULE_ID}/generate-coupon" \
  -H "Authorization: Bearer ${MAGENTO_ADMIN_TOKEN}" \
  -H "Content-Type: application/json" \
  -d "$(jq -n \
    --argjson rule_id "${RULE_ID}" \
    --argjson qty "${QTY:-5}" \
    --arg prefix "${PREFIX:-SUMMER-}" \
    --arg expiry "${EXPIRY_DATE:-2024-12-31}" \
    '{"couponSpec": {"rule_id": $rule_id, "quantity": $qty, "length": 12, "format": "alphanum", "prefix": $prefix, "suffix": "", "delimiter": "-", "delimiter_at_every": 4, "expiration_date": $expiry}}')"

Parameter reference:

  • quantity — number of coupons to generate
  • length — total code length (including prefix/suffix)
  • formatalphanum (letters+digits), alpha (letters only), num (digits only)
  • prefix / suffix — optional fixed strings prepended/appended
  • delimiter + delimiter_at_every — e.g., delimiter=-, every=4 → XXXX-XXXX-XXXX
  • expiration_date — optional expiry (YYYY-MM-DD); if omitted, rule's to_date applies

Response: array of generated coupon codes.


Response Formatting

Rules list:

1. Rule #5 — Summer Sale 20% (active)
   Type: by_percent | 20% off | Coupon: auto-generated
   Valid: 2024-06-01 → 2024-08-31 | Uses/coupon: 1 | Uses/customer: 1

2. Rule #3 — Free Shipping over $50 (active)
   Type: shipping discount | 100% off shipping | No coupon required

Coupon list:

Coupons for rule #5 (Summer Sale 20%):
SUMM-ERXX-2024  | used 0/1 | expires 2024-08-31
SUMM-ABCD-2024  | used 1/1 | expires 2024-08-31

Generated coupons:

Generated 5 coupons for "Summer Sale 20%":
SUMMER-A4KZ-NP19
SUMMER-BM7X-QR42
SUMMER-CV3Y-WT08
SUMMER-DH6W-JS71
SUMMER-EK2V-LU95

Error Handling

  • "Coupon generation is allowed for rules with auto-generated coupons only" (HTTP 400): Rule's coupon_type is not 3. Cannot auto-generate; coupons must be added manually via Admin.
  • HTTP 404 on rule: Rule ID doesn't exist or is not accessible for this store.
  • Empty coupon list: Rule uses a fixed coupon code (coupon_type: 2), not auto-generated ones. Fetch the primary coupon from the rule's code field directly.

Decision Table

| User says | Action | |-----------|--------| | "active promotions" / "current discounts" | Op 1 with is_active=1 | | "rule #5 details" | Op 2 | | "coupons for rule 5" | Op 3 | | "find coupon SUMMER20" | Op 4 search by code | | "generate 10 coupons for rule 5" | Op 2 to verify type=3 → Confirm → Op 5 | | "how many times was coupon X used?" | Op 4 search by code → extract times_used |

User Request

$ARGUMENTS

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.