WooCommerce: Change “Buy Product” Label for External Products

By default, WooCommerce displays a “Buy Product” button label for external products. This button redirects to the external URL that is entered via the single product settings.

As usual, this “Buy Product” label may not suit all businesses, and therefore WooCommerce gives you the option to rename such buttons via the single product edit page settings. This is great, but at the same time you don’t want to manually edit hundreds of products when you can use a few lines of PHP, right?

So, here’s a super quick fix to override the “Buy Product” external add to cart button label to whatever you wish, without ever touching the manual settings. Enjoy!

Continue reading WooCommerce: Change “Buy Product” Label for External Products

WooCommerce: Display Stock Status For External Products

By default, WooCommerce external products do not have and do not display any stock, as they are simple redirects to an external URL. This may be unfortunate, because before clicking on an external URL and send people away from your website, you may want to make sure the current item is in stock (so that you have more chances to convert the sale and earn a referral commission, if that’s your business model).

So, how do we “manage stock” for an external product, and display the stock status on the single product page, just before the “Buy Product” button?

Continue reading WooCommerce: Display Stock Status For External Products

WooCommerce: Count External Product Clicks

Yeah Google Analytics is cool, but have you ever coded your own tracking functions within your WooCommerce website?

An example may be counting the number of times customers click on the “Buy product” button that displays on the Single External Product Page, and show the counter in the Products Table in the backend.

For example, I use this to calculate the Click Through Rate (% clicks / views) and see how popular an external product is. Of course, you could also decide to extend the counter to all products (simple, variable, etc.) and count the number of times customers click on the Add to Cart, but for today let’s stick to the external products count. Enjoy!

Continue reading WooCommerce: Count External Product Clicks

WooCommerce: Open External Product Link In New Tab

Today I start a personal WooCommerce customization marathon as I try to relaunch my personal project A Piece of Sicily (a Sicilian products marketplace, WPML friendly, with products uploaded by vendors and external (affiliate) products).

Each week I will share a snippet I’ve personally coded, so that you can follow me along the going-live path and actually see the results on the live site.

This time, we’ll talk about External Products, and specifically at how to Open the external add to cart URL in a new tab, so that users stay on your WooCommerce website even after visiting the affiliate link. Enjoy!

Continue reading WooCommerce: Open External Product Link In New Tab