Posted on

WooCommerce: Enable Payment Gateway Only for “Order Pay Checkout”

A video tutorial will be done soon, but I’ve basically started invoicing my own clients with WooCommerce itself. I was using a third party system and I said to myself – why not using WooCommerce instead? So I did it, it’s actually pretty straight forward.

One of the most important functionalities I needed to customize was the “Bank Transfer” (bacs) payment option. Of course I don’t want this to be visible on the standard checkout page, however for those clients I invoice manually I definitely needed it.

We’ve seen in the past how to disable payment gateways given certain conditions… but how do we “enable” one? Continue reading WooCommerce: Enable Payment Gateway Only for “Order Pay Checkout”

Posted on

WooCommerce: Disable Payment Gateway For Specific Shipping Method

Today we take a look at the WooCommerce Checkout Page and specifically at how to disable a payment gateway (for example PayPal) when a specific shipping method is selected (e.g. “local_pickup”). Enjoy! Continue reading WooCommerce: Disable Payment Gateway For Specific Shipping Method

Posted on

WooCommerce: Add Checkout Fee for a Payment Gateway (e.g. PayPal)

Here’s a simple PHP snippet to add a fee to the checkout for every payment or for a specific payment gateway. Please do remember that for certain payment gateways such as PayPal, adding checkout fees is currently against their Terms of Service so make sure to check this first. As usual, this needs to be copied and pasted in your child theme’s functions.php file. Enjoy! Continue reading WooCommerce: Add Checkout Fee for a Payment Gateway (e.g. PayPal)

Posted on

WooCommerce: Fixing Fatal error Call to undefined function wc_get_order()

I developed a custom payment gateway plugin for a client, who wanted to add a similar method to “cod” (cash on delivery). FYI, he wanted to add a method called “card on delivery”. I simply duplicated the code, added the PHP to a file, made a plugin and gave him the plugin zip file. And everything was working great… until he did a test checkout. Continue reading WooCommerce: Fixing Fatal error Call to undefined function wc_get_order()

Posted on

WooCommerce: Add Payment Method to Order Emails

I think this is a major flow in WooCommerce and I’m surprised they still haven’t thought about it! A client of mine had to create a brand new payment gateway – but unless you login to WordPress you can’t find out what the payment method was from the order emails. Here’s how to fix it. Continue reading WooCommerce: Add Payment Method to Order Emails

Posted on

WooCommerce: How to Disable PayPal on Orders Above $100

This is a cool function you can apply to any payment gateways for any order threshold. for example, you may want to disable bank transfers if orders are below $10, or disable PayPal payments if orders are above a certain cart total. Here’s what I did. Continue reading WooCommerce: How to Disable PayPal on Orders Above $100

Posted on

WooCommerce: Disable Payment Gateway for Specific User Role

You may want to disable payment gateways depending on the user role or user capability. For example, you may want to disable PayPal for “user role: shop_manager” or enable a specific gateway for “user role: customer”. All you need is pasting the following code in your functions.php Continue reading WooCommerce: Disable Payment Gateway for Specific User Role

Posted on

WooCommerce: Disable Payment Gateway for a Specific Country

You might want to disable PayPal for non-local customers or enable a specific gateway for only one country… Either way, this is a very common requirement for all of those who trade internationally.

Here’s a simple snippet you can further customize to achieve your objective. Simply pick the payment gateway “slug” you want to disable/enable (“paypal”, “authorize”, “stripe”, etc.) and the country code (US, ES, IE, etc.) and then apply your conditional rules in the plugin below. Continue reading WooCommerce: Disable Payment Gateway for a Specific Country