Skip to content

Instantly share code, notes, and snippets.

View codersaiful's full-sized avatar

Saiful Islam codersaiful

View GitHub Profile
<?php
/**
* Disable min max for specific condition
*
* @author Saiful Islam <[email protected]>
*/
add_filter('wcmmq_single_product_min_max_condition','wcmmq_custom_min_max_control');
add_filter('wcmmq_add_validation_check','wcmmq_custom_validation_bool');
add_filter('wcmmq_cart_validation_check','wcmmq_custom_validation_bool');
<?php
function wcmmq_set_min_value_as_input_value($args){
if(is_cart()) return $args;
$args['input_value'] = $args['min_value'] ?? 1;
return $args;
}
add_filter('woocommerce_quantity_input_args','wcmmq_set_min_value_as_input_value',999999);
<?php
//Add code to your functions.php file or using code snippet plugin from this line
add_filter('wpto_searchbox_taxonomy_name','wpto_custom_searchbox_taxonomy_name', 10, 3);
function wpto_custom_searchbox_taxonomy_name($taxonomy_menu_name, $taxonomy_details, $table_id){
//If want to set based on $table_id
//Here 123 is your selected table id. and uncomment following line
// if($table_id !== 123) return $taxonomy_menu_name;
<?php
add_filter('wpto_product_description', 'wpto_custom_wpto_product_description');
function wpto_custom_wpto_product_description($description){
$leter_limit = 100;
$description = strip_tags($description);
$description = substr($description,0,$leter_limit);
return $description;
}
<?php
/**
* Default Quantity Handle for old user
* Actually I have removed default quanity feature for new version.
*
* @author Saiful Islam <[email protected]>
* @link https://github.com/codersaiful
*/
<?php
/**
* If you want to set Zero for default quantity value,
* this function and hook will help you.
*
* @author Saiful Islam <[email protected]>
*/
add_filter('woocommerce_quantity_input_min','wpt_custom_default_quantity_zero');
function wpt_custom_default_quantity_zero(){
@codersaiful
codersaiful / gist:c06e90646c5b06ec9a4ead9930edf5be
Created January 30, 2024 12:58
hide-zero-price-product-from-table.php
<?php
//Use following code. You can use it using code snippet plugin or in your theme’s functions.php file.
add_action('wpt_table_row',function($Row){
$price = $Row->product_data['price'] ?? 'no_price';
if( empty( $price )){
$Row->display = false;
}
});
<?php
/**
* Disable Plus minus button for specific page
* such: cart page, checkout page,
* using filter hook: 'wqpmb_show_validation'
*
* There are few filter hook
* wqpmb_show_validation bool filter hook
* wqpmb_on_product_page bool filter hook