WOOT - WooCommerce Active Products Tables

How to add refferal buttons into the table

Use hook woot_profile_extend for it.

Here is some examples:

  • Lets add referral button to the table:
    add_action('woot_profile_extend', function($profile, $action_name) {
    
        if ($action_name === 'woot_woocommerce_tables') {
            $profile['refferals'] = [
                'title' => 'Refferal btn',
                'order' => FALSE,
                'action' => function($post_id) {
                    $refferal = 'demo';
    
                    return WOOT_HELPER::draw_html_item('a', [
                                'href' => "https://demo.products-tables.com?ref={$refferal}&product_id={$post_id}",
                                'class' => 'woot-btn',
                                'target' => '_blank'
                                    ], 'Get it for free');
                }
            ];
    
        }
    
        return $profile;
    }, 10, 2);
  • This is good for external products you promoted on your site
  • Also you can get referral link in another way, for example take if from the product metadata