true when the variant is the parent's own purchasable unit.
isParentPurchasableUnit(
{ title: "NaBH4", quantity: 50, uom: "g" } as Product,
{ quantity: 50, uom: "g" },
); // => true
export function isParentPurchasableUnit(product: Product, variant: Variant): boolean {
const parentKey = variantSeriesKey(product, product);
return (
(parentKey !== undefined && variantSeriesKey(product, variant) === parentKey) ||
samePurchasableUnit(product, variant)
);
}
Reports whether a variant represents the same purchasable unit as its parent product — i.e. the supplier lists the parent among its own variants. Matches on price-history identity first (variantSeriesKey folds in the genuine vs. inherited id, then title/quantity/sku); some suppliers give the parent its own id/sku that differs from the matching variant's, so it also matches when the two are the same purchasable unit (see samePurchasableUnit).