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 | |
/* You should adapt the priorities to your scenario */ | |
add_filter( 'woocommerce_get_country_locale', function( $countries ) { | |
if ( is_checkout() ) { | |
if ( function_exists( '\Webdados\PortuguesePostcodesWooCommerce\PortuguesePostcodesWooCommerce' ) ) { | |
if ( get_option( 'portuguese_postcodes_woo_mode' ) == '' && get_option( 'portuguese_postcodes_woo_autocomplete_mode' ) == 'full_address' ) { | |
$countries['PT']['postcode']['priority'] = 45; | |
$countries['PT']['city']['priority'] = 46; | |
if ( ! ( function_exists( 'woocommerce_portugal_states' ) || class_exists( 'WC_Webdados_Distritos' ) ) ) { | |
// Without the Distritos plugin active |
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 | |
// First of all define the minimum value on a constant, for easy change - Ideally this would be loaded from an option on the settings | |
define( 'SEQURA_MIN_VALUE', 200 ); | |
// Set the filters | |
add_filter( 'woocommerce_available_payment_gateways', 'disable_sequra_for_low_values' ); | |
add_filter( 'woocommerce_sq_is_available_in_product_page', 'disable_sequra_for_low_values_product_page', 10, 2 ); | |
// Hide it on the checkout |
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_action( 'wp_head', array( $this, 'quantcast_choice_enable_action' ), function() { | |
?> | |
<!-- Quantcast Choice. Consent Manager Tag v2.0 (for TCF 2.0) --> | |
<script type="text/javascript" async=true> | |
(function() { | |
var host = window.location.hostname; | |
var element = document.createElement('script'); | |
var firstScript = document.getElementsByTagName('script')[0]; | |
var url = 'https://cmp.quantcast.com' |
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
/* Need help? Hire us: https://www.webdados.pt/contactos/ */ | |
//We need to wait for the page to be ready, or else the Consent platform may not be loaded yet, and we'll fire the pageview earlier than we should | |
window.onload = function() { | |
var google_analytics_id = 'UA-111111-01'; //Replace with yours | |
//Prepare the data layer | |
window.dataLayer = window.dataLayer || [] | |
//gtag function | |
function gtag() { | |
dataLayer.push(arguments); |
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( 'multibanco_ifthen_send_email_instructions', 'my_multibanco_ifthen_send_email_instructions', 10, 5 ); | |
add_filter( 'mbway_ifthen_send_email_instructions', 'my_multibanco_ifthen_send_email_instructions', 10, 5 ); | |
add_filter( 'creditcard_ifthen_send_email_instructions', 'my_multibanco_ifthen_send_email_instructions', 10, 5 ); | |
add_filter( 'payshop_ifthen_send_email_instructions', 'my_multibanco_ifthen_send_email_instructions', 10, 5 ); | |
function my_multibanco_ifthen_send_email_instructions( $send, $order, $sent_to_admin, $plain_text, $email ) { | |
$emails_to_remove = array( | |
'customer_completed_order', |
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( 'relevanssi_search_ok', 'flatsome_live_search_relevanssi_search_ok' ); | |
function flatsome_live_search_relevanssi_search_ok( $search_ok ) { | |
if ( is_ajax() && isset( $_GET['action'] ) && trim( $_GET['action'] ) == 'flatsome_ajax_search_products' ) { | |
return true; | |
} | |
return $search_ok; | |
} |
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 | |
//Get the plugin from https://www.webdados.pt/wordpress/plugins/feed-kuantokusta-para-woocommerce/ | |
add_filter( 'kuantokusta_product_node_show', 'my_include_kk_categories', 10, 2 ); | |
add_filter( 'kuantokusta_variation_node_show', 'my_include_kk_categories', 10, 2 ); | |
function include_kk_categories( $show, $product ) { | |
//If not show, we don't neeed to process the item | |
if ( $show ) { | |
//Init as false | |
$show = false; | |
//Product categories IDs to include in the feed |
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 | |
// Change item properties | |
add_filter( 'invoicexpress_woocommerce_document_item', function( $item_data, $item, $product, $order_object, $document_type, $args ) { | |
// Do whatever you want with the $item_data array, for example, change its reference or description | |
$item_data['name'] = 'whatever'; | |
/ /Or add somthing to its description | |
$item_data['description'] .= 'whatever'; | |
// And return it | |
return $item_data; |
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 | |
/* Get AT Code 2 minutes after issuing Delivery Note - WordPress crons need to be running properly */ | |
add_action( 'invoicexpress_woocommerce_after_document_finish', function( $order_id, $type ) { | |
if ( $type == 'transport_guide' ) { | |
$minutes = 2; | |
wp_schedule_single_event( time() + ( $minutes * 60 ), 'invoicexpress_woocommerce_fetch_at_code', array( $order_id ) ); | |
} | |
}, 10, 2 ); |