add_hooks(); } public function add_hooks() { $prod = new AMB_WC_Product_Variable_Affiliate(); // Parent custom fields add_action( 'woocommerce_product_options_inventory_product_data', array( $prod, 'add_custom_fields' ) ); add_action( 'woocommerce_update_product', array( $prod, 'after_save_processes' ), 10, 1 ); // Variation custom fields add_action( 'woocommerce_product_after_variable_attributes', array( $prod, 'add_variation_custom_fields' ), 10, 3 ); add_action( 'woocommerce_save_product_variation', array( $prod, 'after_save_variation_processes' ), 10, 2 ); // Admin notice and scripts add_action( 'admin_notices', array( $prod, 'admin_notices' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'main_js' ) ); // For the custom cart text, redirects, and add to cart message. add_filter( 'woocommerce_product_single_add_to_cart_text', array( $prod, 'cart_text' ), 20, 1 ); add_filter( 'woocommerce_add_to_cart_redirect', array( $prod, 'redirect' ) ); add_filter( 'wc_add_to_cart_message_html', array( $prod, 'remove_add_to_cart_message' ), 10, 2 ); } public static function includes() { include_once( plugin_dir_path( __FILE__ ) . 'includes/amb-wcvap-functions.php' ); } public function main_js() { $current_screen = get_current_screen(); // Check that we're on the product page if ( ( $current_screen->id == "product" ) ) { wp_enqueue_script( 'amb-wpvap-js', plugin_dir_url( __FILE__ ) . 'js/main.js', array( 'jquery' ), '1.0.0', true ); wp_register_style( 'amb-wpvap-stylesheet', plugins_url( 'css/amb-wpvap-css.css', __FILE__ ), false, '1.0.0' ); - wp_enqueue_style( 'amb-wpvap-stylesheet' ); } } } } $AMB_wpVAP = new AMB_WPVap_Plugin();