WooCommerce: Disable Tracking if Order Failed @ Thank You Page

The “woocommerce_thankyouhook fires on the Thank You page once an order is placed. Most tracking functions like Google Analytics, affiliate commission plugins and other WooCommerce extensions rely on “woocommerce_thankyou” to run their code.

Problem is – “woocommerce_thankyou” is ALSO called if an order fails (i.e. payment did not go through). Now, unless the plugin is smart enough in its own functions to exclude failed orders, which doesn’t happen often I’m afraid, we need to find a way NOT to run “woocommerce_thankyou” if an order fails. Case study: a client uses a third party affiliate plugin, this plugin hooks into “woocommerce_thankyou“, but they don’t want to calculate conversions when an order fails.

So here you go! Continue reading WooCommerce: Disable Tracking if Order Failed @ Thank You Page

WooCommerce: Remove Link to Product @ Order Table

There is a slightly annoying thing on the WooCommerce Thank-You Page and WooCommerce emails. Users looking at the order table can actually click on the Products they just purchased and abandon the page before taking the action you want them to take (see image below).

So, I coded a simple PHP snippet to remove such links. As usual, 1 line of code is more than sufficient:) Continue reading WooCommerce: Remove Link to Product @ Order Table

WooCommerce: Redirect to Custom Thank you Page

This is a very common customization request: 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 redirect buyers to a custom URL. This is a great chance for you to add specific upsells, social media shares and other information that could help you convert additional sales.  Continue reading WooCommerce: Redirect to Custom Thank you Page