forked from whooohq/whq-woocommerce-chilexpress-shipping
/
whq-woocommerce-chilexpress-shipping.php
executable file
·84 lines (72 loc) · 3.2 KB
/
whq-woocommerce-chilexpress-shipping.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/**
* Plugin Name: WooCommerce Chilexpress Shipping
* Plugin URI: https://github.com/whooohq/whq-woocommerce-chilexpress-shipping
* Description: Método de envío por Chilexpress para WooCommerce, con sistema de cálculo de envíos automático utilizando la API de Chilexpress
* Version: 1.4.7
* Author: Whooo & contributors
* Author URI: https://github.com/whooohq/whq-woocommerce-chilexpress-shipping/graphs/contributors
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*
* Text Domain: whq-wcchp
*
* WC requires at least: 3.2.0
* WC tested up to: 3.4.0
*/
/**
* Whooo
* http://whooohq.com
*
* Authors:
* Jhoynerk Caraballo [ https://github.com/jhoynerk ]
* Esteban Cuevas [ https://github.com/TCattd ]
*
* Contributors:
* https://github.com/whooohq/whq-woocommerce-chilexpress-shipping/graphs/contributors
*/
/**
* Check if WooCommerce is active
*/
$whq_wcchp_active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
if ( in_array( 'woocommerce/woocommerce.php', $whq_wcchp_active_plugins) ) {
$whq_wcchp_default = array(
'plugin_version' => '1.4.7',
'plugin_file' => __FILE__,
'plugin_basename' => plugin_basename(__FILE__),
'plugin_path' => trailingslashit( plugin_dir_path(__FILE__) ),
'plugin_url' => trailingslashit( plugin_dir_url(__FILE__) ),
'chilexpress_url' => 'http://www.chilexpress.cl',
'chilexpress_soap_login' => 'UsrTestServicios',
'chilexpress_soap_pass' => 'U$$vr2$tS2T',
);
if ( file_exists( $whq_wcchp_default['plugin_path'] . 'includes/helpers.php' ) ) {
include_once $whq_wcchp_default['plugin_path'] . 'includes/helpers.php';
}
if ( file_exists( $whq_wcchp_default['plugin_path'] . 'includes/activation.php' ) ) {
include_once $whq_wcchp_default['plugin_path'] . 'includes/activation.php';
}
if ( file_exists( $whq_wcchp_default['plugin_path'] . 'includes/wordpress.php' ) ) {
include_once $whq_wcchp_default['plugin_path'] . 'includes/wordpress.php';
}
if ( file_exists( $whq_wcchp_default['plugin_path'] . 'includes/woocommerce.php' ) ) {
include_once $whq_wcchp_default['plugin_path'] . 'includes/woocommerce.php';
}
if ( file_exists( $whq_wcchp_default['plugin_path'] . 'includes/scripts.php' ) ) {
include_once $whq_wcchp_default['plugin_path'] . 'includes/scripts.php';
}
if ( file_exists( $whq_wcchp_default['plugin_path'] . 'includes/ajax.php' ) ) {
include_once $whq_wcchp_default['plugin_path'] . 'includes/ajax.php';
}
if ( file_exists( $whq_wcchp_default['plugin_path'] . 'includes/soap_call.php' ) ) {
include_once $whq_wcchp_default['plugin_path'] . 'includes/soap_call.php';
}
if ( file_exists( $whq_wcchp_default['plugin_path'] . 'classes/WC_WHQ_States_Cities_CL.php' ) ) {
include_once $whq_wcchp_default['plugin_path'] . 'classes/WC_WHQ_States_Cities_CL.php';
}
if ( file_exists( $whq_wcchp_default['plugin_path'] . 'classes/WC_WHQ_Chilexpress_Shipping.php' ) ) {
include_once $whq_wcchp_default['plugin_path'] . 'classes/WC_WHQ_Chilexpress_Shipping.php';
add_action( 'plugins_loaded', 'whq_wcchp_init_class' );
add_action( 'woocommerce_cart_calculate_fees', array('WC_WHQ_Chilexpress_Shipping', 'add_cart_fee') );
}
}