Skip to content

Enhance Shopify order queries with complete order data including line items #17611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 24, 2025

Conversation

seynadio
Copy link
Contributor

@seynadio seynadio commented Jul 14, 2025

Summary

  • Updated GET_ORDER query to include comprehensive order information including complete line items with product and variant details, shipping and billing addresses, fulfillment tracking information, payment transactions and refunds, tax lines and discount allocations, and all financial breakdowns
  • Updated LIST_ORDERS query to include line items with product information, order status and fulfillment details, customer and shipping information, and essential financial data
  • Provides complete order data including all items, customer info, shipping details, and fulfillment tracking when retrieving orders

Summary by CodeRabbit

  • New Features

    • Expanded order and customer data retrieval, providing more detailed information for orders, customers, line items, fulfillments, transactions, refunds, and related fields.
  • Chores

    • Incremented version numbers for multiple actions and sources to reflect recent updates.
    • Updated package version to 0.8.1.

… items

- Updated GET_ORDER query to include comprehensive order information:
  - Complete line items with product and variant details
  - Shipping and billing addresses
  - Fulfillment tracking information
  - Payment transactions and refunds
  - Tax lines and discount allocations
  - All financial breakdowns (subtotal, shipping, tax, discounts)

- Updated LIST_ORDERS query to include:
  - Line items with product information
  - Order status and fulfillment details
  - Customer and shipping information
  - Essential financial data

This provides complete order data including all items, customer info, shipping details, and fulfillment tracking when retrieving orders.
Copy link

vercel bot commented Jul 14, 2025

@seynadio is attempting to deploy a commit to the Pipedreamers Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Jul 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jul 23, 2025 2:57pm

Copy link
Contributor

coderabbitai bot commented Jul 14, 2025

Walkthrough

This update consists primarily of version number increments across a wide range of action and source modules within the Shopify developer app, reflecting minor, non-functional changes. Additionally, the GraphQL queries for orders have been significantly expanded and refactored, introducing broader and deeper data retrieval for order and customer information.

Changes

Files/Groups Change Summary
.../actions/add-product-to-custom-collection.mjs
.../actions/add-tags.mjs
.../actions/create-custom-collection.mjs
.../actions/create-customer.mjs
.../actions/create-order.mjs
.../actions/create-product.mjs
.../actions/create-smart-collection.mjs
.../actions/search-custom-collection-by-name.mjs
.../actions/search-customers.mjs
.../actions/search-orders.mjs
.../actions/search-product-variant.mjs
.../actions/search-products.mjs
.../actions/update-inventory-level.mjs
Version number incremented in each default export object; no logic or structural changes.
.../actions/create-article.mjs
.../actions/create-blog.mjs
.../actions/create-metafield.mjs
.../actions/create-metaobject.mjs
.../actions/create-page.mjs
.../actions/create-product-variant.mjs
.../actions/delete-article.mjs
.../actions/delete-blog.mjs
.../actions/delete-metafield.mjs
.../actions/delete-page.mjs
.../actions/get-articles.mjs
.../actions/get-metafields.mjs
.../actions/get-metaobjects.mjs
.../actions/get-order/get-order.mjs
.../actions/update-article.mjs
.../actions/update-customer.mjs
.../actions/update-metafield.mjs
.../actions/update-metaobject.mjs
.../actions/update-page.mjs
.../actions/update-product-variant.mjs
.../actions/update-product.mjs
Version number incremented in each default export object; no logic or structural changes.
.../sources/new-abandoned-cart.mjs
.../sources/new-article.mjs
.../sources/new-cancelled-order.mjs
.../sources/new-customer-created.mjs
.../sources/new-draft-order.mjs
.../sources/new-event-emitted.mjs
.../sources/new-fulfillment-event.mjs
.../sources/new-order-created.mjs
.../sources/new-order-fulfilled.mjs
.../sources/new-page.mjs
.../sources/new-paid-order.mjs
.../sources/new-product-created.mjs
.../sources/new-product-updated.mjs
.../sources/new-refund-created.mjs
.../sources/new-updated-customer.mjs
.../sources/new-updated-order.mjs
.../sources/product-added-to-custom-collection.mjs
Version number incremented in each default export object; no logic or structural changes.
components/shopify_developer_app/common/queries.mjs Major refactor: Expanded and renamed GraphQL order queries, greatly increasing data coverage.
components/shopify_developer_app/package.json Package version updated from 0.8.0 to 0.8.1.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant ShopifyApp
  participant ShopifyAPI

  Client->>ShopifyApp: Request order details (GetOrder)
  ShopifyApp->>ShopifyAPI: Send expanded GetOrder GraphQL query
  ShopifyAPI-->>ShopifyApp: Return comprehensive order, customer, line item, fulfillment, transaction, and refund data
  ShopifyApp-->>Client: Respond with detailed order information
Loading

Estimated code review effort

2 (~20 minutes)

Poem

🐇
A hop and a skip, new versions appear,
With numbers that tick up, the changelog is clear.
Order queries now fetch with much greater might,
While the rest just update, keeping things light.
The code is refreshed, the carrots aligned—
Onward we bound, leaving bugs behind!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

components/shopify_developer_app/common/queries.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:202:49)


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd0633c and 8339371.

📒 Files selected for processing (1)
  • components/shopify_developer_app/common/queries.mjs (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (4)
components/shopify_developer_app/common/queries.mjs (4)

1-34: Query expansion looks good and aligns with PR objectives.

The renaming from "SuggestedRefund" to "GetOrder" and the addition of comprehensive order fields (name, timestamps, pricing sets) provide better clarity and more complete order data as intended.


35-90: Comprehensive financial breakdown enhances order data completeness.

The addition of detailed price sets (subtotal, current total, discounts, shipping, tax) with both shop and presentment money provides complete financial information for orders.


91-145: Customer and address data expansion improves order completeness.

The enhanced customer fields and comprehensive billing/shipping address information provide all necessary data for order processing and customer management.


546-700: LIST_ORDERS expansion provides comprehensive order data.

The significant expansion of the LIST_ORDERS query to include detailed customer, address, line item, and fulfillment data aligns well with the PR objectives to provide complete order information.

Note: The line items pagination issue flagged in previous reviews also applies here - consider adding pageInfo to the line items connection for consistency.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@adolfo-pd adolfo-pd added the User submitted Submitted by a user label Jul 14, 2025
@pipedream-component-development
Copy link
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
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:

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
components/shopify_developer_app/common/queries.mjs (2)

1-468: Consider performance implications of the expanded query.

The GET_ORDER query now fetches comprehensive order data with multiple levels of nested fields and pagination. This could lead to:

  • Increased response times for orders with many line items, fulfillments, or transactions
  • Higher memory usage and potential timeouts
  • Unnecessary data transfer if all fields aren't always needed

Consider implementing field selection based on specific use cases or creating multiple focused queries for different scenarios.


624-624: Inconsistent line items limit between queries.

The LIST_ORDERS query fetches only 50 line items per order while GET_ORDER fetches 250. This inconsistency might cause confusion. If this is intentional for performance reasons in list views, consider adding a comment to document this decision.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e21d334 and a403d99.

📒 Files selected for processing (1)
  • components/shopify_developer_app/common/queries.mjs (4 hunks)
🔇 Additional comments (2)
components/shopify_developer_app/common/queries.mjs (2)

25-89: Well-structured money amount fields.

The consistent implementation of price sets with both shopMoney and presentmentMoney throughout the queries is excellent. This ensures proper multi-currency support across all monetary values.

Also applies to: 162-193, 284-317, 359-368, 388-397, 413-432, 441-450, 554-593, 633-642


2-2: Update usages for renamed GetOrder query

The GraphQL query has been renamed from SuggestedRefund to GetOrder. There is no $refundLineItems variable—refundLineItems remains a nested field in the query, not a removed parameter.

Our rg search over .js, .ts, and .mjs files found:

  • No occurrences of SuggestedRefund
  • No references to a $refundLineItems variable

Please verify:

  • Any code (including .svelte, .vue, backend services, tests, etc.) importing or invoking the old SuggestedRefund query is updated to GetOrder
  • The new GraphQL variables ($id, $first, $after) are passed correctly where this query is used

michelle0927
michelle0927 previously approved these changes Jul 18, 2025
Copy link
Collaborator

@michelle0927 michelle0927 left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! Ready for QA!

@michelle0927 michelle0927 moved this from In Review to Ready for QA in Component (Source and Action) Backlog Jul 18, 2025
@vunguyenhung vunguyenhung moved this from Ready for QA to In QA in Component (Source and Action) Backlog Jul 21, 2025
@vunguyenhung vunguyenhung moved this from In QA to Changes Required in Component (Source and Action) Backlog Jul 21, 2025
@vunguyenhung
Copy link
Collaborator

Hello everyone, I have tested this PR and there're some test cases failed or needed improvement.

Please check the test report below for more information
https://vunguyenhung.notion.site/Enhance-Shopify-order-queries-with-complete-order-data-including-line-items-234bf548bb5e81a090efd039e67ab9ab

- Replace deprecated acceptsMarketing with emailMarketingConsent in Customer object
- Update ProductVariant weight fields to use inventoryItem.measurement.weight structure
- Replace requestedFulfillmentServiceId with requestedFulfillmentService object
- Update fulfillment service object to include correct fields (id, serviceName, handle)

These changes align with the current Shopify GraphQL API schema and fix the "Field doesn't exist" errors.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@michelle0927 michelle0927 moved this from Changes Required to Ready for QA in Component (Source and Action) Backlog Jul 21, 2025
@vunguyenhung vunguyenhung moved this from Ready for QA to In QA in Component (Source and Action) Backlog Jul 22, 2025
@vunguyenhung vunguyenhung moved this from In QA to Changes Required in Component (Source and Action) Backlog Jul 22, 2025
@vunguyenhung
Copy link
Collaborator

Hello everyone, I have tested this PR and there're some test cases failed or needed improvement.

Please check the test report below for more information
https://vunguyenhung.notion.site/Enhance-Shopify-order-queries-with-complete-order-data-including-line-items-234bf548bb5e81a090efd039e67ab9ab

Fix selectionMismatch error by removing emailMarketingConsent from customer queries in GET_ORDER and LIST_ORDERS.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@seynadio seynadio force-pushed the shopify-enhanced-order-data branch from fca708a to b93534d Compare July 22, 2025 04:59
@seynadio seynadio requested a review from michelle0927 July 22, 2025 05:00
@seynadio seynadio force-pushed the shopify-enhanced-order-data branch from a185f1b to b93534d Compare July 22, 2025 05:12
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🔭 Outside diff range comments (1)
components/shopify_developer_app/common/queries.mjs (1)

359-390: Transactions query missing pagination structure.

The transactions field uses first: 250 but lacks the standard GraphQL connection structure with edges, node, and pageInfo. This is inconsistent with other paginated fields in the query.

Fix the transactions structure to follow GraphQL connection pattern:

-      transactions(first: 250) {
-        id
-        status
-        kind
-        gateway
-        test
-        createdAt
-        processedAt
-        amountSet {
-          shopMoney {
-            amount
-            currencyCode
-          }
-          presentmentMoney {
-            amount
-            currencyCode
-          }
-        }
-        fees {
-          amount {
-            amount
-            currencyCode
-          }
-          flatFee {
-            amount
-            currencyCode
-          }
-          rate
-          rateName
-          type
-        }
-      }
+      transactions(first: 250) {
+        edges {
+          node {
+            id
+            status
+            kind
+            gateway
+            test
+            createdAt
+            processedAt
+            amountSet {
+              shopMoney {
+                amount
+                currencyCode
+              }
+              presentmentMoney {
+                amount
+                currencyCode
+              }
+            }
+            fees {
+              amount {
+                amount
+                currencyCode
+              }
+              flatFee {
+                amount
+                currencyCode
+              }
+              rate
+              rateName
+              type
+            }
+          }
+        }
+        pageInfo {
+          hasNextPage
+          endCursor
+        }
+      }
♻️ Duplicate comments (3)
components/shopify_developer_app/common/queries.mjs (3)

2-2: Query signature uses conflicting pagination parameters.

The $first and $after parameters are designed for the main order query but are being reused for nested metafields pagination, which can cause conflicts and prevent independent pagination control.

This issue was already identified in previous reviews but hasn't been addressed yet.


147-281: Line items query lacks pagination info despite high item limit.

The line items are fetched with a high limit (250) but without pageInfo, making it impossible to detect if there are more items beyond this limit. This could lead to incomplete data retrieval for orders with many line items.

This pagination issue was flagged in previous reviews but remains unaddressed.


631-677: LIST_ORDERS line items missing pagination info.

This is the same pagination issue identified in previous reviews for the LIST_ORDERS query line items.

🧹 Nitpick comments (1)
components/shopify_developer_app/common/queries.mjs (1)

1-476: Query complexity may impact performance.

The expanded GET_ORDER query now retrieves an extensive amount of nested data including detailed product information, variant details, fulfillments, transactions, and refunds. This comprehensive approach, while providing complete data, may result in slower response times and higher API rate limit consumption.

Consider implementing query fragments or separate specialized queries for different use cases to optimize performance:

// Example: Separate fragments for different data needs
const ORDER_BASIC_FRAGMENT = `
  fragment OrderBasic on Order {
    id
    name
    createdAt
    updatedAt
    displayFinancialStatus
    displayFulfillmentStatus
    totalPriceSet {
      shopMoney { amount currencyCode }
      presentmentMoney { amount currencyCode }
    }
  }
`;

const ORDER_DETAILED_FRAGMENT = `
  fragment OrderDetailed on Order {
    ...OrderBasic
    lineItems(first: 250) {
      edges { node { /* detailed fields */ } }
      pageInfo { hasNextPage endCursor }
    }
    fulfillments { /* detailed fields */ }
    transactions { /* detailed fields */ }
  }
`;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a185f1b and bd0633c.

📒 Files selected for processing (1)
  • components/shopify_developer_app/common/queries.mjs (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base
  • GitHub Check: Verify TypeScript components

@michelle0927 michelle0927 moved this from Changes Required to Ready for QA in Component (Source and Action) Backlog Jul 22, 2025
@vunguyenhung vunguyenhung moved this from Ready for QA to Changes Required in Component (Source and Action) Backlog Jul 23, 2025
@vunguyenhung
Copy link
Collaborator

Hello everyone, I have tested this PR and there're some test cases failed or needed improvement.

Please check the test report below for more information
https://vunguyenhung.notion.site/Enhance-Shopify-order-queries-with-complete-order-data-including-line-items-234bf548bb5e81a090efd039e67ab9ab

@michelle0927 michelle0927 moved this from Changes Required to Ready for QA in Component (Source and Action) Backlog Jul 23, 2025
@vunguyenhung vunguyenhung moved this from Ready for QA to In QA in Component (Source and Action) Backlog Jul 24, 2025
@vunguyenhung vunguyenhung moved this from In QA to Ready for Release in Component (Source and Action) Backlog Jul 24, 2025
@vunguyenhung
Copy link
Collaborator

@michelle0927 michelle0927 merged commit 391abb1 into PipedreamHQ:master Jul 24, 2025
10 of 11 checks passed
@github-project-automation github-project-automation bot moved this from Ready for Release to Done in Component (Source and Action) Backlog Jul 24, 2025
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.

6 participants