Skip to content

Instantly share code, notes, and snippets.

View codersaiful's full-sized avatar

Saiful Islam codersaiful

View GitHub Profile
<?php
/**
* If you want, that your table will display with default search
* suppose: you want to show product based on search keyword,
* use following code snippet
*
* you can add your code to your
* theme's functions.php file
*
<?php
add_filter('wpt_query_args',function($args){
//Change your text here
$target_Text = 'Your Text';
$args['s'] = $args['wpt-s'] = $target_Text;
$args['wpt_query_type'] = 'search';
return $args;
});
<?php
add_filter( 'woocommerce_loop_add_to_cart_args', 'wcmmq_custom_min_max_arg_regen', 999999, 2 );
add_filter( 'woocommerce_quantity_input_args', 'wcmmq_custom_min_max_arg_regen', 999999, 2 );
add_filter( 'woocommerce_available_variation', 'wcmmq_custom_min_max_arg_regen', 999999, 2 );
function wcmmq_custom_min_max_arg_regen($args, $product)
{
$product_id = $product->get_id();
$stock_status = get_post_meta($product_id,'_stock_status',true);
<?php
add_filter('wpt_table_row_attr', function($attr, $row_object){
$product_id = $row_object->product_id;
$color = get_post_meta($product_id, '_wpt_bg_color', true);
// if( empty( $color ) ) return;
// $color = '#aabbcc';
// return "data-color='$color_code'";
return "style='background-color:$color;'";
},10, 2);
<?php
add_filter('wpt_table_row_attr', function($attr, $row_object){
$product_id = $row_object->product_id;
// var_dump($attr, $row_object);
$color_code = '#aabbcc';
return "style=background-color:$color_code;";
return $attr;
},10, 2);
<?php
//Athis this code inside your theme's functions.php file.
add_action('wp_footer',function(){
?>
<script>
jQuery(function($){
'use strict';
$(document).ready(function($){
$('button.button.wpt-search-products').attr('id','saiful');
});
<?php
add_filter('wqpmb_show_validation',function($bool, $data){
global $product;
if(!is_object($product)) return $bool;
if(is_object($product) && $product->get_type() === 'simple'){
return $bool;
}else{
return false;
}
<?php
//COPY THIS BELLOW LINE ONLY TO PASTE IN YOUR functions.php
add_filter('wcmmq_default_qty_option', '__return_true');
add_filter('wcmmq_single_product_min_max_condition', 'wcmmq_custom_default_value_enable', 10, 2);
function wcmmq_custom_default_value_enable($args, $product){
if(!defined('WC_MMQ_PREFIX')) return $args;
$product_id = $product->get_id();
$key = WC_MMQ_PREFIX . 'default_quantity';
<?php
add_filter('woocommerce_product_loop_start','__return_false');
add_filter('woocommerce_product_loop_end','__return_false');
add_filter('wc_get_template_part',function($template, $slug, $name){
// var_dump($template, $slug, $name);
if($slug === 'content' && $name === 'product') return false;
return $template;
}, 10, 3);
remove_action('woocommerce_before_shop_loop','wc_setup_loop');
<?php
remove_action('woocommerce_shop_loop','electro_shop_loop');
add_action('woocommerce_shop_loop','ca_wpt_custom_shoppage_table_temp');
function ca_wpt_custom_shoppage_table_temp(){
$config = get_option( 'wpt_configure_options' );
$table_id = isset( $config['archive_table_id'] ) ? $config['archive_table_id'] : false;
$table_id = apply_filters( 'wpto_default_archive_table_id', $table_id );
$table_id = is_numeric( $table_id ) ? (int) $table_id : false;
$id = get_queried_object_id();