Cannot redeclare function error on the same line

Don’t define functions within functions. function run_plugin(), function my_plugin_name(), and custom_cart_min_qty(). This is not how you should write this code. Your add_action() and add_filter hooks already call these functions.