A customer can edit their details from Account Details (edit account) page, under My Account section of WooCommerce. Customer can edit their first name, last name, display name, email address and password from there. These fields are all required, when someone tries to edit. Our goal is to make the… Read More »
Category: WordPress
Limit excerpt length for posts from specific category or taxonomy
Sometimes we may need to show limited or extra excerpt content for posts from some specific category/taxonomy. We can easily control excerpt length using the_excerpt filter. And with help from has_term function, we can define separate length for one or more specific categories. In the above code, line 3 defines… Read More »
Don’t redirect to WooCommerce product single page after “add-to-cart” error
When you face an error during adding a product to cart on WooCommerce shop or any other archive page, it redirects you to the product single page with an error message. Today our goal is to stop that redirect and stay on the shop or the archive page – wherever… Read More »
Add new WooCommerce checkout field
WooCommerce checkout page is modular. We can easily add new checkout field or edit existing fields or remove existing fields. There are two ways to add custom field in checkout page. They are: using woocommerce_checkout_fields filter and adding a custom field on certain locations. woocommerce_checkout_fields makes it very easy to… Read More »
Update shipping fee on state and postcode change on WooCommerce checkout page
Some theme may already come with the option of automatically updating shipping fee/checkout totals when updating state and/or postcode on WooCommerce checkout page. This is very useful to get proper shipping fee during order. I will say this should be a mandatory option for all themes. But unfortunately, it is… Read More »
Empty WooCommerce cart after successful order
WooCommerce by default empties cart when an order is placed successfully. But there are some plugins and/or themes, which alter this default functionality, and keep items on cart even after an order was completed with successful payment. While this can be useful for more sales, it is also can be… Read More »
Show WordPress subcategories name with link for any given category
We can use get_terms to get subcategories of any given category in WordPress. This will work with WooCommerce and any other custom taxonomy. Here I will create an utility function to show subcategories wherever we need. I will also create a shortcode to show it from post/page editor. Utility Function… Read More »
Hide all WordPress admin notices for non-admin users
If you gave wp-admin access to some users as editor or contributor etc, they will see those WordPress admin notices, even though those notices are mostly meaningless for them. Not ideal for end users, and often can be confusing. So we will turn off all admin notices for non-admin users… Read More »
Hide WordPress update notices for non-admin users
If you gave wp-admin access to some users as editor or contributor etc, they will see those update WordPress notices, even though they can’t perform the update. This is not very comprehensive behavior. So we are going to turn off update notices for non-admin users from wp-admin dashboard by removing… Read More »
Get parent term of any given term id in WordPress
Getting parent term of any given term id is bit complex, and WordPress doesn’t have any built in method for this. So, I have built a utility function to get top most or immediate parent of any given term id. For example: If you want to get parent category name… Read More »