mirror of
https://github.com/vercel/commerce.git
synced 2025-05-15 22:16:58 +00:00
fix: some minor fixes
This commit is contained in:
parent
cce421c418
commit
2e1ca6eabc
@ -1,5 +1,5 @@
|
||||
import { isEmpty } from '../utils';
|
||||
import { MedusaProductVariant, RegionInfo } from './types';
|
||||
import { MedusaProductVariant, Money, RegionInfo } from './types';
|
||||
|
||||
type ComputeAmountParams = {
|
||||
amount: number;
|
||||
@ -20,7 +20,10 @@ export const computeAmount = ({ amount, region, includeTaxes = true }: ComputeAm
|
||||
return amountWithTaxes;
|
||||
};
|
||||
|
||||
export const calculateVariantAmount = (variant: MedusaProductVariant) => {
|
||||
/**
|
||||
* Takes a product variant, and returns the amount as a decimal including or excluding taxes and the currency code
|
||||
*/
|
||||
export const calculateVariantAmount = (variant: MedusaProductVariant): Money => {
|
||||
const currencyCode = variant.prices?.[0]?.currency_code ?? 'USD';
|
||||
const amount = convertToDecimal(variant.prices?.[0]?.amount || 0, currencyCode).toString();
|
||||
return {
|
||||
|
@ -414,10 +414,7 @@ export type CartItem = MedusaLineItem & {
|
||||
title: string;
|
||||
};
|
||||
cost: {
|
||||
totalAmount: {
|
||||
amount: string;
|
||||
currencyCode: string;
|
||||
};
|
||||
totalAmount: Money;
|
||||
};
|
||||
quantity: number;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user