diff --git a/plugins/woocommerce-admin/client/marketing/components/CreateNewCampaignModal/CreateNewCampaignModal.tsx b/plugins/woocommerce-admin/client/marketing/components/CreateNewCampaignModal/CreateNewCampaignModal.tsx
index 09ebf5aa7a5..2df5a402104 100644
--- a/plugins/woocommerce-admin/client/marketing/components/CreateNewCampaignModal/CreateNewCampaignModal.tsx
+++ b/plugins/woocommerce-admin/client/marketing/components/CreateNewCampaignModal/CreateNewCampaignModal.tsx
@@ -47,6 +47,9 @@ export const CreateNewCampaignModal = ( props: CreateCampaignModalProps ) => {
const { loadInstalledPluginsAfterActivation } =
useInstalledPluginsWithoutChannels();
+ const hasCampaignTypes = !! campaignTypes?.length;
+ const hasRecommendedChannels = !! recommendedChannels?.length;
+
const onInstalledAndActivated = ( pluginSlug: string ) => {
refetchCampaignTypes();
refetchRegisteredChannels();
@@ -64,7 +67,7 @@ export const CreateNewCampaignModal = ( props: CreateCampaignModalProps ) => {
>
- { !! campaignTypes?.length
+ { hasCampaignTypes
? __(
'Where would you like to promote your products?',
'woocommerce'
@@ -109,7 +112,7 @@ export const CreateNewCampaignModal = ( props: CreateCampaignModalProps ) => {
{ __( 'Create', 'woocommerce' ) }
- { !! isExternalURL( el.createUrl ) && (
+ { isExternalURL( el.createUrl ) && (
{
) ) }
- { !! recommendedChannels?.length && (
+ { hasRecommendedChannels && (
diff --git a/plugins/woocommerce-admin/client/marketing/coupons/index.js b/plugins/woocommerce-admin/client/marketing/coupons/index.js
index 4b2b2cb8af8..d817b832a2e 100644
--- a/plugins/woocommerce-admin/client/marketing/coupons/index.js
+++ b/plugins/woocommerce-admin/client/marketing/coupons/index.js
@@ -16,13 +16,14 @@ import '../data';
const CouponsOverview = () => {
const { currentUserCan } = useUser();
- const shouldShowExtensions =
+ const showExtensions = !! (
getAdminSetting( 'allowMarketplaceSuggestions', false ) &&
- currentUserCan( 'install_plugins' );
+ currentUserCan( 'install_plugins' )
+ );
return (
- { !! shouldShowExtensions && (
+ { showExtensions && (
{
);
};
+ const showFooter = !! ( total && total > perPage );
+
return (
@@ -170,14 +172,14 @@ export const Campaigns = () => {
>
{ __( 'Create new campaign', 'woocommerce' ) }
- { !! isModalOpen && (
+ { isModalOpen && (
setModalOpen( false ) }
/>
) }
{ getContent() }
- { !! ( total && total > perPage ) && (
+ { showFooter && (
(
{ /* Recommended channels section. */ }
{ recommendedChannels.length >= 1 && (
- { !! hasRegisteredChannels && (
+ { hasRegisteredChannels && (
<>
@@ -127,7 +127,7 @@ export const Channels = forwardRef< ChannelsRef, ChannelsProps >(
>
) }
- { !! expanded &&
+ { expanded &&
recommendedChannels.map( ( el, idx ) => (
diff --git a/plugins/woocommerce-admin/client/marketing/overview-multichannel/MarketingOverviewMultichannel.tsx b/plugins/woocommerce-admin/client/marketing/overview-multichannel/MarketingOverviewMultichannel.tsx
index 3f202877447..4e7a817e8dd 100644
--- a/plugins/woocommerce-admin/client/marketing/overview-multichannel/MarketingOverviewMultichannel.tsx
+++ b/plugins/woocommerce-admin/client/marketing/overview-multichannel/MarketingOverviewMultichannel.tsx
@@ -61,14 +61,21 @@ export const MarketingOverviewMultichannel: React.FC = () => {
return ;
}
- const shouldShowCampaigns = !! (
+ const showCampaigns = !! (
dataRegistered?.length &&
( isIntroductionBannerDismissed || metaCampaigns?.total )
);
- const shouldShowExtensions =
+ const showChannels = !! (
+ dataRegistered &&
+ dataRecommended &&
+ ( dataRegistered.length || dataRecommended.length )
+ );
+
+ const showExtensions = !! (
getAdminSetting( 'allowMarketplaceSuggestions', false ) &&
- currentUserCan( 'install_plugins' );
+ currentUserCan( 'install_plugins' )
+ );
const onInstalledAndActivated = ( pluginSlug: string ) => {
refetchCampaignTypes();
@@ -86,18 +93,17 @@ export const MarketingOverviewMultichannel: React.FC = () => {
} }
/>
) }
- { shouldShowCampaigns && }
- { !! ( dataRegistered && dataRecommended ) &&
- !! ( dataRegistered.length || dataRecommended.length ) && (
-
- ) }
+ { showCampaigns && }
+ { showChannels && (
+
+ ) }
- { !! shouldShowExtensions && }
+ { showExtensions && }
);
diff --git a/plugins/woocommerce/changelog/feature-marketing-boolean-expression b/plugins/woocommerce/changelog/feature-marketing-boolean-expression
new file mode 100644
index 00000000000..88fadf329b4
--- /dev/null
+++ b/plugins/woocommerce/changelog/feature-marketing-boolean-expression
@@ -0,0 +1,4 @@
+Significance: minor
+Type: dev
+
+Simplify boolean expression before && in Marketing page.