Skip to content

Commit f098467

Browse files
Backport compliance changes to 2025-07 (#3477)
* Adds DiscountAllocation to CartLineItem API Following the lead of https://shopify.dev/docs/api/storefront/latest/objects/DiscountAllocation. * Adds return and refund ids to ReturnTransactionData and ExchangeTransactionData * POS: adds receipt header block target --------- Co-authored-by: Alex Graffeo-Cohen <[email protected]>
1 parent 0723f0e commit f098467

File tree

9 files changed

+33
-0
lines changed

9 files changed

+33
-0
lines changed

.changeset/discount-allocations.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/ui-extensions': minor
3+
---
4+
5+
Added optional `discountAllocations` field to Cart Line Item API so that POS extensions can see the precise proportion of a discount applied to a particular line item. Only the `allocatedAmount` field is included for this purpose, matching the Storefront API structure. See https://shopify.dev/docs/api/storefront/latest/objects/DiscountAllocation.

.changeset/hip-seas-change.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/ui-extensions': minor
3+
---
4+
5+
Adds pos.receipt-header.block.render extension target
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/ui-extensions': minor
3+
---
4+
5+
Modified transaction data interface fields to include returnId and refundId to Return and Exchange TransactionData.

packages/ui-extensions/src/surfaces/point-of-sale/event/data/ExchangeTransactionData.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {LineItem} from '../../types/cart';
33

44
export interface ExchangeTransactionData extends BaseTransactionComplete {
55
transactionType: 'Exchange';
6+
returnId?: number;
67
exchangeId?: number;
78
lineItemsAdded: LineItem[];
89
lineItemsRemoved: LineItem[];

packages/ui-extensions/src/surfaces/point-of-sale/event/data/ReturnTransactionData.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {LineItem} from '../../types/cart';
33

44
export interface ReturnTransactionData extends BaseTransactionComplete {
55
transactionType: 'Return';
6+
refundId?: number;
67
returnId?: number;
78
exchangeId?: number;
89
lineItems: LineItem[];

packages/ui-extensions/src/surfaces/point-of-sale/targets.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ export interface ExtensionTargets {
185185
{[key: string]: any} & StorageApi & TransactionCompleteWithReprintData,
186186
ReceiptComponents
187187
>;
188+
'pos.receipt-header.block.render': RenderExtension<
189+
{[key: string]: any} & StorageApi & TransactionCompleteWithReprintData,
190+
ReceiptComponents
191+
>;
188192
}
189193

190194
export type ExtensionTarget = keyof ExtensionTargets;

packages/ui-extensions/src/surfaces/point-of-sale/types/cart.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {CountryCode} from './country-code';
22
import {TaxLine} from './tax-line';
3+
import {DiscountAllocation} from './discount-allocation';
34

45
export interface Cart {
56
/**
@@ -40,6 +41,7 @@ export interface LineItem {
4041
variantId?: number;
4142
productId?: number;
4243
discounts: Discount[];
44+
discountAllocations?: DiscountAllocation[];
4345
taxable: boolean;
4446
taxLines: TaxLine[];
4547
sku?: string;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import type {MoneyV2} from './money';
2+
3+
export interface DiscountAllocation {
4+
allocatedAmount: MoneyV2;
5+
}

packages/ui-extensions/src/surfaces/point-of-sale/types/money.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ export interface Money {
22
amount: number;
33
currency: string;
44
}
5+
6+
export interface MoneyV2 {
7+
amount: string;
8+
currencyCode: string;
9+
}

0 commit comments

Comments
 (0)