Skip to content

Add Shopify Discount Code Endpoints#21403

Closed
Ap-0007 wants to merge 1 commit into
PipedreamHQ:masterfrom
Ap-0007:agent/fix-21402-action-add-actions-for-shopify
Closed

Add Shopify Discount Code Endpoints#21403
Ap-0007 wants to merge 1 commit into
PipedreamHQ:masterfrom
Ap-0007:agent/fix-21402-action-add-actions-for-shopify

Conversation

@Ap-0007

@Ap-0007 Ap-0007 commented Jul 16, 2026

Copy link
Copy Markdown

What was broken

Missing Shopify Discount Code endpoints

What changed

Added GET, PUT, DELETE, and POST endpoints for Shopify Discount Codes

How to test

Test each endpoint with a valid Shopify API key and discount code


Opened by autonomous agent. Human review required before merge.

Summary by CodeRabbit

  • New Features
    • Added Shopify discount-code management capabilities.
    • Added support for retrieving, updating, and deleting individual discount codes.
    • Added support for creating multiple discount codes in a single operation.

@vercel

vercel Bot commented Jul 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
pipedream-docs-redirect-do-not-edit Ignored Ignored Jul 16, 2026 7:35am

Request Review

@pipedream-component-development

Copy link
Copy Markdown
Collaborator

Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified.

@pipedream-component-development

Copy link
Copy Markdown
Collaborator

Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The Shopify integration now exports four asynchronous discount-code actions for retrieving, updating, deleting, and bulk-creating discount codes through the injected Shopify service.

Changes

Shopify discount code actions

Layer / File(s) Summary
Discount code action set
components/shopify/actions.js
Defines the Shopify integration metadata and service prop, then adds GET, PUT, DELETE, and bulk POST actions for discount codes.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • Issue 21402 — Directly requests the four Shopify Discount Code REST actions implemented here.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the change and testing, but it misses required template sections for versioning, new app confirmation, and CodeRabbit review. Add the template's Summary and Checklist sections, including version bumps, app integration confirmation, and acknowledgement of CodeRabbit comments.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: new Shopify discount code endpoints.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9917890047

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -0,0 +1,91 @@
export default {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Publish these as real action components

In the contexts I checked (.github/workflows/publish-components.yaml publishes each changed component file directly, and existing Shopify actions live under components/shopify/actions/<slug>/<slug>.mjs with top-level key and type: "action"), this new top-level actions.js is treated as one component file rather than expanded into four actions. Because the exported object has no top-level action key/type and is not imported by shopify.app.mjs, the discount-code operations will not be available in the registry; they need to be added as normal action component files or explicitly wired into the supported publish path.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/shopify/actions.js`:
- Around line 84-88: Update the discount-code payload in async run() to
transform string entries in this.codes into objects with a code property before
calling Shopify’s price_rules batch endpoint, while preserving entries already
supplied as pre-formatted objects. Pass the normalized array as discount_codes.
- Around line 84-88: Update the request construction in async run() to transform
this.codes into Shopify’s required discount_codes object array, wrapping string
entries as objects with a code property while preserving entries already
supplied as objects. Pass the normalized array in the existing post call and
retain the current endpoint and response behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: cb8c906a-fcc0-4b13-a423-dedf35a0c9ec

📥 Commits

Reviewing files that changed from the base of the PR and between e08dd49 and 9917890.

📒 Files selected for processing (1)
  • components/shopify/actions.js

Comment on lines +84 to +88
async run() {
return await this.shopify.post(`price_rules/${this.priceRuleId}/batch.json`, {
discount_codes: this.codes
})
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Map string arrays to object arrays for the Shopify API.

The Shopify bulk discount creation endpoint expects discount_codes to be an array of objects (e.g., [{"code": "SUMMER1"}]), but the framework's array props typically collect and return an array of strings when used from the UI. Passing string items directly will cause a Shopify API validation error.

Map the array items to objects, while safely handling cases where a user might pass pre-formatted objects via a custom expression.

🐛 Proposed fix
       async run() {
         return await this.shopify.post(`price_rules/${this.priceRuleId}/batch.json`, {
-          discount_codes: this.codes
+          discount_codes: this.codes.map(code => typeof code === "string" ? { code } : code)
         })
       }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async run() {
return await this.shopify.post(`price_rules/${this.priceRuleId}/batch.json`, {
discount_codes: this.codes
})
}
async run() {
return await this.shopify.post(`price_rules/${this.priceRuleId}/batch.json`, {
discount_codes: this.codes.map(code => typeof code === "string" ? { code } : code)
})
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/shopify/actions.js` around lines 84 - 88, Update the discount-code
payload in async run() to transform string entries in this.codes into objects
with a code property before calling Shopify’s price_rules batch endpoint, while
preserving entries already supplied as pre-formatted objects. Pass the
normalized array as discount_codes.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Map string arrays to object arrays for the Shopify API.

The Shopify bulk discount creation endpoint expects discount_codes to be an array of objects (e.g., [{"code": "SUMMER1"}]), but Pipedream array props typically accept and return an array of strings when used in the UI. Passing strings directly will cause a Shopify API validation error.

Map the array items to objects while safely handling cases where a user might pass pre-formatted objects via a custom expression.

💻 Proposed fix
       async run() {
         return await this.shopify.post(`price_rules/${this.priceRuleId}/batch.json`, {
-          discount_codes: this.codes
+          discount_codes: this.codes.map(code => typeof code === "string" ? { code } : code)
         })
       }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async run() {
return await this.shopify.post(`price_rules/${this.priceRuleId}/batch.json`, {
discount_codes: this.codes
})
}
async run() {
return await this.shopify.post(`price_rules/${this.priceRuleId}/batch.json`, {
discount_codes: this.codes.map(code => typeof code === "string" ? { code } : code)
})
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/shopify/actions.js` around lines 84 - 88, Update the request
construction in async run() to transform this.codes into Shopify’s required
discount_codes object array, wrapping string entries as objects with a code
property while preserving entries already supplied as objects. Pass the
normalized array in the existing post call and retain the current endpoint and
response behavior.

@ashwins01 ashwins01 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Ap-0007, thank you for your contribution, but the changes are not aligned with the contribution guidelines at https://pipedream.com/docs/components/contributing/guidelines
Please feel free to take a look at the existing actions/sources of the Shopify connector on how best to submit a contribution going forward.

@ashwins01

Copy link
Copy Markdown
Contributor

Closing this in favour of #21428

@Ap-0007

Ap-0007 commented Jul 22, 2026

Copy link
Copy Markdown
Author

Awesome, thanks for the feedback! I'll make sure to include all required template sections in the description moving forward. The PR will be updated ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

User submitted Submitted by a user

Development

Successfully merging this pull request may close these issues.

5 participants