Created
November 18, 2022 18:39
-
-
Save GustavoNapa/3644ecb92dcb642735143d278d16f474 to your computer and use it in GitHub Desktop.
Basta adicionar ao arquivo functions.php
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'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment