WooCommerce Visual Hook Guide: Cart Page

I’ve put together a visual (yet, you can copy/paste!) hook guide for the WooCommerce Cart Page. If you like this and it is helpful to you, let me know in the comments and I’ll create another one for the checkout, single product page and my account page.

You can find WooCommerce Cart hooks quickly and easily by seeing their actual locations. Great thing is – 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 anywhere on the WooCommerce Cart Page. Enjoy!

Continue reading WooCommerce Visual Hook Guide: Cart Page

WooCommerce: Show Message Upon Country Selection @ Checkout

If you have country-specific shipping conditions, or you want to show a message conditionally after country selection on the checkout page, here’s a simple WooCommerce PHP snippet you can freely use. This can be slightly customized to target state selection instead.

I’ve also edited the initial code to make this work on load as well, so that the message would conditionally show even then. Enjoy!

Continue reading WooCommerce: Show Message Upon Country Selection @ Checkout

WooCommerce: Show Category For Each Product @ Shop Page

A client of mine has a category called “Brand”. Each product is assigned to a specific Brand subcategory e.g. Nike, Adidas, etc. The goal of this task was to show the “Brand” subcategories in the shop/category/loop pages as a way to help the user identify the brand name.

The same can be applied to showing ALL categories, so the user knows exactly to what section of the shop the product belong to. Great, let’s see how it’s done!

Continue reading WooCommerce: Show Category For Each Product @ Shop Page

WooCommerce: Add Checkout Fee for a Payment Gateway (e.g. PayPal)

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)

WooCommerce: Sort Shipping Costs from Low to High

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