---
id: change/bcapps/8554
type: change
title: "#8554 [Shopify] Fix incorrect G/L line on credit memo for refund with exchange item"
summary: Shopify connector now correctly handles credit memos for refunds involving exchange items by tracking exchange line items separately and emitting offsetting credit memo lines instead of incorrect G/L refund account entries.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - enum shpfy graphql type
  - codeunit shpfy refunds api
  - page shpfy refund lines
  - table shpfy refund line
  - codeunit shpfy create sales doc. refund
  - codeunit shpfy import order
system: integration
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:11:58.784Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 3239a62f50c3078f0fa4ce7eddb3a8ef3cd5dfb0
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/8554
    title: "microsoft/BCApps#8554: [Shopify] Fix incorrect G/L line on credit memo for refund with exchange item"
    date: "2026-07-21"
    commit: 3239a62f50c3078f0fa4ce7eddb3a8ef3cd5dfb0
    t: null
    quote: null
links:
  learn: []
  objects:
    - object/enum/30111
    - object/codeunit/30228
    - object/page/30146
    - object/table/30145
    - object/codeunit/30246
    - object/codeunit/30161
    - object/codeunit/30166
    - object/page/30122
    - object/table/30119
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 8554
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/8554
kind: pr
base_branch: main
major: "30"
merged_at: "2026-07-21T10:23:23Z"
author: onbuyuka
author_type: User
community_contribution: false
labels:
  - "AL: Apps (W1)"
  - "Team: Integrations"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 17
  additions: 416
  deletions: 1
  al: 9
apps:
  - Shopify
objects_touched:
  - key: enum/30111
    page: enum/30111
    type: enum
    id: 30111
    name: Shpfy GraphQL Type
    app: Shopify
    status: modified
  - key: codeunit/30228
    page: codeunit/30228
    type: codeunit
    id: 30228
    name: Shpfy Refunds API
    app: Shopify
    status: modified
  - key: page/30146
    page: page/30146
    type: page
    id: 30146
    name: Shpfy Refund Lines
    app: Shopify
    status: modified
  - key: table/30145
    page: table/30145
    type: table
    id: 30145
    name: Shpfy Refund Line
    app: Shopify
    status: modified
  - key: codeunit/30246
    page: codeunit/30246
    type: codeunit
    id: 30246
    name: Shpfy Create Sales Doc. Refund
    app: Shopify
    status: modified
  - key: codeunit/30161
    page: codeunit/30161
    type: codeunit
    id: 30161
    name: Shpfy Import Order
    app: Shopify
    status: modified
  - key: codeunit/30166
    page: codeunit/30166
    type: codeunit
    id: 30166
    name: Shpfy Process Order
    app: Shopify
    status: modified
  - key: page/30122
    page: page/30122
    type: page
    id: 30122
    name: Shpfy Order Subform
    app: Shopify
    status: modified
  - key: table/30119
    page: table/30119
    type: table
    id: 30119
    name: Shpfy Order Line
    app: Shopify
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 637828
systems:
  - integration
quote: null
joined_against:
  major: "30"
  commit: ecbc028c25dbe83b61313bc566e6c1d41184bb1c
---

# #8554 [Shopify] Fix incorrect G/L line on credit memo for refund with exchange item

> Shopify connector now correctly handles credit memos for refunds involving exchange items by tracking exchange line items separately and emitting offsetting credit memo lines instead of incorrect G/L refund account entries.

[Pull request](https://github.com/microsoft/BCApps/pull/8554) · merged into `main` (BC30) on 2026-07-21 by onbuyuka · 17 files (+416 -1), 9 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Tracks exchange items from Shopify via new paginated GraphQL queries on both order and refund imports
- Marks exchange-item order lines and skips them during sales invoice creation to prevent double-counting
- Generates synthetic negative-quantity refund lines during refund import to offset the exchange value in credit memos
- Resolves location from the fulfillment data when creating the credit memo line for exchange items
- Fixes incorrect G/L account posting that previously doubled the customer-balance impact of exchange values
- Behaviour changes for users or extensions.

## AL objects touched

- [Enum 30111 "Shpfy GraphQL Type"](../../objects/enum/30111.md), Shopify: modified
- [Codeunit 30228 "Shpfy Refunds API"](../../objects/codeunit/30228.md), Shopify: modified
- [Page 30146 "Shpfy Refund Lines"](../../objects/page/30146.md), Shopify: modified
- [Table 30145 "Shpfy Refund Line"](../../objects/table/30145.md), Shopify: modified
- [Codeunit 30246 "Shpfy Create Sales Doc. Refund"](../../objects/codeunit/30246.md), Shopify: modified
- [Codeunit 30161 "Shpfy Import Order"](../../objects/codeunit/30161.md), Shopify: modified
- [Codeunit 30166 "Shpfy Process Order"](../../objects/codeunit/30166.md), Shopify: modified
- [Page 30122 "Shpfy Order Subform"](../../objects/page/30122.md), Shopify: modified
- [Table 30119 "Shpfy Order Line"](../../objects/table/30119.md), Shopify: modified

## Context

- Work items: AB#637828
- Labels: AL: Apps (W1), Team: Integrations
- Systems: integration

Source: metadata of a merged pull request in microsoft/BCApps (bcapps): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).
