Modifying the WooCommerce Product Query

Modifying the WooCommerce Product Query

WooCommerce builds a custom query for products in its WC_Query class by hooking into the classic pre_get_posts hook and changing WordPress’s query parameters to get the desired products. WooCommerce then removes itself from the query afterward. I am not 100% sure of why, but I presume there is a good reason. It might be running in WooCommerce, but it…

Read More Read More

Get the first & last elements of an associative array

Get the first & last elements of an associative array

This is a small tutorial on how to get the first elements of an associative array in PHP. As you probably already know, associative arrays are extremely popular in PHP, simply because they allow you to set keys/indexes that are human-friendly! Unfortunately, one of the drawbacks to using an associative array is that it can…

Read More Read More

Regex (regular expressions) cheat sheet

Regex (regular expressions) cheat sheet

The tables are not exhaustive, for two reasons. First, every regex flavor is different and we didn’t want to crowd the page with overly exotic syntax. For a full reference to the particular regex flavors you’ll be using, it’s always best to go straight to the source. In fact, for some regex engines (such as…

Read More Read More

Content Egg Range Offer prices in WC Product

Content Egg Range Offer prices in WC Product

If you have the Content Egg plugin installed you can know that this plugin has a shortcode which allows list the Offers in the WooCommerce Product. Usually, the plugin displays the price of the cheapest product from the Offer list but with help of this snippet you can get price from the cheapest to the…

Read More Read More

WooCommerce: How to get Product data from $product Object

WooCommerce: How to get Product data from $product Object

These simple PHP snippets will help you in your work with WooCommerce Products. 1. You have access to $product Hooks (do_action and apply_filters) use additional arguments which are passed on to the function. If they allow you to use the “$product” object you are in business. Alternatively, you can declare the “global $product” inside your…

Read More Read More

How to increase the Menu items limit in WordPress

How to increase the Menu items limit in WordPress

Have you reached the max items menu/custom meta rows limit on WordPress? When you add more than a certain amount of menu items/custom meta rows do they just delete on saving? This tutorial will show you to increase this limit and explain what’s causing it.