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 | |
add_filter( 'woocommerce_package_rates', 'wc_restrict_sales_by_postcode', 10, 2 ); | |
function wc_restrict_sales_by_postcode( $rates, $package ) { | |
$cep = WC()->customer->get_shipping_postcode(); | |
$cep = preg_replace( "/[^0-9]/", "",$cep ); | |
if ( '95555000' !== $cep ) { | |
$rates = array(); | |
} | |
return $rates; |
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 | |
/* | |
** Mudar <p> por <br /> no editor do fórum | |
*/ | |
add_filter( 'tiny_mce_before_init', 'my_switch_tinymce_p_br' ); | |
function my_switch_tinymce_p_br( $settings ) { | |
if ( ! is_admin() ) { | |
$settings['forced_root_block'] = false; | |
$settings['paste_as_text'] = true; |
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 | |
/** | |
* @woo_custom_search | |
* @param string $search_fields | |
*/ | |
function woo_custom_search( $search_fields ) { | |
$search_fields[] = 'Método de pagamento'; | |
return $search_fields; | |
} | |
add_filter( 'woocommerce_shop_order_search_fields', 'woo_custom_search' ); |
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
add_filter( 'wc_adpp_product_message', 'custom_wc_adpp_product_message', 10, 2 ); | |
function custom_wc_adpp_product_message( $message, $days ) { | |
if ( 1 == $days ) { | |
$message = str_replace( 'dias', 'dia', $message ); | |
} | |
return $message; | |
} |
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
add_action( 'woocommerce_no_products_found', 'show_products_on_no_products_found', 20 ); | |
function show_products_on_no_products_found() { | |
echo '<h2>' . __( 'Mas você pode gostar disso...', 'domain' ) . '</h2>'; | |
echo do_shortcode( '[recent_products per_page="4"]' ); | |
} |
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
add_action( 'init', 'mautic_add_tag' ); | |
function mautic_add_tag() { | |
$email = '[email protected]'; | |
$api_data = AP_Mautic_Api::get_api_method_url( $email ); | |
$url = $api_data['url']; | |
$method = $api_data['method']; | |
$body = array( | |
'email' => $email, | |
'tags' => 'produto-999, produto-5555, produto-11111, produto-0000', |
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 | |
add_filter( 'learndash_notifications_email_content', function( $message, $notification_id ) { | |
if ( ! function_exists( 'WC' ) ) { | |
return $message; | |
} | |
// load the mailer class. | |
$mailer = WC()->mailer(); |
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
/** | |
* @snippet Relatorio de vendas por ano e estado brasileiro @ WooCommerce Admin | |
* @sourcecode https://gist.github.com/emanweb/3272d93d481e8c749edaa2cce2641b28 | |
* @author Emanuel Costa | |
* @testedwith WooCommerce 6.3.1 | |
* @inspiredby https://businessbloomer.com/?p=72853 (Rodolfo Melogli) | |
* @instructions Inclua esse código no functions.php to seu tema filho (child theme) | |
*/ | |
// ----------------------- |