Add content behind admin order line item meta

There are moments when you need to add content behind the order line items in your woocommerce admin. In my case for example I needed this to show a reference id stored under a product. You can get the product id from the $item->get_data(); array.

Add Product Rich Snippets to WordPress Programmatically

To make structured product data such as prices or reviews as clear as possible for Google, it is wise to implement Google rich snippets on every product page on your website. Google offers 3 ways to add structured data to your website. JSON-LD, RDFa and Microdata. I prefer JSON-LD because this is the first option […]

WooCommerce price based on user role

One of my clients needed different product prices for their users based on their role. His website included a user role for resellers who have to see lower prices than default customers. To modify the price based on the user role I needed 2 things to know: How to check the current user’s role? What […]

WooCommerce PDF invoice plugin disable attachment by user role

A customer of mine wanted to use the WooCommerce PDF Invoices & Packing Slips plugin, but wanted to make a small adjustment before he could use the plugin. WooCommerce PDF Invoices & Packing Slips plugin This WooCommerce extension automatically adds a PDF invoice to the confirmation email of the order that is sent to your […]

Custom post type archive content

One of the much discussed points of WordPress is the missing archive content of custom post types. Where custom taxonomy terms have their own textarea where you can edit the term content, there is for custom post types no such thing. Fortunately we can create functionality by ourself to solve this problem with the help op the wp_options […]

Extending admin search with post meta

The default search functionality in your WordPress admin is not based on post meta. To be able to search by post meta you need to extend the posts_join and posts_where query functions by adding a filter on both. First I will add the filter for posts_join as follows: Then I add the filter for posts_where: You can add these […]