Hide empty payment method sections

This commit is contained in:
Philipp Stracker 2025-03-25 16:46:52 +01:00
parent 9dc1bf7d7b
commit 5c34f2f78b
No known key found for this signature in database

View file

@ -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,6 +93,8 @@ const TabPaymentMethods = () => {
methodsMap={ methodsMap } methodsMap={ methodsMap }
/> />
) } ) }
{ showApms && (
<PaymentMethodCard <PaymentMethodCard
id="ppcp-alternative-payments-card" id="ppcp-alternative-payments-card"
title={ __( title={ __(
@ -100,6 +110,7 @@ const TabPaymentMethods = () => {
onTriggerModal={ setActiveModal } onTriggerModal={ setActiveModal }
methodsMap={ methodsMap } methodsMap={ methodsMap }
/> />
) }
{ activeModal && ( { activeModal && (
<Modal <Modal