Checkout: Action – checkout_admin_paymentmethods_list

Description

Use checkout_admin_paymentmethods_list action hook to add a checkbox to the list of payment methods checkboxes under Checkout > Configuration which is used to enable/disable certain payment methods accordingly.

Usage

add_action('checkout_admin_paymentmethods_list', 'paymentmethods_list', 10, 2);

Arguments

  • $paymentmethods – An Array of current payment methods slugs.
  • $class – The current CSS class of the table row

Example

function paymentmethods_list($paymentmethods = array(), $class = null) {
if (!in_array('mypmethod', $paymentmethods)) {
?>

<tr class="<?php echo $class = (empty($class)) ? 'alternate' : ''; ?>">
<td><label><input <?php echo (!empty($paymentmethods) && is_array($paymentmethods) && in_array('mypmethod', $paymentmethods)) ? 'checked="checked"' : ''; ?> type="checkbox" name="paymentmethods[]" value="mypmethod" /> My Payment Method</label></td>
</tr>

<?php
}
}

add_action('checkout_admin_paymentmethods_list', 'paymentmethods_list', 10, 2);

Website & Email Hosting

Get the best website & email hosting for speed, security, and peace of mind. No restrictions. Freedom to do what you need in order to run your business.

Host Now

Pin It on Pinterest

%d bloggers like this: