Skip to content

Shopify logs and fixes#418

Open
priyanshizip wants to merge 18 commits intofrappe:developfrom
sahilvikas:shopify-logs-and-fixes
Open

Shopify logs and fixes#418
priyanshizip wants to merge 18 commits intofrappe:developfrom
sahilvikas:shopify-logs-and-fixes

Conversation

@priyanshizip
Copy link
Copy Markdown

No description provided.

sahilvikas and others added 15 commits December 17, 2025 14:03
…cate item handling

- Add intelligent fallback mapping for line items without product_id
  * Tips -> SHOPIFY-TIP
  * Samples -> SHOPIFY-SAMPLE
  * Rush fees -> SHOPIFY-RUSH-FEE
  * Adjustments -> SHOPIFY-ADJUSTMENT
  * Other -> SHOPIFY-MISC

- Skip syncing items with null product_id in create_items_if_not_exist()
- Add error handling for duplicate item errors to prevent order sync failures
- Enhance get_order_items() to process null product_id items before product_exists check
- Improve _match_sku_and_link_item() to match by both SKU and product_id
- Add comprehensive logging for fallback item mapping and errors

Fixes expected String to be a id error when orders contain tips, samples, or other non-product line items
- Added Store 2 configuration fields to Shopify Setting DocType
- Created Shopify Webhook Store 2 child DocType for Store 2 webhooks
- Implemented store-aware webhook routing via X-Shopify-Shop-Domain header
- Modified API session decorator to use correct store credentials
- Added automatic webhook registration/unregistration for Store 2
- Updated order, invoice, and fulfillment processors with store context
- Graceful error handling prevents Store 2 issues from affecting Store 1
- Full backward compatibility maintained for Store 1
Changes:
- Fix indentation error in connection.py debug logging
- Add comprehensive debug logging for store matching in webhooks
- Propagate store context to background jobs:
  * sync_sales_order() in order.py
  * prepare_sales_invoice() in invoice.py
  * prepare_delivery_note() in fulfillment.py
- Set frappe.local.shopify_store_name in all background job functions
- Ensures @temp_shopify_session uses correct store credentials

Fixes Store 2 (0ish15-bq.myshopify.com) webhooks failing to create Sales Orders
- Add floating-point tolerance (0.01) for amount comparisons
- Skip line item comparison if shopify_line_item_id not available
- Remove transaction_date comparison (created_at never changes)
- Only log real business changes, ignore metadata updates
- Early return for metadata-only updates on submitted orders
- Server Script trigger only runs for real changes
@priyanshizip priyanshizip requested a review from ankush as a code owner March 4, 2026 05:00
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.

3 participants