Add additional licence details on Products archive page

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInPrint this page

By woocommerce-sl, posted on December 6, 2018

For an easier Product management, additional details within admin dashboard on Products archive might come in handy. This is easy to achieve through the default WordPress filter manage_product_posts_custom_column This reduce the maintenance time and let the administrator to focus on important aspects of the site.

The next code example add the licensed product version nwxt to the Product name within the archive interface:

    add_filter( 'manage_product_posts_custom_column', 'admin_product_title_version', 99, 2 );
    function admin_product_title_version( $column, $postid ) 
        {
            if ( 'name' === $column ) 
                {
                    $product = wc_get_product( $postid );
                    if ( 'yes' === $product->get_meta('_sl_enabled') ) 
                        {
                            printf(
                                '
<strong>v %s</strong>',
                                $product->get_meta('_sl_new_version')
                            );
                        }
                }
        }

The above code can be included within theme functions.php, within a custom plugin or mu-plugins folder. The expected results appear like this:

Other licensing fields can be used too, as follow:

  • _sl_software_title
  • _sl_software_unique_title
  • _sl_plugin_url
  • _sl_product_expire_units
  • _sl_product_expire_time
  • _sl_version_required
  • _sl_tested_up_to
  • _sl_last_updated
  • _sl_update_nottice
Tag: ,
Category:
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments