From time to time, I find myself needing to do test purchasing on a live site. Generally speaking, it’s because there is something occurring outside the payment flow on a live site that cannot be replicated locally. The following code ensures that the test gateway is enabled only for logged-in admin users. Hope it’s helpful!
add_filter( 'option_custom_gateway_options', function( $gateways ) { if ( current_user_can( 'manage_options' ) && ! in_array( 'wpsc_merchant_testmode', $gateways ) ) { $gateways[] = 'wpsc_merchant_testmode'; } return $gateways; } );
Leave a comment