Jobifier: Set Default Payment Gateway

By using Jobifier you can have up to 4 payment gateways, they are Stripe, PayPal, Authorize.net and Bank transfer. Your customers have to choose which payment gateway they want to use.

Even if you already activate those four gateways, for some reason you have a favorite payment gateway. Let say it is a bank transfer since you can take your money anytime without worrying about anything.

By default there is no selected payment gateway and a feature for it. At this tutorial, i will tell you about how to make a selected payment gateway.

To do this modification you will need to modify a file named ‘theme-gateways.php‘. This file can be found via FTP at directory: wp-content > themes > jobifier > includes.

Open the file and find out this code:

      	<li class="payment_method_<?php echo $gateway->identifier(); ?>">
					<input id="payment_method_<?php echo $gateway->identifier(); ?>" type="radio" class="input-radio" name="<?php echo $input_name;?>" value="<?php echo esc_attr( $gateway->identifier() ); ?>" data-order_button_text="<?php echo esc_attr( $gateway->display_name( 'dropdown' ) ); ?>" />
					<label for="payment_method_<?php echo $gateway->identifier(); ?>"><?php echo $gateway->display_name( 'dropdown' ); ?></label>
					<?php
						if ( $gateway->has_fields() || $gateway->get_description() ) {
							echo '<div class="payment_box payment_method_' . $gateway->identifier() . '" style="display:none;">';
							$gateway->payment_fields();
							echo '</div>';
						}
					?>
				</li>

Modify it become:

 	<li class="payment_method_<?php echo $gateway->identifier(); ?>" >
					<input id="payment_method_<?php echo $gateway->identifier(); ?>" type="radio" <?php if($gateway->identifier() == 'bank') {echo 'checked="checked"';}?>  class="input-radio" name="<?php echo $input_name;?>" value="<?php echo esc_attr( $gateway->identifier() ); ?>" data-order_button_text="<?php echo esc_attr( $gateway->display_name( 'dropdown' ) ); ?>" />
					<label for="payment_method_<?php echo $gateway->identifier(); ?>"><?php echo $gateway->display_name( 'dropdown' ); ?></label>
					<?php
						if ( $gateway->has_fields() || $gateway->get_description() ) {
							if($gateway->identifier() == 'bank') {
								echo '<div class="payment_box payment_method_' . $gateway->identifier() . '" style="display:block;">';
							} else {
								echo '<div class="payment_box payment_method_' . $gateway->identifier() . '" style="display:none;">';
							}
							$gateway->payment_fields();
							echo '</div>';
						}
					?>
				</li>

And done!

Payment Gateway Options

By using those code, you will choose bank transfer as your default payment gateway. You can also change it become another gateway if you need.

<?php if($gateway->identifier() == 'bank') {echo 'checked="checked"';}?>

if($gateway->identifier() == 'bank') {

Those code above used to control which default payment gateway you want to use. Both of them need to have the same value (at this case bank if you want to have bank as your default payment gateway).

The available options are (small caps):

  • bank
  • authorize_aim
  • paypal
  • stripe
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s