forked from seanvoss/easyshipper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
easyshipper.php
executable file
·51 lines (35 loc) · 1.28 KB
/
easyshipper.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
41
42
43
44
45
46
47
48
49
50
51
<?php
/*
Plugin Name: EasyShipper
Plugin URI: http://seanvoss.com/easypost
Description: Provides an integration for EasyPost for woo-commerece.
Version: 0.5
Author: Sean Voss
Author URI: http://seanvoss.com/easypost
*/
/*
* Title : EasyPost shipping extension for WooCommerce
* Author : Sean Voss
* Url : http://seanvoss.com/easypost
* License : http://seanvoss.com/license/license.html
*/
/**
* Check if WooCommerce is active
**/
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
// Put your plugin code here
// Order of Plugin Loading Requires this line, should not be necessary
require_once (dirname(__FILE__) .'/../woocommerce/woocommerce.php');
if (class_exists('WC_Shipping_Method'))
{
include_once('easypost_shipping.php');
}
add_action( 'add_meta_boxes', 'es_add_boxes');
function es_add_boxes(){
add_meta_box( 'easypost_data', __( 'EastPost', 'woocommerce' ), 'woocommerce_easypost_meta_box', 'shop_order', 'normal', 'low' );
}
function woocommerce_easypost_meta_box($post)
{
print sprintf("<a href='%2\$s' style='text-align:center;display:block;'><img style='max-width:%1\$s' src='%2\$s' ></a>",'450px', get_post_meta( $post->ID, 'easypost_shipping_label', true));
}
}