A client needed to disable all shipping methods but Local Pickup for a certain variation ID. This may come useful if you’re looping through the variations on the cart/checkout page (check if variation ID is in the cart for example), so here you go! Continue reading WooCommerce: Disable Shipping Rate if Variation ID @ Cart
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
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
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
Here’s how to limit your WooCommerce Cart to just one product at a time.
This simple PHP snippet can be used for many applications. For example, your store may only allow to buy one subscription at a time. On this same website, on the other hand, customers can only purchase one product at a time so it’s easier for me to manage invoicing and payments, given that I switch PayPal and Stripe accounts based on what’s inside the cart.
Here’s the quick fix – enjoy!Continue reading WooCommerce: Only Allow 1 Product in the Cart
When you apply a coupon code programmatically, for example, you may want to hide the coupon code on the cart and checkout page so that the code stays private and cannot be shared with others.
This solution will basically remove the coupon code (e.g. “VWXYZ”) from the “Coupon: VWXYZ” string that appears in the Cart and Checkout totals. Enjoy!Continue reading WooCommerce: Hide Coupon Code @ Cart & Checkout Page
Users can manually enter a coupon code, refresh the Cart and see their discount apply… or you can do that automatically (or “programmatically” as we say in the dark web) when a user adds a product to the WooCommerce Cart 🙂
All you’ve got to do is creating a coupon, and then a PHP function will do the whole work. Automation is the best thing in the world!Continue reading WooCommerce: Apply Coupon Programmatically if Product @ Cart
A client asked me to completely remove the message that appears after you add a product to the cart from the product page. This is simply done by using a PHP snippet, so here’s the quick fix for you!Continue reading WooCommerce: Remove / Edit “Added to Your Cart” Message
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”)
The cart totals table cell title “Shipping” or “Shipping and Handling” appears also on the checkout page. So, what if you wish to “translate” this string from English to “better” English or completely customize it? Thankfully there’s a quick 4 lines snippet for you. Enjoy!Continue reading WooCommerce: Translate “Shipping” @ Cart Totals
For some reason, sometimes you add products to cart but the cart page stays empty (even if you can clearly see the cart widget has products in it for example).
But don’t worry – it may just be a simple cache issue (and if you don’t know what cache is that’s no problem either) or a theme / plugin “conflict”.
The WooCommerce Cart page is extremely delicate; it displays dynamic content based on cookies and PHP sessions, is coded with PHP but also JS and Ajax, requires to be excluded from cache and is subject to problems in case of out of date software.
So, here’s your “Empty Cart” troubleshooting checklist you can follow without any technical knowledge.
I also recommend you read through the (many) comments, because many developers shared what worked for them too. Good luck!Continue reading WooCommerce: How to Fix the “Cart is Empty” Issue
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
A very annoying thing this is. If one of your WooCommerce shipping methods is Free, a label (Free) will appear next to it. It cannot be deleted via CSS as some WooCommerce function adds it via code to the shipping method label. So how do we deactivate it? Continue reading WooCommerce: Remove (free) in Shipping Method Label @ Cart
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