Skip to content

Instantly share code, notes, and snippets.

@webtoffee-git
webtoffee-git / gist:1c7d2fc9c14e4acf5bacaf9083692acb
Created March 25, 2024 06:52
Code to adjust the product image size in the product table- By WebToffee (Print invoice free)
<?php //do not copy this line of code
add_filter('wt_pklist_alter_order_template_html','wf_pklist_alter_image_size',10,6);
function wf_pklist_alter_image_size($html, $template_type, $order, $box_packing, $order_package, $template_for_pdf)
{
if($template_type == 'invoice')
{
if(!empty($order))
{
$html.='<style>
.wfte_product_image_thumb
@webtoffee-git
webtoffee-git / function.php
Created March 21, 2024 04:20
Restricting Vendors on a IAB TCF Banner - By WebToffee (GDPR Cookie Consent plugin)
<?php //Do not add this line of code
add_filter('wt_cli_allowed_vendor_list','wt_alter_allowed_vendor_list');
function wt_alter_allowed_vendor_list($vendor_list){
return array('61','755');
}
@webtoffee-git
webtoffee-git / function.php
Created March 20, 2024 13:26
To change the position of delete button in wishlist table - By WebToffee (Wishlist for WooCommerce)
<?Php //Do not copy this line of code
add_action('wp_footer','wt_rp_wishlist_delete_btn',10);
function wt_rp_wishlist_delete_btn() {
?>
<script>
jQuery(document).ready(function (){
jQuery('.wt_frontend_wishlist_table tbody tr').each(function() {
var table_row = jQuery(this);
@webtoffee-git
webtoffee-git / function.php
Created March 20, 2024 13:25
Code to skip arithmetic operations in the order_notes field - By WebToffee (Order import export basic)
<?php //Do not copy this line of code
add_filter('wt_iew_importer_skip_from_evaluation', 'wt_iew_importer_skip_from_evaluation_wpla');
if(!function_exists('wt_iew_importer_skip_from_evaluation_wpla')){
function wt_iew_importer_skip_from_evaluation_wpla($evl_arra) {
$evl_arra[] = 'order_notes';
return $evl_arra;
}
}
@webtoffee-git
webtoffee-git / functions.php
Last active March 18, 2024 17:40
To hide the cookie bar on selected pages and to disable pluginJS and CSS (https://wordpress.org/plugins/cookie-law-info/)
<?php // do not copy this line of code
add_filter('cli_show_cookie_bar_only_on_selected_pages', 'webtoffee_custom_selected_pages', 10, 2);
function webtoffee_custom_selected_pages($html, $slug) {
// In the eg here, the page with slug "sample-page" will be excluded from showing banner.
$slug_array = array('sample-page');
if (in_array($slug, $slug_array)) {
$html = '';
}
@webtoffee-git
webtoffee-git / function.php
Created March 18, 2024 08:30
Export WooCommerce Reward Points - By WebToffee (WordPress Users and WooCommerce Customer Import Export Plugin for WooCommerce)
<?php //Do not copy this line of code
//Export
add_filter('wt_iew_alter_export_data', "hf_csv_customer_post_columns",10);
function hf_csv_customer_post_columns ($export_data){
$export_data["head_data"]["meta:wc_points_rewards_user_points_log_data"]="meta:wc_points_rewards_user_points_log_data";
$export_data["head_data"]["meta:wc_points_rewards_user_points_data"]="meta:wc_points_rewards_user_points_data";
return $export_data;
}
add_filter("hf_customer_csv_export_data","hf_customer_csv_export_data",10,2);
function hf_customer_csv_export_data($customer_data, $csv_columns){
@webtoffee-git
webtoffee-git / functions.php
Last active March 18, 2024 08:29
Import WooCommerce Reward Points - By WebToffee (WordPress Users and WooCommerce Customer Import Export Plugin for WooCommerce)
<?php //Do not copy this line of code
//Import
add_filter('xa_user_impexp_alter_user_meta','xa_user_impexp_alter_user_meta_point_reward',10,3);
function xa_user_impexp_alter_user_meta_point_reward($found_customer, $user_meta_fields, $meta_array){
global $wpdb;
$user_points_log_db_tablename = $wpdb->prefix . 'wc_points_rewards_user_points_log';
$user_points_db_tablename = $wpdb->prefix . 'wc_points_rewards_user_points';
$wpdb->hide_errors();
if($wpdb->get_var("SHOW TABLES LIKE '$user_points_log_db_tablename'") != $user_points_log_db_tablename) {
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
@webtoffee-git
webtoffee-git / function.php
Created March 18, 2024 07:10
Code to make the order key a unique identifier - By WebToffee (Order Export & Order Import for WooCommerce)
<?php //Do not copy this line of code
add_filter('wt_woocommerce_order_importer_pre_parse_data', 'wt_woocommerce_order_importer_pre_parse_data_to_update_comflict_orders');
if(!function_exists('wt_woocommerce_order_importer_pre_parse_data_to_update_comflict_orders')){
function wt_woocommerce_order_importer_pre_parse_data_to_update_comflict_orders($data){
if(isset($data['mapping_fields']['order_key']) && !empty($data['mapping_fields']['order_key'])){
$order_key = $data['mapping_fields']['order_key'];
$order_id = wc_get_order_id_by_order_key( wc_clean( wp_unslash( $order_key ) ) );
if(!is_wp_Error(wc_get_order($order_id))){
$data['mapping_fields']['order_id'] = $order_id;
}
@webtoffee-git
webtoffee-git / function.php
Created March 13, 2024 06:49
Code to adjust the number of products displayed per row in the related products widget - By WebToffee (Related Products for WooCommerce)
<?php //Do not copy this line of code
add_filter( 'woocommerce_related_products_columns', 'wt_rp_related_products_args' ,10,1);
function wt_rp_related_products_args( $column_number ) {
$column_number = 5; /* Modify this value based on the number of products that want to display in each row */
return $column_number;
}
@webtoffee-git
webtoffee-git / functions.php
Created March 11, 2024 10:29
To convert short code to html - Product Feed for WooCommerce By WebToffee (https://wordpress.org/plugins/webtoffee-product-feed/)
<?php //Do not copy this line of code
add_filter('wt_feed_filter_product_description', 'wt_feed_filter_product_description', 10, 2);
function wt_feed_filter_product_description($description, $product) {
$description = do_shortcode($description);
return $description;
}