Created
April 15, 2016 19:24
-
-
Save albertojm/8e2e3fe2d90e19dc1875ef04ab565125 to your computer and use it in GitHub Desktop.
Chilexpress shipping method, calculated per city.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Check if WooCommerce is active | |
*/ | |
$active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) ); | |
if ( in_array( 'woocommerce/woocommerce.php', $active_plugins) ) { | |
add_filter( 'woocommerce_shipping_methods', 'add_chilexpress_shipping_method' ); | |
function add_chilexpress_shipping_method( $methods ) { | |
$methods[] = 'WC_Chilexpress_Shipping_Method'; | |
return $methods; | |
} | |
add_action( 'woocommerce_shipping_init', 'chilexpress_shipping_method_init' ); | |
function chilexpress_shipping_method_init(){ | |
require_once 'class-chilexpress-shipping-method.php'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment