Disable or remove custom option plugin through functions.php

Question

How can I disable or remove a custom plugin’s option through functions.php?

The plugin’s option looks like this:

$customoption = lisfinity_get_option('membership-phone');

I can call this with echo in every page and appears, but I want to remove this option through functions.php with a Woocommerce condition.
How can I do that? I attached my bad code for example. My code works and display echo, but can’t disable option.
This is my woocommerce conditional code:

    
   function has_bought_items() {
     

       
    $bought = false;


    $prod_arr = array( '2881', '2887' );


    $customer_orders = get_posts( array(
        'numberposts' => -1,
        'meta_key'    => '_customer_user',
        'meta_value'  => get_current_user_id(),
        'post_type'   => 'shop_order', 
        'post_status' => 'wc-completed'
    ) );
    foreach ( $customer_orders as $customer_order ) {
   
        $order_id = method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id;
        $order = wc_get_order( $customer_order );

       
        foreach ($order->get_items() as $item) {
           
            if ( version_compare( WC_VERSION, '3.0', '<' ) ) 
                $product_id = $item['product_id'];
            else
                $product_id = $item->get_product_id();

            
            if ( in_array( $product_id, $prod_arr ) ) 
                $bought = true;
        }
    }
    
    
    return $bought;
       
}
    
    



if ( has_bought_items() ) {


$customoption = lisfinity_get_option('membership-phone');
delete_option($customoption');
  
} 

else {
    echo 'dasd';

}

    
}


add_action( 'wp_head', 'my_custom_function' );



0
maxim gabriel 1 month 0 Answers 11 views 0

Leave an answer