Last active
August 31, 2016 21:38
-
-
Save 2aces/f4642f5e07851403a00f94e5e304ecb9 to your computer and use it in GitHub Desktop.
woocommerce-correios PAC cost filter
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
/** | |
* yourprefix_free_shipping_pac function. | |
* filters Woocommerce Correio's PAC shipping method cost to zero | |
* | |
* @access public | |
* @param array $arr Array with data sent by woocommerce-correios WC_Correios_International_Shipping and WC_Correios_Shipping classes | |
* @param int $instance_id sent by woocommerce-correios WC_Correios_International_Shipping and WC_Correios_Shipping classe | |
* @return array | |
*/ | |
function yourprefix_free_shipping_pac($arr, $instance_id){ | |
$arr['cost'] = 000; | |
// you may filter by instance_id. For example, to filter only in certain shipping zones | |
// you find this parameter on shipping zone settings pages (e.g. wp-admin/admin.php?page=wc-settings&tab=shipping&instance_id=5) | |
// if ( === $instance_id ) { | |
// $arr['cost'] = 000; | |
// } | |
return $arr; | |
} | |
add_filter( 'woocommerce_correios_correios-pac_rate', 'yourprefix_free_shipping_pac'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can filter other Woocommerce Correios shiping methods by changing 'correios-pac' in filter name for the new methodo id . (e.g. 'correios-carta-registrada', 'correios-sedex-hoje', 'correios-sedex', 'correios-sedex-10-envelope' ).
Example: