Automattic / woocommerce-payments

Accept payments via credit card. Manage transactions within WordPress.
https://wordpress.org/plugins/woocommerce-payments/
Other
175 stars 69 forks source link

Spike: Disabling card as a payment method #9798

Open FangedParakeet opened 1 week ago

FangedParakeet commented 1 week ago

Description

A long-requested feature has been to allow store owners to disable the card payment method, exclusively presenting EPMs or APMs at checkout instead. With the current state of our plugin, this should be technically feasible and is very achievable in our V2 plugin.

However, in WooPayments the card payment method is still closely tied to the main plugin gateway, with other payment methods relying on hooks, settings, and asset enqueuing functionality provided by this main gateway. In order disable the card payment method, we will need to refactor our plugin to separate the card payment method from the core payment gateway. We will also need to refactor the main plugin so that it can be initialised without registering the card payment method as a gateway and to allow this to be controlled by the enabled flag, as is the case with all of our other payment methods.

Acceptance criteria

These are problems that we will need to solve in order to accomplish this goal. We don't need to actually solve them within this issue, but this spike is to explore their feasibility and plot out a pathway towards doing so, preferably in the form of a set of new issues.

danielmx-dev commented 4 days ago

Please add your planning poker estimate with Zenhub @FangedParakeet

danielmx-dev commented 16 hours ago

I was able to put together a functioning proof of concept in the following branch: https://github.com/Automattic/woocommerce-payments/pull/9844/files

I've tested several flows using these changes and here are some of my most relevant findings:

At this point I'm still unsure if there's a way to implement this gradually (maybe with a feature flag?) or if we require to use a main feature branch that we can merge later on. I'll start outlining the required tasks and while I think more about the specifics of the implementation.