Skip to content

Instantly share code, notes, and snippets.

View MinaPansuriya's full-sized avatar

Mina Pansuriya MinaPansuriya

View GitHub Profile
/**
* @Title: Remove WooCommerce Product Sorting Dropdown from Shop and Category pages
* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
*/
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
/**
* @Title: Hide WooCommerce Product Sorting Dropdown from Shop and Category pages
* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
*/
.woocommerce-ordering {
display: none !important;
}
/**
* @Title: Rename Single Product pages Tabs
* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
*/
add_filter( 'woocommerce_product_tabs', 'pbs_rename_woo_product_tabs', 98 );
function pbs_rename_woo_product_tabs( $tabs ) {
$tabs['description']['title'] = 'Product Description';
$tabs['reviews']['title'] = 'Ratings';
$tabs['additional_information']['title'] = 'Additional Information';
/**
* @Title: WooCommerce Remove Specific Product Tab
* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
*/
add_filter( 'woocommerce_product_tabs', 'pbs_woo_remove_product_tabs', 98 );
function pbs_woo_remove_product_tabs( $tabs ) {
unset( $tabs['description'] ); // Remove the description tab
unset( $tabs['reviews'] ); // Remove the reviews tab
unset( $tabs['additional_information'] ); // Remove the additional information tab
/**
* @Title: Add Product Inquiry tab to WooCommerce Single Product Page
* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
*/
add_filter( 'woocommerce_product_tabs', 'pbs_woo_add_product_inquiry_tab', 98 );
function pbs_woo_add_product_inquiry_tab( $tabs ) {
$tabs['pbs_inquiry_tab']['callback'] = 'pbs_woo_custom_desc_tab_content'; // Callback function for description tab
$tabs['pbs_inquiry_tab']['title'] = 'Product Inquiry';
/**
* @Title: WooCommerce - Reorder Tabs on Single Product page
* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
*/
add_filter( 'woocommerce_product_tabs', 'pbs_woo_reorder_tabs', 98 );
function pbs_woo_reorder_tabs( $single_product_tabs ) {
$single_product_tabs['reviews']['priority'] = 5; // 1st Position - Reviews Tab
$single_product_tabs['additional_information']['priority'] = 10; // 2nd Position - Additional Information Tab
/**
* @Title: WooCommerce Change Add to Cart Button Text for particular product type on Shop/Category Page
* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
*/
add_filter( 'woocommerce_product_add_to_cart_text' , 'pbs_woo_change_add_to_cart_button_text', 2, 99 );
function pbs_woo_change_add_to_cart_button_text($dflt_add_to_cart_text, $product) {
// Get the product type
$product_type = $product->product_type;
/**
* @Title: WooCommerce Change Add to Cart Button Text for particular product type on Single Product Page
* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
*/
add_filter( 'woocommerce_product_single_add_to_cart_text', 'pbs_change_single_product_add_to_cart_text', 2, 99 );
function pbs_change_single_product_add_to_cart_text($dflt_add_to_cart_text, $product) {
$product_type = $product->product_type;
/**
* @Title: Change number of products per row on Shop/Category Page
* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
*/
add_filter( ‘loop_shop_columns’, ‘pbs_woo_modify_no_of_columns_on_shop_page’ );
function pbs_woo_modify_no_of_columns_on_shop_page( $no_of_columns ) {
$no_of_columns = 3;
return $no_of_columns;
/**
* @Title: WooCommerce Display Specific "Out of Stock" Products on Shop Pages
* @Author: Mina Pansuriya
* @Website: http://minapansuriya.com
* Note: For complete tutorial visit: http://minapansuriya.com/woocommerce-display-selected-out-of-stock-products-on-shopcategory-pages/
*/
add_filter( 'woocommerce_product_is_visible', 'pbs_woo_disp_selected_out_of_stock_products', 2, 99 );
function pbs_woo_disp_selected_out_of_stock_products( $visible, $productId ) {