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.
|
// We hardcode this for now while we only display prices in USD.
|
||||||
const currencySymbol = '$';
|
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 ) ) {
|
if ( shouldShowAddToStore( product ) ) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -83,17 +107,10 @@ function ProductCardFooter( props: { product: Product } ) {
|
||||||
<>
|
<>
|
||||||
<div className="woocommerce-marketplace__product-card__price">
|
<div className="woocommerce-marketplace__product-card__price">
|
||||||
<span className="woocommerce-marketplace__product-card__price-label">
|
<span className="woocommerce-marketplace__product-card__price-label">
|
||||||
{
|
{ getPriceLabel() }
|
||||||
// '0' is a free product
|
|
||||||
product.price === 0
|
|
||||||
? __( 'Free download', 'woocommerce' )
|
|
||||||
: currencySymbol + product.price
|
|
||||||
}
|
|
||||||
</span>
|
</span>
|
||||||
<span className="woocommerce-marketplace__product-card__price-billing">
|
<span className="woocommerce-marketplace__product-card__price-billing">
|
||||||
{ product.price === 0
|
{ getBillingText() }
|
||||||
? ''
|
|
||||||
: __( ' annually', 'woocommerce' ) }
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="woocommerce-marketplace__product-card__rating">
|
<div className="woocommerce-marketplace__product-card__rating">
|
||||||
|
|
|
@ -72,6 +72,7 @@ export default function ProductListContent( props: {
|
||||||
title: product.title,
|
title: product.title,
|
||||||
image: product.image,
|
image: product.image,
|
||||||
type: product.type,
|
type: product.type,
|
||||||
|
freemium_type: product.freemium_type,
|
||||||
icon: product.icon,
|
icon: product.icon,
|
||||||
label: product.label,
|
label: product.label,
|
||||||
primary_color: product.primary_color,
|
primary_color: product.primary_color,
|
||||||
|
|
|
@ -6,6 +6,7 @@ export type SearchAPIProductType = {
|
||||||
title: string;
|
title: string;
|
||||||
image: string;
|
image: string;
|
||||||
type: ProductType;
|
type: ProductType;
|
||||||
|
freemium_type: 'unset' | 'primary';
|
||||||
excerpt: string;
|
excerpt: string;
|
||||||
link: string;
|
link: string;
|
||||||
demo_url: string;
|
demo_url: string;
|
||||||
|
@ -29,6 +30,7 @@ export interface Product {
|
||||||
title: string;
|
title: string;
|
||||||
image: string;
|
image: string;
|
||||||
type: ProductType;
|
type: ProductType;
|
||||||
|
freemium_type?: 'unset' | 'primary';
|
||||||
description: string;
|
description: string;
|
||||||
vendorName: string;
|
vendorName: string;
|
||||||
vendorUrl: string;
|
vendorUrl: string;
|
||||||
|
|
|
@ -129,6 +129,7 @@ async function fetchSearchResults(
|
||||||
title: product.title,
|
title: product.title,
|
||||||
image: product.image,
|
image: product.image,
|
||||||
type: product.type,
|
type: product.type,
|
||||||
|
freemium_type: product.freemium_type,
|
||||||
description: product.excerpt,
|
description: product.excerpt,
|
||||||
vendorName: product.vendor_name,
|
vendorName: product.vendor_name,
|
||||||
vendorUrl: product.vendor_url,
|
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