mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 14:57:26 +08:00
✨ Hide empty payment method sections
This commit is contained in:
parent
9dc1bf7d7b
commit
5c34f2f78b
1 changed files with 27 additions and 16 deletions
|
@ -54,6 +54,13 @@ const TabPaymentMethods = () => {
|
||||||
const merchant = CommonHooks.useMerchant();
|
const merchant = CommonHooks.useMerchant();
|
||||||
const { canUseCardPayments } = OnboardingHooks.useFlags();
|
const { canUseCardPayments } = OnboardingHooks.useFlags();
|
||||||
|
|
||||||
|
const showCardPayments =
|
||||||
|
methods.cardPayment.length > 0 &&
|
||||||
|
merchant.isBusinessSeller &&
|
||||||
|
canUseCardPayments;
|
||||||
|
|
||||||
|
const showApms = methods.apm.length > 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="ppcp-r-payment-methods">
|
<div className="ppcp-r-payment-methods">
|
||||||
<PaymentMethodCard
|
<PaymentMethodCard
|
||||||
|
@ -68,7 +75,8 @@ const TabPaymentMethods = () => {
|
||||||
onTriggerModal={ setActiveModal }
|
onTriggerModal={ setActiveModal }
|
||||||
methodsMap={ methodsMap }
|
methodsMap={ methodsMap }
|
||||||
/>
|
/>
|
||||||
{ merchant.isBusinessSeller && canUseCardPayments && (
|
|
||||||
|
{ showCardPayments && (
|
||||||
<PaymentMethodCard
|
<PaymentMethodCard
|
||||||
id="ppcp-card-payments-card"
|
id="ppcp-card-payments-card"
|
||||||
title={ __(
|
title={ __(
|
||||||
|
@ -85,21 +93,24 @@ const TabPaymentMethods = () => {
|
||||||
methodsMap={ methodsMap }
|
methodsMap={ methodsMap }
|
||||||
/>
|
/>
|
||||||
) }
|
) }
|
||||||
<PaymentMethodCard
|
|
||||||
id="ppcp-alternative-payments-card"
|
{ showApms && (
|
||||||
title={ __(
|
<PaymentMethodCard
|
||||||
'Alternative Payment Methods',
|
id="ppcp-alternative-payments-card"
|
||||||
'woocommerce-paypal-payments'
|
title={ __(
|
||||||
) }
|
'Alternative Payment Methods',
|
||||||
description={ __(
|
'woocommerce-paypal-payments'
|
||||||
'With alternative payment methods, customers across the globe can pay with their bank accounts and other local payment methods.',
|
) }
|
||||||
'woocommerce-paypal-payments'
|
description={ __(
|
||||||
) }
|
'With alternative payment methods, customers across the globe can pay with their bank accounts and other local payment methods.',
|
||||||
icon="icon-checkout-alternative-methods.svg"
|
'woocommerce-paypal-payments'
|
||||||
methods={ methods.apm }
|
) }
|
||||||
onTriggerModal={ setActiveModal }
|
icon="icon-checkout-alternative-methods.svg"
|
||||||
methodsMap={ methodsMap }
|
methods={ methods.apm }
|
||||||
/>
|
onTriggerModal={ setActiveModal }
|
||||||
|
methodsMap={ methodsMap }
|
||||||
|
/>
|
||||||
|
) }
|
||||||
|
|
||||||
{ activeModal && (
|
{ activeModal && (
|
||||||
<Modal
|
<Modal
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue