• Resolved mtnorthrop

    (@mtnorthrop)


    Plugin Version 1.1.0

    The “Before Order Submit” and “After Order Submit” options do not work.

    This is because the section these actions are in is updated via AJAX after the checkout page loads, and the original HTML is replaced with HTML provided by the AJAX response.

    The lines that are causing this error can be found at the bottom of the includes/class-mpwa-frontend-fields.php file:

    
    if(is_checkout() && empty($MPWA_Frontend_Fields)){
    	$MPWA_Frontend_Fields = MPWA_Frontend_Fields::init();
    }

    The problem is that the is_checkout() function returns false during the AJAX request.

    Until the plugin author fixes this, a possible workaround is to create your own plugin or theme file, and create your own action function that calls MPWA_Frontend_Fields::init().

    Here’s an example for how this could be done:

    
    $MPWA_Frontend_Fields = '';
    function my_init_mpwa_frontend_fields() {
    	global $MPWA_Frontend_Fields;
    
    	if(class_exists('MPWA_Frontend_Fields') && empty($MPWA_Frontend_Fields) && is_ajax()){
    		$MPWA_Frontend_Fields = MPWA_Frontend_Fields::init();
    	}
    }
    add_action('posts_selection', 'my_init_mpwa_frontend_fields');
    

    Please note, the code above might not be ideal in some cases but it solved the problem for me so I’m offering it as a suggestion, for what it’s worth.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Before Order Submit and After Order Submit positions are broken’ is closed to new replies.