Created
November 14, 2015 00:51
-
-
Save claudiosanches/545c2acab4095a3ed4c8 to your computer and use it in GitHub Desktop.
Exemplo completo de desenvolvimento de plugin
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 | |
/** | |
* Plugin Name: PAC Gratuito | |
* Plugin URI: https://claudiosmweb.com/woocommerce/woocommerce-deixar-o-metodo-de-entrega-pac-dos-correios-gratuito/ | |
* Description: Deixa o valor do PAC do WooCommerce Correios sempre como gratuito. | |
* Author: Claudio Sanches | |
* Author URI: http://claudiosmweb.com/ | |
* Version: 1.0.0 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; // Mostra apenas uma tela branca se algum retarda tentar acessar o arquivo diretamente. | |
} | |
function custom_woocommerce_correios_shipping_methods( $rates ) { | |
foreach ( $rates as $key => $rate ) { | |
if ( 'PAC' == $rate['id'] ) { | |
$rates[ $key ]['cost'] = 0; | |
break; | |
} | |
} | |
return $rates; | |
} | |
add_filter( 'woocommerce_correios_shipping_methods', 'custom_woocommerce_correios_shipping_methods' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment