Skip to content

Instantly share code, notes, and snippets.

@albertojm
Created April 15, 2016 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save albertojm/8e2e3fe2d90e19dc1875ef04ab565125 to your computer and use it in GitHub Desktop.
Save albertojm/8e2e3fe2d90e19dc1875ef04ab565125 to your computer and use it in GitHub Desktop.
Chilexpress shipping method, calculated per city.
<?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