WooCommerce Archives - eCommerce Thesis

Category: WooCommerce

WooCommerce Custom Product Sorting – Remove, Rename, Reorder

In this tutorial, I am going to share ” How to Remove, Rename, Reorder or Add Custom Sorting Options? ” You know, By Default, you can do this easily by following below step

Go to Appearance > Customize in your WordPress admin, you can change some of your display settings. In the Customizer, go to WooCommerce then Product catalog change the “Default product sorting” to “Default sorting (custom ordering + name)” and we’ll get going from there.

But this tutorial is not to show you the Default option. Actually, I am going to show you Custom Product Sorting including Remove, Rename, Reorder. So Let’s Get Started

Remove Default Sorting Options

Here I am going to use just one filter hook woocommerce_catalog_orderby, it is very similar to how we add or remove items from my account menu, admin columns, etc.

Ok, so the default sorting options are on the screenshot:

And this is the code which allows to remove them:

add_filter( 'woocommerce_catalog_orderby', 'fa_remove_default_sorting_options' );
 
function fa_remove_default_sorting_options( $options ){
 
    unset( $options[ 'popularity' ] );
    //unset( $options[ 'menu_order' ] );
    //unset( $options[ 'rating' ] );
    //unset( $options[ 'date' ] );
    //unset( $options[ 'price' ] );
    //unset( $options[ 'price-desc' ] );
 
    return $options;
 
}

You can insert all the code from this article to your theme functions.php file.

Rename the Default Sorting Options

Nothing special here, we are using just the same filter hook – woocommerce_catalog_orderby.

A simple example for you – let’s assume that customers rarely use sorting by “Price: high to low”, so we do not need it? In this case we have to do two things: remove it and rename “Sort by price: low to high” to just “Sort by price”, correct?

add_filter( 'woocommerce_catalog_orderby', 'fa_rename_default_sorting_options' );
 
function fa_rename_default_sorting_options( $options ){
 
	unset( $options[ 'price-desc' ] ); // remove
	$options[ 'price' ] = 'Sort by price'; // rename
 
	return $options;
 
}

Change the Order of Sorting Options

The most simple and clean way to change the order of sorting options is to redefine the whole array, like this:

add_filter( 'woocommerce_catalog_orderby', 'fa_change_sorting_options_order', 5 );
 
function fa_change_sorting_options_order( $options ){
 
    $options = array(
 
        'menu_order' => __( 'Default sorting', 'woocommerce' ), // you can change the order of this element too

        'popularity'      => __( 'Sort by popularity', 'woocommerce' ), // I need sorting by popularity
        
        'date'       => __( 'Sort by latest', 'woocommerce' ), // Let's make "Sort by latest" the second one

        'rating'      => __( 'Sort by rating', 'woocommerce' ), // I need sorting by rating

        'price'      => __( 'Sort by price: low to high', 'woocommerce' ), // I need sorting by price to be the first

        'price-desc'      => __( 'Sort by price-desc: high to low', 'woocommerce' ), // I need sorting by price to be the first
 
    );
 
    return $options;
 
}

Add a Custom Sorting Option

I have a bonus for you – I am going to create two of them!

add_filter( 'woocommerce_catalog_orderby', 'fa_add_custom_sorting_options' );
 
function fa_add_custom_sorting_options( $options ){
 
	$options['title'] = 'Sort alphabetically';
	$options['in-stock'] = 'Show products in stock first';
 
	return $options;
 
}

You may think – but what is the default product sorting, it looks like they are already displayed by title, isn’t it? Nope – the default sorting is by menu order and then by title.

But obviously it is not enough. When you select any of the added options, nothing will happen. Because you have to do one more step.

add_filter( 'woocommerce_get_catalog_ordering_args', 'fa_custom_product_sorting' );
 
function fa_custom_product_sorting( $args ) {
 
	// Sort alphabetically
	if ( isset( $_GET['orderby'] ) && 'title' === $_GET['orderby'] ) {
		$args['orderby'] = 'title';
		$args['order'] = 'asc';
	}
 
	// Show products in stock first
	if( isset( $_GET['orderby'] ) && 'in-stock' === $_GET['orderby'] ) {
		$args['meta_key'] = '_stock_status';
		$args['orderby'] = array( 'meta_value' => 'ASC' );
	}
 
	return $args;
 
}

All the code need to be insert in functions

Looking WordPress Developer? Hire Me You can know more about ne at here

Dokan or Mayosis 🤔 Which one is best for Digital Download Marketplace

Digital download refers to download any digital product from the internet. For Example Software, Ebooks, Audio Files, and Music Production Software, Games, Photography, Video. Selling Digital products online is a great idea.

Amazon – The World Best Online Marketplace even started the business by selling a digital product. There are over 2 billion digital buyers in the world. (Source)

As you know, I am working as an eCommerce Web Developer and different clients come to me to build different websites. Multi-Vendor eCommerce website one of them.

Recently I met some clients who wanted to multi-vendor eCommerce website to sells Digital products and they ask me to provide them the right suggestion to buy the right theme, plugin, and domain hosting so that they get the best website.

Which one I should Choose

Dokan is Best Multi-vendor WordPress Theme that already knows by many people. World Class Marketplaces that Chose Dokan. Around 12 million online stores exist today worldwide.

Mayosis – Digital Marketplace WordPress Theme. They are selling well for unique UI designs for different categories like sell Images, Videos, Audio.

Dokan runs on their own plugin but Mayosis depend on Easy Digital Downloads plugin. But for Design both use Elementor Plugin that is right now Best WordPress Page Builder Theme.

Dokan basically built their plugin to solve the multi-vendor online marketplace problem. They focused on solving client problems to build any type of multi-vendor eCommerce Online Marketplace.

Mayosis is a trending theme in Theme Forest on the search result of Digital Download WordPress Theme Because they make a very unique design for different types of product.

Meiosis only focuses on the Digital Download Multi Vandor eCommerce Website they do not target all the clients who wanted to build any product type multi-vendor e-commerce marketplace like Dokan. So their target customer only wanted to build a Digital Download Online Store with Multi-Vandor Feature.

Meiosis theme price only $67 but you never think to build your online marketplace with $67, $100, $500. There have many additional costs.

Domain, Hosting, Logo, Plugins, Developer Cost all makes your cost 1000$ + depend on features.

Best Appointment Booking Plugin for WordPress WooCommerce

Appointment Booking system works always. This gives freedom to potential customers to book any service or product or a room anytime they want.

It helps you to maximizes your sales because you are open 24 hours for works.

In this tutorial I am going to share Booking Plugin for WordPress 🌏 Best Appointment Booking Plugin for WordPress WooCommerce 👇 FREE

Premium WordPress Plugin

Booki – WordPress Booking Calendar plugin for reservations and appointments

Bookme – WordPress Appointment Booking Scheduling Plugin

HBook – Hotel booking system – WordPress Plugin

Thank you for your the time to read my blog. If you need any help contact with me

Add Custom Author Image to WordPress User Profile without Plugin

Add Author Image to WordPress User Profile is very easy with the plugin but as an SEO Expert alongside WordPress Developer I always recommended using fewer plugins and do custom coding to keep website speed up.

To Improve your personality and personal brand image you must add your unique profile photo to your WordPress user profile instead of the default gravatar.

So to make this tutorial more easy and user friendly, I have created a video tutorial in my youtube channel. Take a look below video.

💻 Welcome to * Add Custom Author Image to WordPress User Profile without Plugin ✅ Upload User Profile Picture in WP*

📝 Video Description: In this tutorial, I am going to show a simple process to add a custom profile picture without a plugin.

If you like the video don’t forget to:

👍 Give It A Thumbs Up
🎯 Hit The Subscribe Button
👉 Don’t Forget To Share

📌Subscribe: https://www.youtube.com/c/FoysalAhmedWebDesigner?sub_confirmation=1
📌 Follow me on Facebook: https://web.facebook.com/foysalonlinetrainer
📌 Follow me Linkedin: https://www.linkedin.com/in/foysal-ahmed/
📌 Follow me on Twitter: https://twitter.com/foysalwordpress
📌 Visit my website: https://www.ecommercethesis.com
📌 Visit my blog: https://foysalahmedwebdesigner.blogspot.com
📌 Ask me quora: https://www.quora.com/profile/Foysal-Ahmed-23

💻 My Services: https://www.fiverr.com/users/foysalelementor 🚀

add_filter( 'avatar_defaults', 'wpb_new_gravatar' );
function wpb_new_gravatar ($avatar_defaults) {
$myavatar = 'your_image_url';
$avatar_defaults[$myavatar] = "Default Gravatar";
return $avatar_defaults;
}

We are done. But If you like to do this with plugins ( I don’t recommend ) then try the below-listed plugins.

User Profile Picture – WordPress plugin | WordPress.org

Description

Set or remove a custom profile image for a user using the standard WordPress media upload tool.

How To Upload WebP Files on WordPress

WebP is a modern image format employing both lossy and lossless compression. WebP helps webmasters and web developers to create smaller, richer images that make the web faster.

It makes the website SEO friendly. As a professional eCommerce web developer. I always use WebP formate image in my client’s web design project and always recommended to my follow or beginners use this format.

But there is an issue when you will try to upload in your website that builds with WordPress

If you’ve tried to upload a Webp file to your media library and received the “Sorry, this file type is not permitted for security reasons” error, you may feel stumped as to how to proceed. Below I will explain how to solve the problem.

//** *Enable upload for webp image files.*/
function webp_upload_mimes($existing_mimes) {
    $existing_mimes['webp'] = 'image/webp';
    return $existing_mimes;
}
add_filter('mime_types', 'webp_upload_mimes');


//** * Enable preview / thumbnail for webp image files.*/
function webp_is_displayable($result, $path) {
    if ($result === false) {
        $displayable_image_types = array( IMAGETYPE_WEBP );
        $info = @getimagesize( $path );

        if (empty($info)) {
            $result = false;
        } elseif (!in_array($info[2], $displayable_image_types)) {
            $result = false;
        } else {
            $result = true;
        }
    }

    return $result;
}
add_filter('file_is_displayable_image', 'webp_is_displayable', 10, 2);

If you need any support relavent WordPress then you can hire me at Fiverr

Some of my services include:

Website Setup
Demo Theme Setup
Plugins Setup
Theme Customization
Page Post Create
Update Pages
Fix Responsive Issues.
Speed Optimisation
Design Optimisation
SEO Optimisation
Backups and Migration
WordPress Errors Fixing
Fixing Error Establishing Database Connection
Plugin Issues Fixing
Fixing Theme Issues
Website Security
SSL Certificate Add with Green Padlock
Live Chat Messenger Integrate
Full eCommerce site using WooCommerce

I will provide you Professional Support as your requirements. I’m super organized, seeking a happy customer, and will be delighted to work for you, and hopefully, in no time I will fix, edit, customize your website 🙂