ajaykumartak
ajaykumartak

Reputation: 776

Change WooCommerce Gateway Display Order

I goggled a lot but didn't find an answer.

My Problem is : I developed a custom Woo-commerce payment gateway and added it's settings under checkout tab in Woo-commerce settings panel. Now i want that my custom payment gateway should be at top on checkout page. So how i can do that?

I don't want to do that by doing drag and drop on checkout options page.

I want that when i install and active my plug-in then using some action or hook i want to set it at top.

Thanks in Advance.

Upvotes: 0

Views: 1424

Answers (1)

Kresimir Pendic
Kresimir Pendic

Reputation: 3614

great question!

I found it,, in your plugin where you define your custom class and init it with hook for woocommerce to add actual plugin like this in mine:

add_filter( 'woocommerce_payment_gateways', 'woocommerce_add_mk_tcom_gateway' );

inside function you have something like this I guess,,

only change this line:

/**
 * Add the Gateway to WooCommerce
 **/
function woocommerce_add_mk_tcom_gateway($methods) {
    array_unshift($methods, 'WC_MK_tcom' );
    // $methods[] = 'WC_MK_tcom';
    return $methods;
}

on checkout page you'll have this first option :)

hth, k

Upvotes: 2

Related Questions