Skip to content

Instantly share code, notes, and snippets.

@wtmujeebu
wtmujeebu / SAMPLE-HTML
Last active June 23, 2023 05:34
Sample HTML for test
<!DOCTYPE html>
<html>
<head>
<title>Scripts & Iframes</title>
<!-- Google Analytics - Start -->
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
@wtmujeebu
wtmujeebu / functions.php
Created June 8, 2022 11:15
Pass product short description instead of long description to Facebook Product Catalog using - WebToffee Product Catalog Sync for WooCommerce
<?php //Please do not copy this line.
add_filter('wt_facebook_product_description_mode', 'wt_facebook_product_catalog_description_mode');
function wt_facebook_product_catalog_description_mode($mode='long') {
$mode = 'short'; // Available values for the description mode is 'short' and 'long'
return $mode;
}
@wtmujeebu
wtmujeebu / functions.php
Last active March 15, 2022 10:52
Export WooCommerce Gift Card details with Order into separate column
<?php // Do not copy this line
// Alter CSV header
add_filter('hf_alter_csv_header', 'hf_alter_order_csv_header', 10, 2);
function hf_alter_order_csv_header($export_columns, $max_line_items) {
$gift_card_details = array('gift_card', 'gift_card_amount');
array_splice($export_columns, 14, 0, $gift_card_details);
return $export_columns;
@wtmujeebu
wtmujeebu / functions.php
Last active February 17, 2022 05:05
Modify FB retailed ID of the product before syncing - using Product Catalog Sync for WooCommerce by WebToffee
<?php // Do not copy this line.
add_filter('wt_fb_sync_product_retailer_id', 'wt_fb_sync_product_retailer_id', 10, 2);
function wt_fb_sync_product_retailer_id($fb_retailer_id, $product) {
$fb_retailer_id = $product->get_sku() ? $product->get_sku() : 'wc_post_id_' . $product->get_id();
return $fb_retailer_id;
}
@wtmujeebu
wtmujeebu / functions.php
Created January 10, 2022 12:22
Export all language products with WPML - Product import export for WooCommerce plugin by WebToffee
<?php // Please do not copy this line
add_filter('woocommerce_csv_product_export_args', 'wt_woocommerce_csv_product_export_args', 10, 1);
function wt_woocommerce_csv_product_export_args($args) {
$args['suppress_filters'] = true;
return $args;
}
@wtmujeebu
wtmujeebu / functions.php
Created November 25, 2021 04:52
Import only the most recent file from FTP using Import export suite for WooCommerce by WebToffee
<?php // Do not copy this line.
add_filter('wt_iew_folder_import_fetched_files','wt_import_latest_file',10,3);
if(!function_exists('wt_import_latest_file')){
function wt_import_latest_file($server_csv_files,$ftp_conn,$remote_file){
rsort($server_csv_files);
return array($server_csv_files[0]);
@wtmujeebu
wtmujeebu / functions.php
Last active November 9, 2021 08:17
Exclude additional data from product image URLs on export - product import export plugin for woocommerce by WebToffee
<?php // Please do not copy this line
add_filter('hf_export_image_metadata_flag','__return_false');
add_filter('wt_batch_product_export_row_data','wt_batch_product_export_row_data_img',10,2);
function wt_batch_product_export_row_data_img($row, $product){
if(isset($row['images']) && !empty($row['images'])){
$row['images'] = str_replace('|', ',', $row['images']);
@wtmujeebu
wtmujeebu / functions.php
Last active October 29, 2021 11:29
WooCommerce product import by WebToffee compatibility with - File Renaming on Upload plugin
<?php // Do not copy this line
add_filter('sanitize_file_name', 'sanitize_file_name_wt', 99999, 2);
function sanitize_file_name_wt($filename, $filename_raw) {
if (strpos($filename, 'temp_') !== false) {
return $filename_raw;
}
return $filename;
@wtmujeebu
wtmujeebu / functions.php
Created October 21, 2021 10:33
Escape backslash on CSV import when data contains slash
<?php // Do not copy this line
add_filter('wt_csv_raeder_csv_escape', 'wt_csv_raeder_csv_escape');
function wt_csv_raeder_csv_escape($csv_escape){
return '\\';
}
@wtmujeebu
wtmujeebu / functions.php
Last active July 7, 2024 10:55
Speed up WP insert post by removing all post insert actions
<?php // Please do not copy this line
add_action('admin_init', 'wt_remove_all_post_insert_actions');
function wt_remove_all_post_insert_actions() {
$actions = array(
'save_post_product', // WooCommerce product insert
'wp_insert_post',
'save_post',