Migrate from 2024-04 to 2024-07
Upgrade to Shopify API version 2024-07 by updating order fields related to shipping and payment statuses.
What Changed
Order Payment and Shipping Status Fields
The `current_total_discounts` and `current_subtotal_price` fields in the Order resource have been deprecated and replaced with `current_total_discounts_set` and `current_subtotal_price_set`. Similarly, `total_shipping_price` and `total_shipping_price_set` are affected. The new set fields return values in a `MoneyV2` object, separating amount and currency. This change affects how you access and display discount and price information for orders.
order.current_total_discounts
order.current_total_discounts_set.shopMoney.amount
Migration Steps
- 1
Review Breaking Changes
codeCarefully examine the API release notes for version 2024-07, paying close attention to any deprecated fields or new behaviors. Specifically, identify all code paths that interact with the affected order fields.
- ↳Check the official Shopify API changelog for 2024-07.
- ↳Note down all query parameters and response fields that have changed.
- 2
Update API Client Configuration
configModify your application's configuration or environment variables to point to the new API version '2024-07'. This ensures that all subsequent API calls are made against the updated schema.
- ↳Ensure your API client library is configured to use the latest version.
- ↳Restart your application or relevant services after updating config.
- 3
Modify Code for Deprecated Fields
codeUpdate your codebase to use the new `_set` fields (e.g., `current_total_discounts_set`, `current_subtotal_price_set`) instead of the deprecated ones. This involves adjusting how you retrieve and process discount and price information.
- ↳Access the `shopMoney` object within the `_set` fields for amount and currency.
- ↳Implement fallback logic for older API versions if necessary for compatibility.
- 4
Implement Unit Tests
testWrite or update unit tests to cover the modified code paths. These tests should specifically verify that the new `_set` fields are being accessed and processed correctly, and that the values match expectations.
- ↳Mock API responses to simulate the new data structure.
- ↳Test edge cases like orders with zero discounts or specific currencies.
- 5
Perform Integration Testing
testExecute integration tests that involve fetching and processing order data. This ensures that your application behaves as expected when interacting with the Shopify Admin API using the 2024-07 version in a more realistic environment.
- ↳Test with a staging or development Shopify store.
- ↳Verify that order creation, update, and retrieval functions work correctly.
- 6
Deploy to Staging
deployDeploy the updated application to a staging environment that mirrors your production setup. This allows for a final round of testing before a full production rollout.
- ↳Use a CI/CD pipeline for consistent deployments.
- ↳Monitor staging logs for any unexpected errors.
- 7
Production Rollout
deployOnce staging tests are successful, deploy the changes to your production environment. Monitor your application closely after deployment for any issues.
- ↳Consider a phased rollout if possible.
- ↳Have a rollback plan in place.
- 8
Post-Deployment Verification
verifyActively monitor your application's performance and error logs in production. Verify that order-related data is being displayed and processed accurately, and that no new issues have emerged.
- ↳Check key metrics and user feedback.
- ↳Review Shopify Admin for discrepancies.
Testing Checklist
- 1.
Verify order discount retrieval
Fetch orders and assert that `current_total_discounts_set.shopMoney.amount` correctly reflects discounts.
- 2.
Verify order subtotal price retrieval
Fetch orders and assert that `current_subtotal_price_set.shopMoney.amount` is accurate.
- 3.
Verify currency handling
Fetch orders with different currencies and ensure amounts are correctly parsed with their respective currencies.
- 4.
Test orders with no discounts
Fetch orders that have no discounts applied and confirm the new fields return zero or appropriate null/empty values.
Common Mistakes
✗ Continuing to use deprecated fields like `current_total_discounts`.
API calls will start failing or return incorrect data, leading to application errors and incorrect financial reporting.
✓ Replace all usages of deprecated fields with their `_set` counterparts (e.g., `current_total_discounts_set.shopMoney.amount`).
✗ Not handling the `MoneyV2` object correctly.
Errors in parsing amounts or incorrect currency display, potentially causing issues with financial calculations.
✓ Access the `amount` and `currencyCode` properties within the `shopMoney` object of the `_set` fields.
✗ Insufficient testing of different order scenarios.
Undiscovered bugs related to edge cases (e.g., zero discounts, multiple currencies) that manifest in production.
✓ Thoroughly test with various order types, including those with and without discounts, shipping charges, and across different currencies.
Never get blindsided by an API change again
Deprecatr AI monitors 150+ providers, maps changes to your codebase, and delivers migration checklists before your team hits a breaking change.
Join the Waitlist