Viewing 1 replies (of 1 total)
  • Comment out line 107 and 189 in class/class-manage-discount.php:

    //if($isFlatDiscountOn == 'no') {
    // }

    if you want to update prices automatically on product save add a metabox from line 191 and on:

    function woocm_cat_add_meta_box() {
    
    	$screens = array( 'product' );
    
    	foreach ( $screens as $screen ) {
    
    		add_meta_box(
    			'woocm_cat_sectionid',
    			__( 'Woocommerce Fields', 'woocm_cat_textdomain' ),
    			'woocm_cat_meta_box_callback',
    			$screen
    		);
    	}
    }
    add_action( 'add_meta_boxes', 'woocm_cat_add_meta_box' );
    
    /**
     * Prints the box content.
     *
     * @param WP_Post $post The object for the current post/page.
     */
    function woocm_cat_meta_box_callback( $post ) {
    
    	wp_nonce_field( 'woocm_cat_save_meta_box_data', 'woocm_cat_meta_box_nonce' );
    	echo '<div style="display:none">';
    	list_category_bulk_discount();
    	echo '</div>';
    }
    
    /**
     * When the post is saved, saves our custom data.
     *
     * @param int $post_id The ID of the post being saved.
     */
    function woocm_cat_save_meta_box_data( $post_id ) {
    
    	/*
    	 * We need to verify this came from our screen and with proper authorization,
    	 * because the save_post action can be triggered at other times.
    	 */
    
    	// Check if our nonce is set.
    	if ( ! isset( $_POST['woocm_cat_meta_box_nonce'] ) ) {
    		return;
    	}
    
    	// Verify that the nonce is valid.
    	if ( ! wp_verify_nonce( $_POST['woocm_cat_meta_box_nonce'], 'woocm_cat_save_meta_box_data' ) ) {
    		return;
    	}
    
    	// If this is an autosave, our form has not been submitted, so we don't want to do anything.
    	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
    		return;
    	}
    
    	save_category_data();
    
    }
    add_action( 'save_post', 'woocm_cat_save_meta_box_data' );
Viewing 1 replies (of 1 total)
  • The topic ‘Not workgin’ is closed to new replies.