Useful Filters

Codes from this article should be added into child-theme/functions.php file using FTP.

Filter that allows the reversal of the product order in the mini-cart content:

Filter name: et_mini_cart_reverse

Filter usage:

add_filter('et_mini_cart_reverse', '__return_true');

Topic

Filter that allows to show cart canvas on cart/checkout pages. By default it is not shown on those pages:

Filter name: etheme_cart_content_shown_cart_checkout_pages

Filter usage:

add_filter('etheme_cart_content_shown_cart_checkout_pages', '__return_true');
add_filter('woocommerce_widget_cart_is_hidden', '__return_false'); // also we need to add filter for default woocommerce because they hide cart widget area on cart/checkout pages 

Filter to show full title in prev/next navigation instead of cropped one by 30 chars:

Could be useful if user has HTML in title and to prevent bad cropping html chars but showing the full title.

Filter name: etheme_prev_next_title

Filter usage:

add_filter('etheme_prev_next_title', function ($title, $full_title) {
return $full_title;
}, 10, 2);

Topic

Filter to show the full title in the sticky cart panel instead of cropped one by 30 chars:

Could be useful if user has HTML in title and to prevent bad cropping html chars but showing the full title.

Filter name: etheme_sticky_cart_title

Filter usage:

add_filter('etheme_sticky_cart_title', function ($title, $full_title) {
return $full_title;
}, 10, 2);

Filter to remove the Shop step from breadcrumbs:

Filter usage:

add_filter( 'etheme_breadcrumbs_shop_step', '__return_false');

Topic

Filter to change default pre-rendered variations loaded on frontend:

Filter usage:

add_filter( 'woocommerce_ajax_variation_threshold', function($limit) {
return 70;
} );

Topic

Filter to show the Buy now button in the sticky add to cart panel on mobile:

Filter name: etheme_sticky_add_to_cart_buy_now_hide_mobile

Filter usage:

add_filter('etheme_sticky_add_to_cart_buy_now_hide_mobile', '__return_false');

Info: If someone needs to hide add_to_cart and show buy now there then the filter above will help + CSS code (Theme Options > Theme Custom CSS > Global):

@media only screen and (max-width: 767px) {
    .etheme-sticky-cart .add_to_cart_button, .etheme-sticky-cart .et-or-wrapper {
        display: none;
    }
}

to hide add_to_cart + or wrapper in the sticky panel on custom @media .

Updated on September 26, 2024
Was this Article helpful?