Settings checkbox not triggering function

I have recently created this code as a plugin to store a setting in the WooCommerce general settings. The checkbox is meant to

// Check if WooCommerce is active
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {

    // Settings
    function hm_woo_disable_shop_settings( $settings ) {
        
        $settings[] = array(
            'title' => __( 'Disable Shop', 'wcds' ),
            'type' => 'title',
            'desc' => 'Check this box to disable all WooCommerce features',
            'id' => 'wcds_settings',
        );

        // Checkbox
        $settings[] = array(
            'title'             => __( 'Disable', 'woocommerce' ),
            'desc'              => __( 'This has no affect to the database and will only limit frontend functions', 'wcds' ),
            'id'                => 'wcds_checkbox',
            'default'           => '',
            'type'              => 'checkbox',
            'desc_tip'          => true,
            'value'             => get_option('wcds_checkbox'),
            'checked'           => esc_attr( checked( 1, get_option('wcds_checkbox'), false ) )
        );

        $settings[] = array( 'type' => 'sectionend', 'id' => 'wcds_settings' );
        return $settings;
    }
    add_filter( 'woocommerce_general_settings','hm_woo_disable_shop_settings', 10, 2 );
    

    // Functions
    function woocommerce_disable_shop() {
        
        global $woocommerce;

        // Get the checkbox value from settings
        if( get_option( 'wcds_checkbox' ) === '1' ) {
            add_filter( 'woocommerce_is_purchasable', '__return_false');
        }
        
    }
    add_action( 'init', 'woocommerce_disable_shop' );
    
}

Go to Source
Author: Jesse