There are ways to completely remove the WooCommerce Single Product page tabs, but in case you wish to remove only one of them, these easy snippets will teach you how to do just that.
For example, you may want to hide the “Reviews“ tab because you don’t want to enable product feedback. Or maybe you would like to hide the “Additional Information” tab, because you don’t need that information to be seen.
Either way, it’s super easy – enjoy!
Continue reading WooCommerce: Remove a Tab @ Single Product Page
A very handy snippet. Sometimes, you only want to show certain categories on the shop page, and have those products ONLY show under the category archive instead.
Continue reading WooCommerce: Hide Products From Specific Category @ Shop
There are many reasons why you may want to remove columns (e.g. subtotal) from the Cart table. Sometimes you just want to make it easier for your customers. The less information you show the better!
Some other times, you may have custom requirements. Well, hiding a Cart table column is actually very easy – and despite this can be done with PHP I believe the CSS way is way faster in this case. Here’s how it’s done!
Continue reading WooCommerce: How to Hide Cart Table Columns
I am a big fan of Elegant Themes, but a lot of CSS styles (mainly in Divi) contain “!important” in order to override WooCommerce styles when using the two in a combo. Now, the big problem is that we can’t override !important with another !important. Divi will win. But no matter whether Divi has been developed in a good or not so good way, there is something we can do. (NOTE: using !important is a horrible thing in CSS. Use at your own risk) Continue reading WooCommerce and Divi: how to override !important CSS
Let’s say you require to make the “address” field at checkout bigger. Instead of an “input type = text”, we’d require an “input type = textarea” in HTML. This was my WooCommerce client’s challenge: how can I edit a checkout field input type programmatically? Here’s the snippet! Continue reading WooCommerce: Change Input Field to Textarea @ Checkout
Here’s how to limit your WooCommerce Cart to just one product at a time.
This simple solution can be used for many applications. For example, your store may only allow to buy one subscription at a time.
On this same website, for example, customers can only purchase one product at a time so it’s easier for me to manage invoicing and payments, given that I switch PayPal and Stripe accounts based on what’s inside the cart.
Here’s the quick fix – enjoy!
Continue reading WooCommerce: Only Allow 1 Product in the Cart
When building custom functions and using hooks and filters, you may want to apply those changes to a unique product id: “If product id = xxx, then execute this function”.
Honestly, I tried to do that with the simplest of all solutions (is_single WordPress conditional tag) but it didn’t work for me. Hopefully, I can help you solve this in 2 seconds!
Continue reading WooCommerce: is_single() Doesn’t Work [Solved]
On a recent job, a client asked me to get the logged in username in WooCommerce. Interesting task! He needed to show that on the checkout form page and also on the order email. Actually, this is quite simple to do and can be used for several applications. Continue reading WooCommerce: Get/Edit Logged in Username @ Checkout
A client needed to add “something” upon product publishing. For example, product meta key “total_sales” with value = 0 gets added automatically once a WooCommerce product is created.
So, how do we run (“hook”) our function when a new product is published?
Continue reading WooCommerce: Do Something When Product is Published
When you apply a coupon code programmatically, for example, you may want to hide the coupon code on the cart and checkout page so that the code stays private and cannot be shared with others.
This solution will basically remove the coupon code (e.g. “VWXYZ”) from the “Coupon: VWXYZ” string that appears in the Cart and Checkout totals. Enjoy!
Continue reading WooCommerce: Hide Coupon Code @ Cart & Checkout Page
A client needed to add her SSL Logo Seal to the checkout page. The problem is that the code she was given had also a JS part, together with a bunch of HTML.
In this article, we will learn about wp_footer, a handy WordPress hook to print anything inside the footer, a bit of conditional logic to target the WooCommerce checkout page only (and therefore excluding the Thank You Page and Order Pay Page), and how to print HTML inside a PHP function. Enjoy!
Continue reading WooCommerce: How to Add Scripts to the Checkout Page
Just say thanks to YOAST SEO plugin, that’s all you need to know. No PHP, no editing template files… just a simple setting in YOAST SEO for WordPress. That’s it 🙂
Continue reading WooCommerce: How to change Shop Page SEO Meta Title (“Products Archive”)
Yes, Jetpack Sharing has an option to show the Sharing buttons on the WooCommerce Single Product page. But this does not mean your template is compatible with that! If you have ticked “products” and JetPack Sharing buttons are not showing, you can use this simple snippet. Continue reading WooCommerce: JetPack Sharing Not Showing? [resolved]
A simple function for a very common issue: “I can’t find where to change the PayPal icon?”. If you have the same problem, here’s a quick PHP fix.
Continue reading WooCommerce: Change the PayPal Icon @ Checkout Page
Users can manually enter a coupon code, refresh the Cart and see their discount apply… or you can do that automatically (or “programmatically” as we say in the dark web) when a user adds a product to the WooCommerce Cart 🙂
All you’ve got to do is creating a coupon, and then a PHP function will do the whole work. Automation is the best thing in the world!
Continue reading WooCommerce: Apply Coupon Programmatically if Product @ Cart
I developed a custom payment gateway plugin for a client, who wanted to add a similar method to “cod” (cash on delivery). FYI, he wanted to add a method called “card on delivery”. I simply duplicated the code, added the PHP to a file, made a plugin and gave him the plugin zip file. And everything was working great… until he did a test checkout. Continue reading WooCommerce: Fixing Fatal error Call to undefined function wc_get_order()
Sometimes solutions are very simple, and you don’t need rocket science to fix your issue!
A client of mine needed to hide a category from the Product Categories Shortcode (“product_categories”); in fact, there is no parameter that allows you to “exclude” a given product category such as “uncategorized” or whatever category you wish.
A rare issue, but once again a quick fix! Here’s how you do it.
Continue reading WooCommerce: Exclude Category from Shortcode
This is an interesting topic. A WordPress/WooCommerce client could not add CSS via the usual way. In fact, Gravity Forms plugin (and in particular the “directory” extension), stores entries in the database BUT the directory page and the entries filtered list have the same classes, ids, and cannot be “targeted” with CSS.
Long story short, and Gravity Form or not Gravity Form, here’s the snippet you can use to add CSS to any WordPress page as long as you know its URL.
Continue reading WordPress: How to Add CSS to a Specific Page URL
A client asked me to customize the Product Categories Widget that comes included with WooCommerce. In this case, they wanted to show ALL categories but the current one (when looking at a category page of course).
You can also use this tutorial to hide certain category IDs from the widget, or maybe “all product category names that start with a given string of text”. Case studies are millions, but the code base is always the same – we’ll make use of the “woocommerce_product_categories_widget_args” filter and provide a list of product categories to exclude. Enjoy!
Continue reading WooCommerce: Hide Categories From Product Cat Widget
When you have special shipping requirements, maybe you want checkout users to see the shipping form section visible on load.
Here’s how you do it. You’ll also find the opposite task in case you happen to have the shipping form opened by default and you want to hide it. Enjoy!
Continue reading WooCommerce: “Ship to a Different Address” Opened by Default