Source: A Plug-in by Igor Escobar on Github.
This file contains hidden or 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
//Filtro para permitir vendas apenas para alguns cep's | |
add_action('woocommerce_checkout_process', 'wc_restrict_sales_by_postcode'); | |
function wc_restrict_sales_by_postcode() { | |
$cep = $_POST['billing_postcode']; | |
$cep = preg_replace( "/[^0-9]/", "",$cep ); | |
if ( $cep < 30000000 || $cep > 35000000 ) { | |
wc_add_notice(('Infelizmente ainda não atendemos na sua cidade CEP: '.$cep.'.'), 'error'); | |
} | |
} |
This file contains hidden or 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
[ | |
{ | |
"gameTime": "2022-11-20T16:00:00Z", | |
"homeTeam": "cat", | |
"awayTeam": "equ" | |
}, | |
{ | |
"gameTime": "2022-11-21T13:00:00Z", | |
"homeTeam": "ing", | |
"awayTeam": "ira" |
This file contains hidden or 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
if(is_user_logged_in()){ | |
if(WC()->customer->get_state() == "RJ" || (WC()->customer->get_state() == "SP" && WC()->customer->get_city() == "São Paulo")){ | |
if( $total <= $minimum_cart_total ) { | |
$saldo = $minimum_cart_total - $total; | |
$saldo_dec = number_format((float)$saldo, 2, ',', ''); | |
$singular = '<br />Falta <strong>R$ %s</strong> para atingir o valor mínimo.</div>'; | |
$plural = '<br />Faltam <strong>R$ %s</strong> para atingir o valor mínimo.</div>'; | |
if ( $saldo > 1 || $saldo < 1 ) { | |
$msg = $plural; | |
} else { |