Year: 2022

WooCommerce Function of the Week: get_ip_address

The get_ip_address function is useful for tracking visitors who aren’t logged in as they move through key pages in your store.

Whether it’s for troubleshooting payments, creating user history logs or enabling custom geolocation, there is a WooCommerce function that lets you forget about all the $_SERVER global keys and gets you an immediate result: the current user’s IP address.

You can store an IP address in a custom field or use it to trigger another custom function. Bear in mind, IP addresses are personal identification data and therefore regulated by the GDPR: “That means that some form of justification like user consent would always be needed as soon as the IP address is processed.”

So, let’s take a look at the function code, its usage, and a case study.

Read more

WooCommerce Function of the Week: get_variation_prices

B/w photo of clothing rack

Read the code with Rodolfo Melogli! This week in WooCommerce functions we’re looking at get_variation_prices.

If you’re a WooCommerce developer, variable products are always difficult to deal with. Manipulating them with code snippets or custom plugins is even tougher.

Today’s core function (get_variation_prices) will definitely help you save time while working with prices, custom notices, conditional logic and such.

As usual, we’ll study the function code, take a look at its usage, and finally analyze a case study that will come in useful sooner or later. Enjoy!

Read more

A2 Hosting
Omnisend
WordPress.com