Skip to content

Instantly share code, notes, and snippets.

View functions.php
<?php //do not copy this line
add_filter('wf_pklist_alter_shipping_address','wf_pklist_alter_address_formats',10,3);
add_filter('wf_pklist_alter_billing_address','wf_pklist_alter_address_formats',10,3);
add_filter('wf_pklist_alter_shipping_from_address','wf_pklist_alter_address_formats',10,3);
function wf_pklist_alter_address_formats($address, $template_type, $order)
{
if($template_type=='invoice')
{
$arr=array($address['country'], $address['postcode'],$address['city'],isset($address['address_1'])?$address['address_1']:$address['address_line1'],isset($address['address_2'])?$address['address_2']:$address['address_line2']);
@webtoffee-git
webtoffee-git / functions.php
Last active Oct 12, 2021
To modify the functionality of shortcode [cookie_close] from 'Accept' to just 'Close' - CookieYes | GDPR Cookie Consent (Free & Pro)
View functions.php
<?php // do not copy this line
// To modify the [cookie_close] functionality - CookieYes | GDPR Cookie Consent
function wt_cli_custom_close_action () {
if (!class_exists('Cookie_Law_Info'))
return;
?>
<script>
jQuery(function ($) {
$('.cli_cookie_close_button').attr('title', 'Close');
@webtoffee-git
webtoffee-git / functions.php
Created Oct 12, 2021
To hide 'Proceed to checkout' button when using the minimum order amount snippet by WooCommerce- https://www.webtoffee.com/product/paypal-express-checkout-gateway-for-woocommerce/
View functions.php
<?php // do not copy this line
function eh_woocommerce_available_payment_gateways($available_gateways) {
// Set this variable to specify a minimum order value
$minimum = 50;
if ( WC()->cart->total < $minimum ) {
if(isset($available_gateways['eh_paypal_express'])){
unset($available_gateways['eh_paypal_express']);
}
}
@webtoffee-git
webtoffee-git / functions.php
Last active Oct 13, 2021
Set a minimum order amount for checkout-PayPal payment gateway for WooCommerce (https://www.webtoffee.com/product/paypal-express-checkout-gateway-for-woocommerce/)
View functions.php
<?php //do not copy this line
/**
* Set a minimum order amount for checkout
*/
add_action( 'woocommerce_before_checkout_form', 'wc_minimum_order_amount' );
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
add_action( 'woocommerce_before_cart' , 'wc_minimum_order_amount' );
function wc_minimum_order_amount() {
@webtoffee-git
webtoffee-git / functions.php
Created Oct 8, 2021
To fix 'CURL error 60 ( SSL certificate either invalid or expired )'- CookieYes | GDPR Cookie Consent (https://www.webtoffee.com/product/gdpr-cookie-consent/)
View functions.php
<?php // Do not copy this line
add_filter( 'http_request_args', function( $params, $url ) {
// Check if this is the request from WT GDPR plugin.
$allowed_url_patterns = array(
'webtoffee.com',
'cookieyes.com'
);
foreach ($allowed_url_patterns as $url_pattern) {
if( strpos( $url, $url_pattern) !== false ) {
add_filter( 'https_ssl_verify', '__return_false' );
@webtoffee-git
webtoffee-git / functions.php
Last active Oct 8, 2021
Modify cron check interval - Import export suite by WebToffee (https://www.webtoffee.com/product/woocommerce-import-export-suite/)
View functions.php
<?php //do not copy this line
add_filter('wt_iew_cron_interval_details', 'wt_iew_cron_interval_details_fn');
function wt_iew_cron_interval_details_fn($schedules) {
$schedules['wt_iew_cron_interval'] = array(
'interval' => (60), //60 second
'display' => __('Every minute'),
);
return $schedules;
}
@webtoffee-git
webtoffee-git / functions.php
Created Oct 5, 2021
To hide”Congrats you got a free gift” message - Smart Coupon for WooCommerce (https://www.webtoffee.com/product/smart-coupons-for-woocommerce/)
View functions.php
add_filter('wt_smart_coupon_free_product_added_message', 'wt_sc_free_product_added_message', 10, 3);
function wt_sc_free_product_added_message($message, $product_id, $coupon_code)
{
return ''; //you can add any custom message here
}
@webtoffee-git
webtoffee-git / functions.php
Created Oct 5, 2021
Google consent mode compatibility - CookieYes | GDPR Cookie Consent Premium (https://www.webtoffee.com/product/gdpr-cookie-consent/)
View functions.php
add_action('wp_head', 'wt_cli_consent_mode_integration',9);
function wt_cli_consent_mode_integration() {
if (!class_exists('Cookie_Law_Info'))
return;
$cli_bypass = isset($_GET['cli_bypass']) ? 1 : 0;
?>
<script>
var wt_cli_ad_storage = 'denied';
//set default value "denied" or "granted"
//for advertisement cookies storage
View functions.php
$temp= 'a';
add_filter('wt_alter_sequence_number','wt_change_seq_numbers',10,2);
function wt_change_seq_numbers ($sequence_number,$order_id)
{
global $temp;
if($order_id >= 130499 && $order_id <= 130501)
{
$sequence_number = '1500';
$sequence_number = $sequence_number.$temp;
update_post_meta($order_id, '_order_number', $sequence_number);
View functions.php
function wt_mime_types($mime_types) {
$mime_types['webp'] = 'image/webp'; //Adding webp extension
return $mime_types;
}
add_filter('upload_mimes', 'wt_mime_types', 1, 1);