Skipping Marketpress Checkout Page On Manual Payment Hack

Not really a question but I would like to share a quick hack on how to skip Checkout (Payment Information) page when using manual payments in the event of waiting Marketpress 3.0 (currently using v2.9.6.2) . I was looking to skip the checkout page as currently there is too many steps involved and reducing it by one makes a huge difference.

Note!! THIS IS A HACK.. ie. when you make a marketpress plugin update, this change will disappear. Only use this hack when you are using ONLY 'Manual Payments' (ie. not really accepting any payments online). Ready? Ok here goes..

1 . Ensure you have Manual Payments checked in your store settings page

2. Edit marketpress.php. Somewhere in line 3537 add $skip=true; like this

$skip = apply_filters( 'mp_payment_form_skip_' . $this->get_setting( 'gateways->allowed->0' ), false);
$skip = true; //hack to skip payment form

3. Test it! Done!

  • Vinod Dalvi
    • WP Unicorn

    Hi @ic198,

    I hope you are well today and thanks for sharing the solution in the forum.

    Your help is really appreciated here.

    Yes you are right that if we make any changes in the plugin file then we have to make these changes again after plugin updation as changes made in the plugin file get lost on plugin updation.

    So we can do the same thing without making changes in the MarketPress plugin, instead we can add the following code in the functions.php file of the child theme or develop a small plugin and add this code in it to use it to skip Checkout (Payment Information) page.

    function mp_payment_form_skip_true(){
    	return true;
    }
    
    function skip_the_payment_form_page(){
    
    	$network_settings = get_site_option( 'mp_network_settings' );
    
    	$custom_global_cart = false;
    
    	//load sitewide features if WPMU
    	if ( is_multisite() ) {
    		if ( isset( $network_settings[ 'global_cart' ] ) && $network_settings[ 'global_cart' ] )
    			$custom_global_cart = true;
    	}
    
    	//can we skip the payment form page?
    	if ( $custom_global_cart  ) {
    		add_filter( 'mp_payment_form_skip_' . $network_settings[ 'global_gateway' ], 'mp_payment_form_skip_true' );
    	} else {
    		global $mp;
    		add_filter( 'mp_payment_form_skip_' . $mp->get_setting( 'gateways->allowed->0' ), 'mp_payment_form_skip_true' );
    	}
    }
    add_action('init', 'skip_the_payment_form_page');

    I have attached the developed small plugin that contains the above code so your can just download and use it.

    Thank you for being a WPMU DEV member and have a fantastic day!

    Cheers,
    Vinod Dalvi

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.