If you’re here it’s because your WooCommerce website is slow and you’re wondering why the “/?wc-ajax=get_refreshed_fragments” URL generates delays and server loads (spikes).
Besides, there is too much online literature about WooCommerce Ajax Cart Fragments (including specific plugins and performance plugin options), and you want to learn quickly what they are before understanding if and how you should disable them.
Performance optimization tools like Pingdom and GTMetrix often put the blame on this little WooCommerce functionality. And disabling it carefully can give you a boost in speed, page load and ultimately sales conversion rate.
So here’s all you need to know. Continue reading WooCommerce: Why & How to Disable Ajax Cart Fragments
We already saw how to add a product to cart automatically, for example if you visit a specific page or if there are no products in the cart – but today we want to find out how to do the opposite: if a certain condition is met, we want to remove a product ID from the cart.
This becomes a little complex – while adding an item to cart requires just its product ID, removing it from the cart forces you to know the “cart item key”. Japanese, I know, but just copy the snippet and you’re done! Continue reading WooCommerce: Remove Product From Cart Programmatically
Here’s a quick snippet you can simply copy/paste to show a “+” and a “-” on each side of the quantity number input on the WooCommerce single product page.
This snippet comes with a jQuery script as well, as we need to detect whether the plus or minus are clicked and consequently update the quantity input. jQuery might look difficult to many, but the beauty of this is that you don’t need to have a degree in jQuery – just copy/paste and see the magic happen.
Note: you will probably also require some additional CSS, as your theme might give a “float” to the quantity DIV while by default HTML buttons take inline-block. I’ve added some CSS valid for the Storefront theme below. Continue reading WooCommerce: Add Plus & Minus Buttons To Add to Cart Quantity Input
Less is more (sometimes). On this website, I’m already forcing max 1 product in the Cart and automatically redirecting users to Checkout upon add to Cart.
As a result, I definitely didn’t need the whole “Mini-Cart Widget Dropdown Content” either. To test, try to “hover” onto the shopping cart icon on the top right, and you’ll notice there is no cart dropdown 🙂
Well, this is how it’s done – I love when a complex thing is fixed with one simple line of PHP! Continue reading WooCommerce: Hide Mini-Cart Widget (Dropdown)
We’ve already seen how to add a product to cart automatically when a user enters your website. However, I needed a different functionality on this same website, and specifically I wanted a product added to cart only when a user like you visits a specific WordPress page ID.
If you wish to test, go to my free video tutorial page called “How to Customize the WooCommerce Single Product Page“. As soon as the page loads a product is magically added to cart, so that the WooCommerce Checkout on that same page is populated with the hidden item. If you go to my Cart page right after visiting that landing page, you can verify there is a product in there.
So, how did I do it? Continue reading WooCommerce: Add Product to Cart When Visiting a Specific Page
One of the most common WooCommerce questions is: can I use WooCommerce to build a catalog of products (without add to cart, price… basically a product gallery)? Using WooCommerce for this case scenario is indeed very helpful – you can make the most of all the inbuilt features such as single product gallery and carousel, image zoom, product description tabs, attributes, categories, tags and related products. Basically a much better version than a standard image gallery.
Another question might be: can I disable the WooCommerce add to cart / cart / checkout functionality until the time I am able to sell my products? This is another common scenario that many WooCommerce store owners require.
Besides, certain products in your WooCommerce website might be for sale and others might not. In this case, you’d want to disable the add to cart functionality from specific categories or products.
Finally, you might want to restrict the cart / checkout functions to logged in, registered users only. This is if you run a wholesale business for example, and wish to hide your prices to the public.
Either way, when the “Add to Cart” button gets hidden, a contact form might be required – this is what I call a “Product Inquiry” form.
Good news is there are snippets and plugins that can make your life easier, your admin time more efficient and your product management simpler. And today we’re taking a look at the best options. Continue reading WooCommerce: How to Enable Catalog Mode?
When talking about UX, or for very specific WooCommerce shops, you might need to “communicate” to the user a product is already in the Cart before re-adding it or increasing its quantity from the Shop/Category/Loop and Single Product pages.
The “Add to Cart” button label comes with a filter (actually 2 filters, one for the Single Product page and another for the other pages such as Shop), so all we need to do is targeting those two, “filter” the label text in case the product is already in the Cart, and return that back to WooCommerce. If this looks like Japanese to you don’t worry – simply copy/paste the snippet below! Continue reading WooCommerce: Rename “Add to Cart” Button if Product Already @ Cart
Yes, there are many plugins that already achieve this. But my goal at Business Bloomer is to save you from plugin conflicts, delicate updates and to make you learn some PHP 🙂
So, here’s how you can add, with a few lines of PHP, a minimum, maximum, increment and starting value to your Add to Cart quantities on the single product and cart pages. Who knew it was this easy? Continue reading WooCommerce: Edit Add to Cart Min, Max & Step Quantity
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
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
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
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
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
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