WooCommerce: Fixing Fatal error Call to undefined function wc_get_order()

I developed a custom payment gateway plugin for a client, who wanted to add a similar method to “cod” (cash on delivery). FYI, he wanted to add a method called “card on delivery”. I simply duplicated the code, added the PHP to a file, made a plugin and gave him the plugin zip file. And everything was working great… until he did a test checkout. Continue reading WooCommerce: Fixing Fatal error Call to undefined function wc_get_order()

WordPress: How to Add CSS to a Specific Page URL

This is an interesting topic. A WordPress/WooCommerce client could not add CSS via the usual way. In fact, Gravity Forms plugin (and in particular the “directory” extension), stores entries in the database BUT the directory page and the entries filtered list have the same classes, ids, and cannot be “targeted” with CSS.

Long story short, and Gravity Form or not Gravity Form, here’s the snippet you can use to add CSS to any WordPress page as long as you know its URL.

Continue reading WordPress: How to Add CSS to a Specific Page URL

WooCommerce: Redirect to Custom Thank you Page

How can you redirect customers to a beautifully looking, custom, product-specific thank you page?

Thankfully you can simply add some PHP code to your functions.php and define a redirect to a custom URL (as opposed to the default order-received endpoint). This is a great chance for you to add specific up-sells, social media share and other information that could help you convert additional sales. 

Continue reading WooCommerce: Redirect to Custom Thank you Page

WooCommerce: edit or translate “Shipping and Handling” on the Cart & Checkout page

A client, clearly from a European English-speaking country (not many, uh?), wanted to change the cart page when it says “Shipping” or “Shipping and Handling” in the totals table. The same string appears on the checkout page. As it’s only 1 string, my favourite method is by implementing a very simple PHP function, that needs to be placed in your functions.php file. Continue reading WooCommerce: edit or translate “Shipping and Handling” on the Cart & Checkout page

WooCommerce: Add Prefix / Suffix to Product Prices

Sometimes you may want to add a prefix or a suffix to your prices. It could be something like “From…”, “Only…”, “…tax free” and so on. The first good news is this is very easy to do with a WooCommerce filter (remember, filters change the value of an existing variable, while actions add content). The second good news is that you don’t need to know PHP, just copy/paste my snippet! Continue reading WooCommerce: Add Prefix / Suffix to Product Prices

WooCommerce: Solving the “Cart is Empty” issue

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

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 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: Hide Prices on the Shop & Category Pages

Interesting WooCommerce customization here. A client of mine asked me to hide/remove prices from the shop page and category pages as she wanted to drive more customers to the single product pages (i.e. increasing the click-through rate).

As usual, a simple PHP snippet does the trick. I never recommend to use CSS to “hide” prices, as they would still be visible in the code – PHP stops the prices from loading, so they’re invisible to the user. Continue reading WooCommerce: Hide Prices on the Shop & Category Pages