Here’s how to create custom WooCommerce Add to Cart links / buttons and make them add products to cart, redirect to specific pages. This tutorial includes also variable and grouped products, as well as quantities >1.
With this guide it’s much easier to place Add to Cart buttons on custom landing pages, pricing tables, blog posts and so on. Enjoy! Continue reading WooCommerce Custom “Add to Cart” URLs – The Ultimate Guide
Our goal is to check if a Product with a specific Shipping Class is in the Cart, and consequently disabling 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. Continue reading WooCommerce: Disable Shipping Rate if Cart has Shipping Class
Hello WooCommerce Customizers!
Today is episode #12 of my “18 snippets in 18 days” challenge. With 6 days to go, I hope you’ve enjoyed the snippets so far and that your WooCommerce code snippet library has been growing steadily 🙂
I ask you to kindly share on social media and leave blog comments to support my marathon, a lot of work is going into this and feel free to share some love 🙂
Today we take a look at the WooCommerce “Add to Cart” buttons. What if you wanted to change the “Add to Cart” text depending on the Product Category? For example, you may want to show “Buy Now” for books and “Add to Basket” for cds. Continue reading WooCommerce: Edit “Add to Cart” Text by Product Category
A client wanted to completely remove the area on the Cart page where “cross-sells” show. This is helpful if you have dozens of products with cross-sells and you don’t want to go and edit each single page 🙂 Continue reading WooCommerce: Remove Cross-Sells @ Cart Page
Quite an interesting functionality! a WooCommerce client required to have the cart pre-filled with one product as soon as the customer accessed the website. I don’t remember the exact reason, but this could be useful when you want to give them a free product by default, or you want to send your visitors straight to checkout with a product already in the cart. Let’s see how this snippet works! Continue reading WooCommerce: Add Product to Cart Programmatically
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
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
Mostly when working with external products in WooCommerce, you may want to not only rename “Add to Cart” into something else… but also opening the link into a new tab. Here’s how I did it! Continue reading WooCommerce: Add to Cart URL to Open in a New Browser Tab
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 1 product.
This simple PHP snippet can be used for many applications – for example, your store only allows to buy one product at a time, or max one subscription. Here’s the quick fix – just copy/paste in your functions.php! Continue reading WooCommerce: Only Allow 1 Product in the Cart
When you apply a coupon code programmatically, or when you really need it anyway, you may want to hide the coupon code on the cart page.
This is simply because you want to avoid that certain customers will know the coupon code and try to give it to someone else. 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. 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). But don’t worry – it might just be a simple cache issue (and if you don’t know what cache is that’s no problem either).
Here’s your “Empty Cart” troubleshooting check-list you can follow without any technical knowledge. Continue reading WooCommerce: Solving 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
A client of mine decided to add a little notice (“30-day return policy offered”) just above the Add to Cart button on the WooCommerce single product page. There is no need to say this will allow her to increase the click-through rate and her sales conversion rate. Continue reading WooCommerce: Display Content Above Add to Cart @ Single Product Page
You may want to force users to login in order to see prices and add products to cart.
All you need is pasting the following code in your functions.php (please note: your theme may have overwritten some default WooCommerce functions, hence the code below may not work. Contact me if you need custom code). Enjoy! Continue reading WooCommerce: Hide Price & Add to Cart for Logged Out Users