WooCommerce: Disable Payment Gateway For Specific Shipping Method

Today we take a look at the WooCommerce Checkout Page and specifically at how to disable a payment gateway (for example PayPal) when a specific shipping method is selected (e.g. “local_pickup”).

Specifically, you will learn how to “get” the selected shipping method on the go (thanks to “sessions”), and also how to “unset” a payment gateway. Enjoy!

Continue reading WooCommerce: Disable Payment Gateway For Specific Shipping Method

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

WooCommerce: Remove Shipping Labels @ Cart (e.g. “Flat Rate”)

WooCommerce functions add the shipping method label on the Cart totals, on the left hand side of the price. This ruins the price amounts alignment (subtotal, shipping, taxes, total) and many clients have asked me to remove it completely. Also, it could be that sometimes you don’t want to show the name of a shipping rate on the front-end. So, here’s how you do it!

Continue reading WooCommerce: Remove Shipping Labels @ Cart (e.g. “Flat Rate”)

WooCommerce: “You Only Need $$$ to Get Free Shipping!” @ Cart

This is a very cool snippet that many of you should use to increase your average order value. Ecommerce customers who are near the “free shipping” threshold will try to add more products to the cart in order to qualify for free shipping. It’s pure psychology.

Here’s how we show a simple message on the WooCommerce Cart page. Enjoy!

Continue reading WooCommerce: “You Only Need $$$ to Get Free Shipping!” @ Cart

WooCommerce: Add Shipping Notices on Checkout Page

A WooCommerce client wanted to show some text in the checkout page, and specifically “Please allow 5-10 business days for delivery after order processing.” so that customers are aware of how shipping works. This is a vital information you should disclose on every page of your ecommerce website, and of course on the checkout page too. Continue reading WooCommerce: Add Shipping Notices on Checkout Page

WooCommerce: Hide Shipping Rates if Free Shipping Available

If Free Shipping is available, you possibly don’t want to show the other premium shipping options. WooCommerce shows by default all shipping rates that match a given shipping zone, so it’s not possible to achieve this from the settings alone.

Thankfully, the “woocommerce_package_rates” filter allows us to manipulate the shipping rates before they are returned to the frontend. In this example, we will disable all shipping methods but “Free Shipping” so that free shipping remains the only possible choice.

Here’s the code to add to your functions.php. Enjoy!

Continue reading WooCommerce: Hide Shipping Rates if Free Shipping Available

WooCommerce: Get Order Tax Percentage

You’d think WooCommerce had an easy way to get the order tax rate percentage, the same way as you can get almost everything inside the “order object” with a single line of PHP. Well, that’s not the case unfortunately.

The reason is that probably each order can have multiple tax rates, and that tax is not only applied to product prices, but also optionally to shipping, fees and more.

So, how do we get the list of tax rates in a WooCommerce order? Here’s a quick snippet that you can use – enjoy!

Continue reading WooCommerce: Get Order Tax Percentage

WooCommerce Development: 8 Trends & Advancements

In the sphere of WooCommerce development, innovation continues at a breakneck pace, so it’s important for businesses to stay updated on current trends and advancements.

From enhancing in-app customer support solutions to embracing AI (Artificial Intelligence), sustainability practices, and voice search optimization, the future is packed with possibilities. 

To improve your understanding of what lies ahead, read on as we provide you with insightful knowledge about significant trends shaping this field.

Our goal is to make you learn at least one new thing about the future of WooCommerce and the ecommerce ecosystem – feel free to share what that is in the comments!

Continue reading WooCommerce Development: 8 Trends & Advancements

WooCommerce: How to Generate a Proof of Income When Self-Employed

If you’re self-employed, proving your income can seem like an impossible task. Traditional employees have their pay stubs and W2 forms to easily verify their earnings, but what about those treading the path of independent work or owning a business?

By understanding how to generate proof of income effectively, you maintain optimal financial transparency and increase your chances of securing partnerships, loans, or leases with ease. 

And when your own business runs on WooCommerce, tools like the WooCommerce Analytics dashboard can be very beneficial in regard to income tax calculations. 

In this guide, we explore various means at your disposal for generating reliable proof of self-employment income bolstered by insights provided by WooCommerce Analytics.

Continue reading WooCommerce: How to Generate a Proof of Income When Self-Employed

WooCommerce: Anonymize All Users & Orders

Especially when you need to let other people (such as developers) log in to your WooCommerce website, you may want to protect the identity of your customers and your order details.

Of course, anonymizing your WooCommerce backend requires a complete database override – this change is 100% irreversible! Only run this code if you know what you’re doing.

The ideal workflow is the following: you give developers access to a staging/clone website version, you run this custom code to anonymize customers and orders, and have them do the changes. This is good for GDPR, CRPA and PIPEDA as well: third party people won’t see sensitive data.

One more note: I haven’t tested the code with thousands of customers and orders – feel free to leave a comment in case your (staging) website crashes. Enjoy!

Continue reading WooCommerce: Anonymize All Users & Orders

WooCommerce: How To Make Your Site Legally Compliant

Ensuring legal compliance is essential for WooCommerce businesses since it safeguards both the company and its customers.

Compliance with appropriate laws and regulations helps to avert penalties, legal disputes, and poor customer experiences – while establishing a strong reputation in the market. 

Moreover, legal compliance demonstrates professionalism and trustworthiness to your customers, fostering a trustworthy shopping environment. 

Therefore, investing the time and effort into making your WooCommerce site legally compliant is not only essential but also highly beneficial for your long-term success.

Continue reading WooCommerce: How To Make Your Site Legally Compliant

WooCommerce: Allow Order Editing For Custom Order Status

WooCommerce admins are allowed to “edit” an order only when this is in the “on hold” or “pending payment” status. By “edit” I mean having the chance of modifying or adding products, fees, shipping and recalculating the totals, which are not allowed once the order has been placed (“processing“, “completed“, etc.).

However, there are many reasons why you’d want to have the right to edit a processing, completed, or custom status order – of course as long as you don’t end up changing the total, as customers already paid at that stage.

Think about the following scenarios:

  • you customized the items table and added a custom field, and you want to set the custom field value when the order is “processing
  • you need to edit the shipping method name AFTER checkout, and you want to be able to rename it when the order is “completed
  • you need to add a fee and a discount of equal amounts (so that the total stays the same) before completing the order

Either way, let’s enable the little “pencil icon” on a custom order status, so that the admin can customize the order whenever they wish!

Continue reading WooCommerce: Allow Order Editing For Custom Order Status

WooCommerce: How to Level Up Your Email Marketing

In today’s competitive ecommerce landscape, email marketing plays a crucial role in connecting with customers and driving business growth.

With WooCommerce, you already have a powerful platform at your disposal to send and manage transactional emails effectively. However, when you need to send targeted marketing emails, additional plugins may be necessary. 

In this article, we’ll guide you through the process of optimizing your email marketing strategy using WooCommerce.

Whether you’re a seasoned email marketer or just getting started, we’ll explore actionable tips and practical techniques to help you level up your communication game.

So, let’s jump right in!

Continue reading WooCommerce: How to Level Up Your Email Marketing

WooCommerce: Disable Checkout Field Autocomplete

By default, WooCommerce adds the “autocomplete” attribute to almost all checkout fields. For example, “billing_phone” has “autocomplete=tel”, “billing_country” has “autocomplete=country” and so on.

When logged out or if the logged in user has never done a purchase before, the WooCommerce Checkout page fields are possibly autofilled by the browser based on saved data / addresses.

Today, we’ll take a look at how to disable this autofill behavior, so that the customer is forced to enter data inside an empty input, and maybe in this way you can apply your custom validation or pattern, such as a specific phone number format. Enjoy!

Continue reading WooCommerce: Disable Checkout Field Autocomplete