W-21890244: Fix Express Checkout toggles in PWA - #3775
Conversation
|
Git2Gus App is installed but the |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
| </Alert> | ||
| )} | ||
| {sfPaymentsEnabled && ( | ||
| {sfPaymentsEnabled && expressOnCheckout && ( |
There was a problem hiding this comment.
I brought it up to @rasbhat too but do we need to check if express checkout is enabled at all before trying read the 4 flags?
There was a problem hiding this comment.
From what I can tell, in ecom ShopperConfigurationsService calls PaymentConfigurationServiceImpl and that gets the site config values from PaymentsSiteConfig. That last one has code like this so we should be all set
boolean generalDisabled = siteConfig.isExpressCheckoutDisabled();
this.expressOnPdpEnabled = !generalDisabled && !siteConfig.isExpressOnPdpDisabled();
0f1891e to
961ef38
Compare
|
|
||
| test('renders SFPaymentsExpress when sfPayments is enabled', () => { | ||
| // Enable sfPayments | ||
| test('renders SFPaymentsExpress when sfPayments is enabled and MINICART is in expressOnCheckoutPagesEnabled', () => { |
There was a problem hiding this comment.
nit: test description still has the all caps name
fc9e67d to
8a768d5
Compare
| const inventoryId = selectedStore?.inventoryId | ||
| const sfPaymentsEnabled = useSFPaymentsEnabled() | ||
| const {pdp: expressOnPDP} = useExpressCheckoutEnabled() | ||
| const showExpressOnPDP = sfPaymentsEnabled && expressOnPDP |
There was a problem hiding this comment.
Do we still need sfPaymentsEnabled? Is there a scenario where sfPaymentsEnabled is false but expressOnPDP is true?
If expressOnPDP is only ever true when sfPaymentsEnabled is true then this could be adjusted to be
const showExpressOnPDP = expressOnPDP
| : 0 | ||
| const sfPaymentsEnabled = useSFPaymentsEnabled() | ||
| const {miniCart: expressOnMiniCart} = useExpressCheckoutEnabled() | ||
| const showExpressOnMiniCart = sfPaymentsEnabled && expressOnMiniCart |
There was a problem hiding this comment.
Same question here. Does it make sense to simplify this to just
const showExpressOnMiniCart = expressOnMiniCart
| const CartCta = () => { | ||
| const sfPaymentsEnabled = useSFPaymentsEnabled() | ||
| const {cart: expressOnCart} = useExpressCheckoutEnabled() | ||
| const showExpressOnCart = sfPaymentsEnabled && expressOnCart |
| const multishipEnabled = getConfig()?.app?.multishipEnabled ?? true | ||
| const sfPaymentsEnabled = useSFPaymentsEnabled() | ||
| const {checkout: expressOnCheckout} = useExpressCheckoutEnabled() | ||
| const showExpressOnCheckout = sfPaymentsEnabled && expressOnCheckout |
| * Custom hook to get the express checkout enablement flags per page. | ||
| * @returns {{pdp: boolean, miniCart: boolean, cart: boolean, checkout: boolean}} Per-page express checkout flags | ||
| */ | ||
| export const useExpressCheckoutEnabled = () => { |
There was a problem hiding this comment.
It might be a good idea to have the check for sfPaymentsEnabled here so that it isn't repeated in the other files
There was a problem hiding this comment.
This makes sense. Checking sfPaymentsEnabled in use-sf-payments.js. Simplified all other checks.
vcua-mobify
left a comment
There was a problem hiding this comment.
Thanks for making that change @rasbhat !
The express Checkout toggles were not being taken into account for rendering Express Checkout buttons. This PR fixes it for PDP, Checkout, Cart, Mini Cart.
Description
Types of Changes
Changes
How to Test-Drive This PR
Checklists
General
Accessibility Compliance
You must check off all items in one of the follow two lists:
or...
Localization