Skip to content

Conversation

@engahmed1190
Copy link

Description:
This PR introduces major enhancements to the Shopify integration by adding multi-tenant support and standardizing account resolution logic across all modules.

Key Changes

  • Multi-Tenant Architecture

    • Introduced Shopify Account doctype for company-specific settings.
    • Enabled support for multiple Shopify stores with isolated configurations.
    • Updated product sync, order processing, inventory management, and fulfillment to be account-aware.
    • Webhook handling now routes events by shop domain.
    • Maintains backward compatibility with the legacy singleton configuration.
  • Standardized Account Resolution

    • Added resolve_account_context utility for consistent account resolution across modules.
    • Simplified temp_shopify_session decorator using the new account resolution flow.
  • UI & Developer Enhancements

    • Added account selection UI to the product import page.
    • Included comprehensive tests and documentation.

Impact

  • Enables multiple Shopify stores per ERPNext instance while keeping data and settings fully isolated.
  • Improves maintainability and reduces duplicated account resolution logic.
  • Backward compatible for existing single-store setups.

…ation

Add support for multiple Shopify stores with isolated configurations per company. Introduce Shopify Account doctype to replace legacy singleton settings. Update all core functions to be account-aware including product sync, order processing, inventory management, and webhook handling. Maintain backward compatibility with existing installations.

- Add Shopify Account doctype with company-specific settings
- Modify product, order, inventory, and fulfillment logic to support multi-tenancy
- Update webhook handling to route events by shop domain
- Add account selection UI to product import page
- Include comprehensive tests and documentation
Introduce resolve_account_context utility to handle account resolution consistently
Update all modules to use the new standardized account resolution
Simplify temp_shopify_session decorator with new account handling
@engahmed1190 engahmed1190 requested a review from ankush as a code owner August 13, 2025 17:08
@engahmed1190
Copy link
Author

@ankush can you review this PR to close #373

engahmed1190 and others added 15 commits August 13, 2025 18:11
- Update Shopify Account doctype with clearer authentication labels and add shop URL field
- Simplify old order sync logic by removing redundant checks
- Refactor location fetching to use direct session management
Move Shopify location fetching logic to a dedicated method with proper error handling and logging. This improves code organization and maintainability while providing better error tracking.
Replace reference_document parameter with account parameter in create_shopify_log calls
Update create_shopify_log to handle account context in message instead of reference_document
… inventory settings section for better organization
- Add required customer group field for customer sync
- Move fetch_shopify_locations to separate handler
- Clean up comments and redundant code
- Improve form query setup organization
…ments

- Add default_sales_tax_account and default_shipping_charges_account fields
- Set form intro description for better user guidance
- Make shop_domain read-only after save to prevent accidental changes
Pass account parameter through sync chain to ensure proper context
Update method name from import_all_products to queue_sync_all_products
Use centralized ecommerce_item.is_synced check for consistency
[CS-61 Fix the logic by adding setting.is_enabled() condition]
- Removed legacy singleton references and replaced with account-based settings for Shopify integration.
- Updated inventory synchronization logic to utilize user-specific Shopify accounts.
- Simplified functions for handling sales invoices and orders by eliminating account parameters where unnecessary.
- Enhanced product synchronization methods to operate without explicit account context.
- Improved error handling and logging for better traceability during synchronization processes.
- Streamlined JavaScript code for product import to remove account selection, focusing on a single account context.
- Added utility functions to fetch Shopify accounts based on user permissions and company associations.
- Add company support for multi-tenant.
- Complete integration functionalities including shopify hooks.
- improve logging
@tomemmerson
Copy link

Hi @engahmed1190,
Will this also work with the new app system in shopify (ClientID + Secret), given legacy custom apps will now be unavailable from January 2026?

Thanks
Tom

goondeal and others added 7 commits November 17, 2025 15:08
…companies

Cs 86 shopify support multi companies
…-with-prices

set shopify product price as a shopify_selling_rate in the newly created erpnext item
…-with-prices

Enhance retry functionality and Shopify account handling in Ecommerce Integration Log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants