Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Exemplo completo de desenvolvimento de plugin
<?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