Home / Admin / Make Paypal as default payment gateway
Duplicate Snippet

Embed Snippet on Your Site

Make Paypal as default payment gateway

This snippet will remove all other vendor payment commision methods. Only allowing Paypal, it also makes it the default method.

Code Preview
php
<?php
 if ( ! function_exists( 'wcv_default_commission_payout_method_input' ) ) {
	/**
	 * Set the default commission payout method to paypal
	 *
	 * @param  array $args the input arguments.
	 */
	function wcv_default_commission_payout_method_input( $args ) {
		$args['value'] = 'paypal';
		$options       = $args['options'];
		if ( isset( $options['bank'] ) ) {
			unset( $options['bank'] );
		}
		$args['options'] = $options;
		return $args;
	}
	add_filter( 'wcv_commission_payout_method', 'wcv_default_commission_payout_method_input' );
}
if ( ! function_exists( 'wcv_trigger_payout_method_change' ) ) {
	/**
	 * Trigger payout method change
	 */
	function wcv_trigger_payout_method_change() {
		?>
		<script>
			jQuery( document ).ready( function( $ ) {
				if ($('#wcv_commission_payout_method').length) {
					$('#wcv_commission_payout_method').trigger('change')
				}
			} );
		</script>
		<?php
	}
	add_action( 'wp_footer', 'wcv_trigger_payout_method_change' );
}

Comments

Add a Comment