This is a simple snippet that will allow you to move the Related Products from below the tabs to inside the single product tabs, in a brand new tab. Continue reading WooCommerce: Related Products in a Tab on the Product Page
Another simple snippet that can easily help user experience and make sure the sold out badge shows on every product in the category & shop page. Not all themes allow this so you can use the snippet below to make it happen! Continue reading WooCommerce: Show “Sold Out” on Archive/Product Page
Very similar to the “Limit shipping to one State only“, this time we want to limit the Billing to only one state. An Australian client asked me to limit their sales to the South Australia state, but the same can be applied to US, UK and all the other countries that have states. Continue reading WooCommerce: Sell to one State only
A client had several shipping rates on the cart page automatically generated by FedEx, USPS, UPS and similar plugins via their API. Problem was, they wanted to sort them by price as opposed to grouping them by provider.
Thankfully, with a simple “uasort” PHP function, it’s possible to take the shipping rates array and sort it by amount before returning it back to the screen. If you don’t know PHP, simply copy/paste!Continue reading WooCommerce: Sort Shipping Costs from Low to High
Once a customer places an order, you might want to know if such order contains a given product ID. you can use this for tracking purposes, redirect to a custom thank you page or run your custom functions.
Either way, checking this is quite simple thanks to the “woocommerce_thankyou” hook which runs on the order received page. Enjoy!Continue reading WooCommerce: Check if Product ID is in the Order
A client wanted to show only featured products on the shop page. While adding featured products is very easy (just use the WooCommerce shortcode in the page content), it seems very difficult to remove the “other” products. Here’s what I did.Continue reading WooCommerce: Hide Products @ Shop Page
Whether you want to disable login / registration on the WooCommerce Checkout page or move the login form from the top to the bottom of it, this is a simple thing to do. You can do it via a PHP snippet or WooCommerce settings. Continue reading WooCommerce: Remove or Move User Login / Registration at Checkout
This simple snippet will make sure you can send users back to a custom page as opposed to the shop page when the Cart is empty. In this particular project, client had no shop page so we wanted to send users back to the homepage instead.
As usual, it’s a couple of lines of PHP, without the need to override templates or even worse to edit core WooCommerce. Enjoy!Continue reading WooCommerce: Change “Return to Shop” URL
This is a simple PGP snippet that I successfully used on a bunch of websites in order to set the default Billing country or state. This is a great way to save the user some time during checkout (and therefore increase your conversion rate) in case you almost exclusively sell to customers located in a given country or state. Nothing else to say, just… enjoy! Continue reading WooCommerce: Set Default Billing State / Country @ Checkout
Apparently, there is no easy way to edit the “You may also like…” WooCommerce string as they don’t provide us with a “PHP filter”.
Thankfully, we can take advantage of a WordPress function called “gettext” – so here’s a quick workaround for you!Continue reading WooCommerce: Translate “You may also like…” Text
Mostly when working with external products in WooCommerce, you may want to not only rename “Add to Cart” into something else… but also opening the link into a new tab. Here’s how I did it!Continue reading WooCommerce: Add to Cart URL to Open in a New Browser Tab
A client wanted to add the social sharing icons provided with Avada theme on the shop loop and product shortcodes as well. The social sharing icons are visible on the single product page only, so here’s how you do it! Continue reading WooCommerce & Avada: Social Sharing @ Product Category [resolved]
I’ve seen many snippets that change the “In Stock” text on the single product page, but not the FULL string. In this particular case, not only I needed to change the text, but also edit the order of display: from “2 In stock” to “Quantity: 2”.Continue reading WooCommerce: Edit “# in stock” @ Single Product Page
This snippet requires no introduction 🙂 Continue reading WooCommerce: Remove Additional Info Tab from all Products
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 do this. Sometimes you just want to make it easier for your customers. The less information you show the better 🙂
Some other times, you may have specific 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. Here’s how it’s done! Continue reading WooCommerce: How to Hide a Cart Table Column
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 1 product.
This simple PHP snippet can be used for many applications – for example, your store only allows to buy one product at a time, or max one subscription. Here’s the quick fix – just copy/paste in your functions.php!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]