WooCommerce payment gateway plugin base

This code can be used as a base to create your own simple custom payment gateway for WooCommerce.

Add this code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Dessky Snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php file as this will be overwritten completely when you update the theme.

/*
Plugin Name: WooCommerce <enter name> Gateway
Plugin URI: http://woothemes.com/woocommerce
Description: Extends WooCommerce with an <enter name> gateway.
Version: 1.0
Author: WooThemes
Author URI: http://woothemes.com/
Copyright: © 2009-2011 WooThemes.
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
add_action('plugins_loaded', 'woocommerce_gateway_name_init', 0);
function woocommerce_gateway_name_init() {
	if ( !class_exists( 'WC_Payment_Gateway' ) ) return;
	/**
 	 * Localisation
	 */
	load_plugin_textdomain('wc-gateway-name', false, dirname( plugin_basename( __FILE__ ) ) . '/languages');
    
	/**
 	 * Gateway class
 	 */
	class WC_Gateway_Name extends WC_Payment_Gateway {
	
		// Go wild in here
	}
	
	/**
 	* Add the Gateway to WooCommerce
 	**/
	function woocommerce_add_gateway_name_gateway($methods) {
		$methods[] = 'WC_Gateway_Name';
		return $methods;
	}
	
	add_filter('woocommerce_payment_gateways', 'woocommerce_add_gateway_name_gateway' );
}
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...Loading...
Oopps, sorry. This discussion is closed.

If you are a paying customer and you are looking for Tech Support please post a ticket on our Support Tickets page and we will respond promptly.

If you are not a paying customer and you would like to post a pre-sale question or a quote request please use our Contact form.

Why did we close the discussion?

Many of the customers started reporting issues as comments instead of the ticketing system and this started delaying our response time.

We are making this change to serve our customers better. We have ramped up our support team and we are trying to get the reply out on the same day.

Thanks for understanding.

dapas_shaunte@mailxu.com gilding@mailxu.com catacun@mailxu.com