In a single week I had 3 separate tasks on Codeable all on the same general issue with WooCommerce: changing payment options for specific circumstances. While it did make each successive task a bit easier since I had already been digging around in those functions it got me thinking it may be a popular plugin.
So my plan is to put together an extension or plugin to offer some options for products so that they can have individual payment options or modify the entire carts payments options if present. For that, the function was pretty quick to find and then tweak. By looping through the cart data and checking the category values against a set category or specific item ID’s the gateways can be unset if a match is found.
However it feels messy. So I’m going to try some things and post the steps along the way with all of the code I find, tweak, fork, and use in the hopes that it helps out others and eventually turns into a releasable project. If not, at least the individual snippets will be available which do have their individual specific uses
Here is what I have so far:
From this topic on the WC forums: http://wordpress.org/support/topic/restrict-payment-options-based-on-product
This is built of the same premise but a bit easier since we just check country.