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);

Beautiful Newsletter Templates

Professional newsletter templates that are fully responsive for desktop, tablet, and mobile. They are 100% cross-client compatible.

See Them

Pin It on Pinterest