Skip to content

W-21890244: Fix Express Checkout toggles in PWA - #3775

Merged
rasbhat merged 5 commits into
developfrom
rvishwanathbhat.W-21890244-fix-express-checkout-display-toggles
Apr 9, 2026
Merged

W-21890244: Fix Express Checkout toggles in PWA#3775
rasbhat merged 5 commits into
developfrom
rvishwanathbhat.W-21890244-fix-express-checkout-display-toggles

Conversation

@rasbhat

@rasbhat rasbhat commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

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

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • (change1)

How to Test-Drive This PR

  • (step1)

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@git2gus

git2gus Bot commented Apr 3, 2026

Copy link
Copy Markdown

Git2Gus App is installed but the .git2gus/config.json doesn't have right values. You should add the required configuration.

@cc-prodsec

cc-prodsec commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

</Alert>
)}
{sfPaymentsEnabled && (
{sfPaymentsEnabled && expressOnCheckout && (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();

Comment thread packages/template-retail-react-app/app/pages/cart/partials/cart-cta.jsx Outdated
Comment thread packages/template-retail-react-app/app/hooks/use-sf-payments.js Outdated
@rasbhat
rasbhat force-pushed the rvishwanathbhat.W-21890244-fix-express-checkout-display-toggles branch 2 times, most recently from 0f1891e to 961ef38 Compare April 6, 2026 17:33

test('renders SFPaymentsExpress when sfPayments is enabled', () => {
// Enable sfPayments
test('renders SFPaymentsExpress when sfPayments is enabled and MINICART is in expressOnCheckoutPagesEnabled', () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: test description still has the all caps name

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@rasbhat
rasbhat marked this pull request as ready for review April 6, 2026 18:03
@rasbhat
rasbhat requested a review from a team as a code owner April 6, 2026 18:03
@rasbhat
rasbhat force-pushed the rvishwanathbhat.W-21890244-fix-express-checkout-display-toggles branch from fc9e67d to 8a768d5 Compare April 6, 2026 19:56
jeffraab-sfdc
jeffraab-sfdc previously approved these changes Apr 6, 2026
amittapalli
amittapalli previously approved these changes Apr 7, 2026
@rasbhat
rasbhat dismissed stale reviews from amittapalli and jeffraab-sfdc via 4f24f9c April 7, 2026 19:37
jeffraab-sfdc
jeffraab-sfdc previously approved these changes Apr 7, 2026
amittapalli
amittapalli previously approved these changes Apr 8, 2026
const inventoryId = selectedStore?.inventoryId
const sfPaymentsEnabled = useSFPaymentsEnabled()
const {pdp: expressOnPDP} = useExpressCheckoutEnabled()
const showExpressOnPDP = sfPaymentsEnabled && expressOnPDP

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here as well

const multishipEnabled = getConfig()?.app?.multishipEnabled ?? true
const sfPaymentsEnabled = useSFPaymentsEnabled()
const {checkout: expressOnCheckout} = useExpressCheckoutEnabled()
const showExpressOnCheckout = sfPaymentsEnabled && expressOnCheckout

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

* 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 = () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be a good idea to have the check for sfPaymentsEnabled here so that it isn't repeated in the other files

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense. Checking sfPaymentsEnabled in use-sf-payments.js. Simplified all other checks.

@rasbhat
rasbhat dismissed stale reviews from amittapalli and jeffraab-sfdc via 1ebddc0 April 9, 2026 00:26

@vcua-mobify vcua-mobify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making that change @rasbhat !

@rasbhat
rasbhat merged commit 77e2f85 into develop Apr 9, 2026
73 of 74 checks passed
@rasbhat
rasbhat deleted the rvishwanathbhat.W-21890244-fix-express-checkout-display-toggles branch April 9, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants