diff --git a/plugins/woocommerce-admin/client/marketplace/components/product-card/product-card.tsx b/plugins/woocommerce-admin/client/marketplace/components/product-card/product-card.tsx index bfc1bd0f321..bee4d46b0a8 100644 --- a/plugins/woocommerce-admin/client/marketplace/components/product-card/product-card.tsx +++ b/plugins/woocommerce-admin/client/marketplace/components/product-card/product-card.tsx @@ -9,7 +9,6 @@ import { Button, Card } from '@wordpress/components'; */ import './product-card.scss'; import { Product } from '../product-list/types'; -import { getAdminSetting } from '../../../../client/utils/admin-settings'; import { appendUTMParams } from '../../utils/functions'; export interface ProductCardProps { @@ -19,7 +18,8 @@ export interface ProductCardProps { function ProductCard( props: ProductCardProps ): JSX.Element { const { product } = props; - const currencySymbol = getAdminSetting( 'currency' )?.symbol; + // We hardcode this for now while we only display prices in USD. + const currencySymbol = '$'; // Append UTM parameters to the vendor URL let vendorUrl = ''; @@ -76,12 +76,15 @@ function ProductCard( props: ProductCardProps ): JSX.Element { variant="link" > - { product.price === 0 || product.price === '0' - ? __( 'Free download', 'woocommerce' ) - : currencySymbol + product.price } + { + // '0' is a free product + product.price === 0 + ? __( 'Free download', 'woocommerce' ) + : currencySymbol + product.price + } - { product.price === 0 || product.price === '0' + { product.price === 0 ? '' : __( ' annually', 'woocommerce' ) } diff --git a/plugins/woocommerce-admin/client/marketplace/components/product-list/types.ts b/plugins/woocommerce-admin/client/marketplace/components/product-list/types.ts index 910e4d096c8..dd29e3686a6 100644 --- a/plugins/woocommerce-admin/client/marketplace/components/product-list/types.ts +++ b/plugins/woocommerce-admin/client/marketplace/components/product-list/types.ts @@ -5,6 +5,7 @@ export type SearchAPIProductType = { link: string; demo_url: string; price: string; + raw_price: number; hash: string; slug: string; id: number; @@ -23,9 +24,8 @@ export interface Product { vendorUrl: string; icon: string; url: string; - price: string | number; + price: number; productType?: string; averageRating?: number | null; reviewsCount?: number | null; - currency?: string; } diff --git a/plugins/woocommerce-admin/client/marketplace/contexts/product-list-context.tsx b/plugins/woocommerce-admin/client/marketplace/contexts/product-list-context.tsx index 261f5def64f..bdbdb14da56 100644 --- a/plugins/woocommerce-admin/client/marketplace/contexts/product-list-context.tsx +++ b/plugins/woocommerce-admin/client/marketplace/contexts/product-list-context.tsx @@ -78,10 +78,10 @@ export function ProductListContextProvider( vendorUrl: product.vendor_url, icon: product.icon, url: product.link, - price: product.price, + // Due to backwards compatibility, raw_price is from search API, price is from featured API + price: product.raw_price ?? product.price, averageRating: product.rating ?? 0, reviewsCount: product.reviews_count ?? 0, - currency: '', }; } );