I’ve created a visual HTML hook guide for the WooCommerce Archive Page (which is the same page for the Shop, Category, Tag pages). This visual guide belongs to my “Visual Hook Guide Series“, that I’ve put together so that you can find WooCommerce hooks quickly and easily by seeing their actual locations (and you can also copy/paste). If you like this guide and it is helpful to you, let me know in the comments!
Thanks to this WooCommerce Archive Visual Hooks Guide, you can now go to your template’s functions.php file and use “add_action(‘place-hook-here’,’your-PHP-function-here’);” – you can then place your custom functions exactly where you like them to be. Enjoy!
Continue reading WooCommerce Visual Hook Guide: Archive / Shop / Cat Pages
Here’s a visual HTML hook guide for the WooCommerce Single Product Page. This is part of my “Visual Hook Guide Series“, through which you can find WooCommerce hooks quickly and easily by seeing their actual locations (and you can copy/paste). If you like this guide and it’s helpful to you, let me know in the comments!
Now that you know the Single Product Page hooks, all you need to do in your functions.php is “add_action(‘place-hook-here’,’your-PHP-function-here’);” and you can place your custom functions exactly where you like them to show! Need a video tutorial? Watch it now → Continue reading WooCommerce Visual Hook Guide: Single Product Page
Here’s a simple PHP snippet to add a fee to the checkout for every payment or for a specific payment gateway. Please do remember that for certain payment gateways such as PayPal, adding checkout fees is currently against their Terms of Service so make sure to check this first. As usual, this needs to be copied and pasted in your child theme’s functions.php file. Enjoy! Continue reading WooCommerce: Add Checkout Fee for a Payment Gateway (e.g. PayPal)
This is a workaround to Limit Shipping and Billing to One State Only. In two of my previous posts (Limit Shipping to One State Only and Limit Billing to One State Only) we’ve seen similar functionalities. In this case, let’s imagine we want to avoid that the user selects unwanted states. Continue reading WooCommerce: Limit State Dropdowns to One State Only
A client had several shipping rated on the cart page, automatically generated from FedEx, USPS, UPS and similar plugins via their API. Problem was, he wanted to sort them by price as opposed to grouping them by provider. Continue reading WooCommerce: Sort Shipping Costs from Low to High
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
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
On a website using USD and WooCommerce Subscriptions, a weird error showed up. After doing a bit of research, I found out that orders above $999.99 were showing as $1 on the Cart and Checkout page. Pretty weird! Here’s how I fixed it. Continue reading WooCommerce: Fix for Wrong Order Total
Interesting WooCommerce customization here. A client of mine asked me to hide/remove prices from the shop page and category pages as she wanted to drive more customers to the single product pages (i.e. increasing the click-through rate).
As usual, a simple PHP snippet does the trick. I never recommend to use CSS to “hide” prices, as they would still be visible in the code – PHP stops the prices from loading, so they’re invisible to the user. Continue reading WooCommerce: Hide Prices on the Shop & Category Pages
This is a cool function you can apply to any payment gateways for any order threshold. for example, you may want to disable bank transfers if orders are below $10, or disable PayPal payments if orders are above a certain cart total. Here’s what I did. Continue reading WooCommerce: How to Disable PayPal on Orders Above $100
WooCommerce database stores the number of products sold.
Therefore, you may want to show such number on the product page, close to the Add To Cart button. As we’ve seen in my book Ecommerce and Beyond, showing the number of sales for each product can increase your sales conversion rate.
All you need is pasting the following code in your functions.php to show it in the product summary. Continue reading WooCommerce: Show Number Of Products Sold on Product Page
If Free Shipping is available, you possibly don’t want to show the other paid shipping options. WooCommerce shows by default all shipping rates that match a given shipping zone, so it is not possible to achieve this from the settings alone.
You need PHP for that. In this example, we will disable all shipping methods but “Free Shipping” so that free shipping remains the only possible shipping method. And here’s the code to add to your functions.php 🙂 Continue reading WooCommerce: Hide Shipping Rates if Free Shipping Available