Home / Admin / Remove Caddy Premium conversions from showing on the WooCommerce orders page
Duplicate Snippet

Embed Snippet on Your Site

Remove Caddy Premium conversions from showing on the WooCommerce orders page

This prevents Caddy Premium from modifying the orders table and item display

Code Preview
php
<?php
/**
 * Remove Caddy Premium conversions from showing on the WooCommerce orders page
 *
 * This prevents Caddy Premium from modifying the orders table and item display
 *
 * @author   Mike Valera
 * @plugin   Caddy - Premium Edition
 * @link     https://usecaddy.com
 */
add_action('admin_init', function() {
    global $wp_filter;
    
    foreach ($wp_filter as $hook_name => $hook_obj) {
        if (!isset($hook_obj->callbacks)) continue;
        
        foreach ($hook_obj->callbacks as $priority => $callbacks) {
            foreach ($callbacks as $callback_data) {
                if (!is_array($callback_data['function']) || !is_object($callback_data['function'][0])) continue;
                
                if (get_class($callback_data['function'][0]) === 'Caddy_Premium_Admin' && 
                    in_array($callback_data['function'][1], [
                        'add_order_listing_column',
                        'populate_order_listing_column',
                        'add_orders_list_styles',
                        'add_order_item_header',
                        'add_order_item_value'
                    ])) {
                    remove_filter($hook_name, $callback_data['function'], $priority);
                }
            }
        }
    }
}, 20);

Comments

Add a Comment