From 2932dd82348792fc81163a3eddb1fdf1eaa4ddbd Mon Sep 17 00:00:00 2001 From: Ravinder Kumar Date: Sat, 19 Aug 2023 13:55:25 +0530 Subject: [PATCH] fix: render hosted card field only if enabled in admin settings --- .../Gateways/PayPalCommerce/payPalCommerceGateway.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/PaymentGateways/Gateways/PayPalCommerce/payPalCommerceGateway.tsx b/src/PaymentGateways/Gateways/PayPalCommerce/payPalCommerceGateway.tsx index b6fc93ef8b..3da17ab245 100644 --- a/src/PaymentGateways/Gateways/PayPalCommerce/payPalCommerceGateway.tsx +++ b/src/PaymentGateways/Gateways/PayPalCommerce/payPalCommerceGateway.tsx @@ -219,11 +219,15 @@ import {CSSProperties, useEffect, useState} from 'react'; cardholderName = _cardholderName ?? cardholderDefault; }); + // Do not render hosted fields if disabled in admin settings. + if( -1 === payPalDonationsSettings.sdkOptions['components'].indexOf('hosted-fields') ){ + return; + } + /** * Hosted fields are not supported for subscriptions at this time. */ - const supportsHostedFields = donationType !== 'subscription' - && -1 !== payPalDonationsSettings.sdkOptions['components'].indexOf('hosted-fields'); + const supportsHostedFields = donationType !== 'subscription'; return (