Freemium: update marketplace product card label (#45982)
* Freemium: update marketplace product card label * Add changefile(s) from automation for the following project(s): woocommerce * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
821d764b04
commit
23773e19f0
|
@ -67,6 +67,30 @@ function ProductCardFooter( props: { product: Product } ) {
|
|||
// We hardcode this for now while we only display prices in USD.
|
||||
const currencySymbol = '$';
|
||||
|
||||
function getPriceLabel(): string {
|
||||
if ( product.price === 0 ) {
|
||||
return __( 'Free download', 'woocommerce' );
|
||||
}
|
||||
|
||||
if ( product.freemium_type === 'primary' ) {
|
||||
return __( 'Free plan available', 'woocommerce' );
|
||||
}
|
||||
|
||||
return currencySymbol + product.price;
|
||||
}
|
||||
|
||||
function getBillingText(): string {
|
||||
if ( product.freemium_type === 'primary' ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( product.price !== 0 ) {
|
||||
return __( ' annually', 'woocommerce' );
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( shouldShowAddToStore( product ) ) {
|
||||
return (
|
||||
<>
|
||||
|
@ -83,17 +107,10 @@ function ProductCardFooter( props: { product: Product } ) {
|
|||
<>
|
||||
<div className="woocommerce-marketplace__product-card__price">
|
||||
<span className="woocommerce-marketplace__product-card__price-label">
|
||||
{
|
||||
// '0' is a free product
|
||||
product.price === 0
|
||||
? __( 'Free download', 'woocommerce' )
|
||||
: currencySymbol + product.price
|
||||
}
|
||||
{ getPriceLabel() }
|
||||
</span>
|
||||
<span className="woocommerce-marketplace__product-card__price-billing">
|
||||
{ product.price === 0
|
||||
? ''
|
||||
: __( ' annually', 'woocommerce' ) }
|
||||
{ getBillingText() }
|
||||
</span>
|
||||
</div>
|
||||
<div className="woocommerce-marketplace__product-card__rating">
|
||||
|
|
|
@ -72,6 +72,7 @@ export default function ProductListContent( props: {
|
|||
title: product.title,
|
||||
image: product.image,
|
||||
type: product.type,
|
||||
freemium_type: product.freemium_type,
|
||||
icon: product.icon,
|
||||
label: product.label,
|
||||
primary_color: product.primary_color,
|
||||
|
|
|
@ -6,6 +6,7 @@ export type SearchAPIProductType = {
|
|||
title: string;
|
||||
image: string;
|
||||
type: ProductType;
|
||||
freemium_type: 'unset' | 'primary';
|
||||
excerpt: string;
|
||||
link: string;
|
||||
demo_url: string;
|
||||
|
@ -29,6 +30,7 @@ export interface Product {
|
|||
title: string;
|
||||
image: string;
|
||||
type: ProductType;
|
||||
freemium_type?: 'unset' | 'primary';
|
||||
description: string;
|
||||
vendorName: string;
|
||||
vendorUrl: string;
|
||||
|
|
|
@ -129,6 +129,7 @@ async function fetchSearchResults(
|
|||
title: product.title,
|
||||
image: product.image,
|
||||
type: product.type,
|
||||
freemium_type: product.freemium_type,
|
||||
description: product.excerpt,
|
||||
vendorName: product.vendor_name,
|
||||
vendorUrl: product.vendor_url,
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: add
|
||||
|
||||
Show the label for freemium products in the in-app marketpalce
|
Loading…
Reference in New Issue