A WooCommerce fan asked me: “How do you deny checkout if the cart weight is above a certain threshold?“.
Well, this is straight forward thanks to a WooCommerce core function called “cart_contents_weight” which allows you to get the total weight of your cart, and then the “wc_add_notice” function which shows a notification error.
Continue reading WooCommerce: Deny Checkout Based on Cart Weight
When it comes to “editing” stuff, chances are WooCommerce gives us a “filter” we can use without overriding core. The more filters, the more customization we can do. In this case, I wanted to change the “Returning Customer?” message on my own checkout. Continue reading WooCommerce: Edit “Returning Customer?” Message @ Checkout
I’m curious to know how many had the same problem. At WooCommerce checkout, some user fields such as billing_name, shipping_address_1, etc. are automatically saved into the “WordPress User Profile” upon processing.
But what if we also wanted to display and save another existing user field, such as “user_twitter”, or “user_url”, which you can find in the WP User Profile by default? Well, this is very easy: first, we add a custom checkout field; then, we make sure that when the checkout is processed we save that field correctly! Continue reading WooCommerce: Display & Save WP User Field (e.g. user_url) @ Checkout
Here’s how you force redirection to the checkout page every time a product is added to cart, no matter if you do so from the loop/shop pages or the single product page.
On top of adding the code to your functions.php you also need to double check your WooCommerce settings, see screenshot below. Enjoy!
Continue reading WooCommerce: Redirect to Checkout on Add to Cart
WooCommerce Shipping Zones are quite easy to override / customize. With a simple PHP (and jQuery, sometimes) snippet we can accomplish many advanced shipping rules, such as the one we’ll study today.
This time, I’ve tested a snippet to add a dropdown to the billing section where users go choose the pickup destination. As a result, the shipping address is automatically populated, and so is the shipping method. What do you think?
Continue reading WooCommerce: Ship to Predefined “Local Pickup” Addresses
I invoice clients via WooCommerce, and then send them the “Invoice Email”, which takes them to the “Order Pay” page. Of course, I want to give them the option to pay via “Bank Transfer” (bacs), but I don’t want this to be visible on the default checkout page.
We’ve seen in the past how to disable payment gateways given certain conditions… but how do we “enable” one? Here’s a snippet for that – enjoy!
Continue reading WooCommerce: Enable Payment Gateway Only for “Order Pay Checkout”
I wanted to do something different on my own checkout page, and change the default “Have a Coupon?” message. Thankfully, WooCommerce gives us a filter we can use to accomplish anything we like – such as adding a FontAwesome icon or changing the text string completely!
Continue reading WooCommerce: Edit “Have a Coupon?” Message @ Checkout
We’ve already seen how to set the default values for certain dropdowns (billing country and state, precisely). But what can we do when we want to define the defaults for the other “text” inputs, such as the billing_city?
Continue reading WooCommerce: Set Default Billing City (or other fields) @ Checkout
One of my premium course students had an apparently simple requirement. Her client didn’t want to show the “What is PayPal?” text (and link) on the checkout page. In fact, why sending users away from the checkout? And who doesn’t know what PayPal is nowadays? Well, let’s see how this is done via a simple “filter” – but this time I’d like to show you a step-by-step tutorial! Let me know what you think about this in the comments 🙂 Continue reading WooCommerce: How to Remove “What is PayPal?” @ Checkout
A North European client told me they’re really strict about billing and shipping addresses over there. Couriers usually require a separate “House Number” in order to dispatch packages within those countries.
This must be therefore placed on the checkout, BESIDE the “Address_1” field and made required. Also, it’s a good idea to make this show in the Admin Order, thank you page and notification Emails.
Continue reading WooCommerce: Add House Number Field @ Checkout
Let’s imagine you want to add a custom checkout field (and not an additional billing or shipping field) on the WooCommerce Checkout page. For example, it might be a customer licence number – this has got nothing to do with billing and nothing to do with shipping.
Ideally, this custom field could show above the Checkout page order notes – right after the shipping form. It will feature a label, an input field, and will be required.
So, here’s how you do it – hope it helps you understand that anything is possible with WooCommerce!
Continue reading WooCommerce: How to Add a Custom Checkout Field
If you love Ecommerce as much as I do, and are passionate about Sales Conversion Rate and reducing Shopping Cart Abandonment, today’s snippet will come in handy.
Besides, this is officially the first guest blog on Business Bloomer (have ideas? Send me your proposal here)… so let me officially introduce you to today’s author: Jamie Gill, a WordPress & WooCommerce enthusiast from Bradford, UK.
Jamie managed to code a handy snippet to display inside Cart and Checkout totals the total amount of money a customer saved (sale prices plus coupon discounts). Over the years this snippet went through several revisions, but it’s still working smoothly – enjoy!
Continue reading WooCommerce: Display Total Discount / Savings @ Cart & Checkout
Our goal is to check if a Product with a specific Shipping Class is in the Cart, and consequently disabling a shipping rate such as Free Shipping if this is true.
This is super useful when there are multiple items in the cart and you don’t want to give free shipping for certain orders for example.
Continue reading WooCommerce: Hide Shipping By Shipping Class
Today we take a look at the WooCommerce Checkout page and our goal is to disallow placing an order to customers that enter a PO BOX address. I don’t remember where I got this snippet from, but either way I’m glad to share it again!
Continue reading WooCommerce: Disallow Shipping to PO BOX Address
Today we take a look at the WooCommerce Minimum Order Amount. This snippet displays an error notification on the Cart Page and an error message @ Checkout Process if the order is below a set threshold.
Continue reading WooCommerce: Define a Minimum Order Amount
Today we take a look at the WooCommerce Checkout and specifically at how to disable a payment gateway (e.g. PayPal) if a specific product category is in the Cart.
There are two tasks to code in this case: (1) based on all the products in the Cart, calculate the list of product categories in the Cart and (2) disable a specific payment ID if the target product category is in the Cart.
May sound difficult but don’t worry – solution is right below. Enjoy!
Continue reading WooCommerce: Disable Payment Method If Product Category @ Cart
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
So, how do we display an additional tick box on the Checkout page (together with the existing T&C checkbox)?
Here’s a visual HTML hook guide for the WooCommerce Checkout Page.
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 easily copy & paste. Enjoy!
Continue reading WooCommerce Visual Hook Guide: Checkout Page
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