Category Archives: Open Source Solution

Woocommerce – remove tabs on the single product page

This snippet allows to quickly remove the tabs area that contains the description, review, attributes and potentially custom tabs. This area is shown by default under the “add to cart” button on the single product page in a WooCommerce shop.

Insert the code in functions.php of your child theme.

add_filter( 'woocommerce_product_tabs', 'remove_tabs_in_single_product', 11 );
 
function remove_tabs_in_single_product( $tabs ) {
	unset( $tabs );
	return $tabs;
}

If you want to remove only the description tab then use this snippet:

add_filter( 'woocommerce_product_tabs', 'remove_description_tab', 12 );
 
function remove_description_tab( $tabs ) {
	unset( $tabs['description'] );
	return $tabs;
}

If you want to remove only the review tab then use this snippet:

add_filter( 'woocommerce_product_tabs', 'remove_review_tab', 13 );
 
function remove_review_tab( $tabs ) {
	unset( $tabs['reviews'] );
	return $tabs;
}

w3 total cache w3tc

File Usage issue caused by WordPress W3 Total Cache

Context

TDLR

  • Website returns Http Error 503 the service is unavailable. Can’t access the WordPress Administration.
  • From CPanel, File Usage reached its hard limit (250,000 files)
  • From File Manager, removed directory “wp-content/cache”
  • File Usage is now way below the threshold
  • Able to access WordPress Administration and configure Total Cache, disabled Database Cache and Object Cache

Explanations

On shared hosting service, it is common to have a limitation on the number of files that can be stored on the hard drive. Even though the Disk Usage is far below the limit (disk 15% full), the File Usage limitation can generate serious issues.

On my hosting provider Zuver, the File Usage soft threshold is 200,000 files which will only give warnings. However, if it hits the 250,000 files hard limit, it will run into issues with the website (Http Error 503 the service is unavailable) and the cPanel account.

Basically, the server separates the entire hard drive into nodes, which are used to store files or parts of files. As you can imagine, a node will be a certain size, and there can only be so many nodes that take up all the space on the hard drive.

Because this is a shared hosting service with more than one user on the server, the number of INodes (files) that can be stored per user must be limited, to avoid hitting the server’s INode limit.

Usually, there is no way to increase the File Usage threshold with the hosting provider. Therefore, an investigation is required.

If WordPress uses W3 Total Cache with Database Cache and Object Cache enabled on disk, chances are that this is causing the issue. Also, you can check the tmp folder and the hidden directories.

The quick fix is to delete the folder /wp-content/cache and then access to the WordPress Administration panel to disable Database Cache and Object Cache.

That’s it.

Replace Storefront Footer Credit

In your child theme functions.php file, paste the below:

add_action( 'init', 'remove_storefront_credit', 10 );

function remove_storefront_credit() {
	remove_action('storefront_footer','storefront_credit',20);
	add_action('storefront_footer','my_credit',20);
}

function my_credit() {
	echo '<div class="site-info">';
	echo '© [My Company Name] '.get_the_date('Y');
	echo '</div>';
}

Then replace [My Company Name] by the name of your company or whatever you want.

Best Wordpress Plugins

[WIP] The Best WordPress Plugins & Themes (No Affiliation)

As a WordPress developer, I thought keeping an organized list of the best and worst plugins. Here is simply my feedback based on my experience with those plugins. This post hasn’t been affiliated by any of the plugin brands.

Here is my Testing Environment for WooCommerce: https://shop.nicolasrabier.com

Color code:

  • ✅ Approved
  • ⚠ Some Warnings
  • ❌ Don’t Waste Your Time

✅ WooCommerce By Automattic

This is a great eCommerce tool. I love it even though it’s far from being perfect.

Pros

  • free
  • works with physical or digital products
  • compatible with many Themes such as StoreFront By WooThemes (same team as Automattic)
  • awesome partnership with Stripe & Paypal plugins
  • you can have a simple shop up and running fairly quickly

Cons

  • require good knowledge of the tool to set it up properly
  • the marketing strategy of Automattic is to use WooCommerce as an entry point to sell the most interesting plugins.
  • You would believe for compatibility reason it is better to use only Automattic plugins but this is not necessary true. e.g.
  • General knowledge in PHP and specifically in WordPress framework can help you a lot and save you money.

✅ Storefront Theme

Pros

  • Front page of the store looks very professional and legit. In order to properly visualize the front page the store needs products and categories in the catalog. Therefore I suggest to import the Dummy Data provided in WooCommerce to have a clear idea of the shop style. Check out this video tutorial that explains how to import the dummy data – https://www.youtube.com/watch?v=LpWZ8jr4Nvw

Cons

  • Many extensions aren’t free

Not sure

  • Compatibility with CDN. When you develop a website for global market you need to make sure the website is quickly reachable from anywhere in the world and nowadays this is achieved via a Content Delivery Network. I personally use CloudFlare coupled with MaxCDN which are integrated via W3TotalCache plugin.

✅ Storefront Sticky Add to Cart By WooThemes 

Love it

✅ Shortcodes Ultimate By Vladimir Anokhin

Best plugin to display information (sliders, box, columns, animations, etc.)

I systematically download it on all my instances of WordPress.

 Child Theme Configurator By Lilaea Media 

Nothing exciting here but it simply makes the creation of a child theme effortless.

Pros

  • Simple and fast

 W3TotalCache By Frederick Townes

This plugin speeds up the loading time of websites from anywhere in the world. This is critical to deliver the best experience to your impatient audience.

Cons

Pros

❌ WooThemes

Cons

  • Poor documentation
  • Support is unreliable
  • Expensive

Note reviews on Theme Grade – http://www.themegrade.com/woothemes-rating/.

 All-In-One WP Migration By ServMask

WooCommerce – Change “Related Products” text

This snippet allows to quickly change the “Related products” text which is shown by default at the bottom of a single product page in a WooCommerce shop.

Check out on my test environment: https://shop.nicolasrabier.com/product/woo-album-4/

Insert the code in functions.php of your child theme.

/**
* Change text strings
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function custom_related_products_text( $translated_text, $text, $domain ) {
  switch ( $translated_text ) {
    case 'Related products' :
      $translated_text = __( 'Other items you might like', 'woocommerce' );
      break;
  }
  return $translated_text;
}
add_filter( 'gettext', 'custom_related_products_text', 20, 3 );

Post context:

  • WordPress
  • WooCommerce

Photo by Fikret tozak on Unsplash