Pawan Kumawat

How to Remove Product Tabs on Product Page

To remove product tabs on the WooCommerce product page, you can use the `woocommerce_product_tabs` filter. This filter allows you to modify or remove the default product tabs provided by WooCommerce. By removing the tabs you don’t want, you can customize the product page layout to suit your needs.

Customize Woocommerce Settings Tab

Let’s talk about customizing Woocommerce Admin setting Tabs.To hide a specific Woocommerce setting tab or want to customize the Woocommerce setting tabs, not the entire sub-menu, but just a tab.For just Removing tabs we can use

When adding product to cart and then refreshing the page it adds product again to cart.

Add to cart duplicates products on refresh page?   Generally in WooCommerce clicking on Add-to-Cart and it successfully add the product and display the message that the product is added. And on refreshing the page and message did not disappear and it adds the product once more to cart. And how many times am refreshing the page it is adding the product again to cart.   This is because when add to cart process is not executed using ajax , than it is executed by query string. When Adding product to cart using query string, URL becomes something like this”?add-to-cart=1234&quantity=1” so when we refresh the page, this will again execute and product will again add to cart. So to Remove This Issue We have To redirect the page after add to cart.   There is a option in WooCommerce that lets you redirect customers directly to the cart when they’ve

Display a Product Category Dropdown and Redirect To Single Category Upon Selection.

How To add category dropdown Before WooCommerce product loop? WooCommerce product loop is generally on shop page and category page. on both pages WooCommerce provide hooks before the loop and after the loop. “woocommerce_before_shop_loop” “woocommerce_after_shop_loop” For adding a category dropdpwn or other texonomy dropdown We will use “woocommerce_before_shop_loop”.   For Both Product loop. (shop page and category page) function CategorySwitcher() { wc_product_dropdown_categories(); $category_base=get_option(‘woocommerce_permalinks’)[‘category_base’]; wc_enqueue_js( ” (‘#product_cat’).change(function () { location.href = ‘”.site_url().’/’.$category_base.”/’ + $(this).val(); }); “); } add_action(‘woocommerce_before_shop_loop’,’CategorySwitcher’,100); For Only Category Archive Page.   function CategorySwitcher() { if ( is_product_category() ) { wc_product_dropdown_categories(); } $category_base=get_option(‘woocommerce_permalinks’)[‘category_base’]; wc_enqueue_js( ” (‘#product_cat’).change(function () { location.href = ‘”.site_url().’/’.$category_base.”/’ + $(this).val(); }); “); } add_action(‘woocommerce_before_shop_loop’,’CategorySwitcher’,100); For Only Shop Page.   function CategorySwitcher() { if ( is_shop() ) { wc_product_dropdown_categories(); } $category_base=get_option(‘woocommerce_permalinks’)[‘category_base’]; wc_enqueue_js( ” (‘#product_cat’).change(function () { location.href = ‘”.site_url().’/’.$category_base.”/’ + $(this).val(); }); “); } add_action(‘woocommerce_before_shop_loop’,’CategorySwitcher’,100);  

Add same product to cart twice instead of changing quantity in Cart Page.

How to add the same product twice to cart instead of changing quantity in WooCommerce   In normal case when we increase quantity of product in WooCommerce cart it simply increase quantity of same product that’s one product with incremented quantity. But In some of cases, We like to have product in WooCommerce added in the cart as separate items and not as the same item with the changed quantity. Basically we need to display separate cart items for product quantity > 1. We can do that with pasting the code To the functions.php of theme.   This Is Done Basically In Two Steps:   Step 1: Split product quantities into multiple cart items.   In This Hooks Basically, when we are adding a new product to cart ,we have added a unique key to each cart item meta. that’s why the same product become distinct product each time. For

Disable Automatic Login After Registration

When we enable customer registration on My Account page, We will know that when new user is register it’s automatically logged in .
it need to change when we need to manually approve each user.

Display “FREE” if Product Price is 0 or Empty On WooCommerce Cart Page Or Checkout Page.

Do you ever need to replace the default WooCommerce pricing label for a free product?   If we ask any user what will he/she like the text “FREE” or a price tag of “0.00”. Majority will say “Free” Attracts More.   Now Let’s talk about WooCommerce ,In WooCommerce when product price is zero or empty then on cart page or checkout page and product page will show zero price ($0.00). Instead of showing the default WooCommerce pricing label of $0.00, you want to show custom text,like “FREE” or “Download Now”. In Previous Image we so price tag , But I still believe “FREE” looks much better than “$0.00”. It’s much more enticing, isn’t it?   For Cart and Checkout Page:   function FreeCartItemPriceCustomLabel( $price, $cart_item, $cart_item_key ) { $FreeLabel = ‘<span class=”amount” style=” color: #f7ad06 !important; “>’ . __(‘Free’) . ‘</span>’; if( $cart_item[‘data’]->get_price() > 0 ){ return $price; }else{ return

Categories