-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwoocommerce-dash-checkout-plugin.php
40 lines (35 loc) · 1.33 KB
/
woocommerce-dash-checkout-plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/*
Plugin Name: Dashpay - WooCommerce Gateway
Plugin URI: http://store.slayer.work/
Description: Extends WooCommerce with Dash Payment Functionality.
Version: 1.0
Author: Jon Kindel
Author URI: http://www.slayer.work
*/
// Include our Gateway Class and register Payment Gateway with WooCommerce
add_action( 'plugins_loaded', 'dash_checkout_init', 0 );
function dash_checkout_init() {
// If the parent WC_Payment_Gateway class doesn't exist
// it means WooCommerce is not installed on the site
// so do nothing
if ( ! class_exists( 'WC_Payment_Gateway' ) ) return;
// If we made it this far, then include our Gateway Class
include_once('woocommerce-dash-checkout.php');
// Now that we have successfully included our class,
// Lets add it too WooCommerce
add_filter( 'woocommerce_payment_gateways', 'dash_checkout_gateway' );
function dash_checkout_gateway( $methods ) {
$methods[] = 'DASH_Checkout';
return $methods;
}
}
// Add custom action links
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'dash_checkout_action_links' );
function dash_checkout_action_links( $links ) {
$plugin_links = array(
'<a href="' . admin_url( 'admin.php?page=wc-settings&tab=checkout' ) . '">' . __( 'Settings', 'dash-checkout' ) . '</a>',
);
// Merge our new link with the default ones
return array_merge( $plugin_links, $links );
}