Skip to content

Instantly share code, notes, and snippets.

View codersaiful's full-sized avatar

Saiful Islam codersaiful

View GitHub Profile
<?php
add_filter('wpto_is_multiple_selectable','__return_true');
<?php
add_filter( 'wpt_archive_layout', 'wpt_custom_archive_layout' );
/**
* Determines the layout for the archive page. Specially for Shop page actually
* First enable from Configuration page.
* See @link https://wooproducttable.com/docs/doc/table-options/product-table-woocommerce-archive-category-tag-attribute-page/
*
* @param string $layout The current view. Available table|grid
* @return string The layout for the archive page. Possible values are 'table' or 'grid'.
<?php
/**
* To enable Custom Validaion message from
* Configure / Setting, Use following filter
*/
add_filter('wcmmq_custom_validation_msg', '__return_true');
<?php
add_filter('gettext', 'wpt_custom_specific_text_change', 10, 3);
function wpt_custom_specific_text_change($translation, $text, $domain) {
if ($domain !== 'woo-product-table') return $translation;
// Check if the original translation text matches "Your Text"
if ($translation === 'Your Text') {
return 'Your Custom Text'; // Replace with your custom text
}
<?php
/**
* Replace your item and items text
* for Footer Cart
*/
add_filter('ngettext_woo-product-table', 'wpt_custom_item_text_change', 10, 5);
function wpt_custom_item_text_change($translation, $single, $plural, $number, $domain) {
if ($single !== '%d item') return $translation;
<?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
@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
/**
* If you want to set Zero for default quantity value,
* this function and hook will help you.
*
* @author Saiful Islam <codersaiful@gmail.com>
*/
add_filter('woocommerce_quantity_input_min','wpt_custom_default_quantity_zero');
function wpt_custom_default_quantity_zero(){
<?php
/**
* Default Quantity Handle for old user
* Actually I have removed default quanity feature for new version.
*
* @author Saiful Islam <codersaiful@gmail.com>
* @link https://github.com/codersaiful
*/
<?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;
}