woocommerce_checkout_payment()
Output the Payment Methods on the checkout.
Хуки из функции
Возвращает
null. Ничего (null).
Использование
woocommerce_checkout_payment();
Код woocommerce_checkout_payment() woocommerce checkout payment WC 10.7.0
function woocommerce_checkout_payment() {
if ( ! WC()->cart ) {
wc_doing_it_wrong(
__FUNCTION__,
__( 'Cart is not available. This may indicate that the function is being called before woocommerce_init or in an admin context.', 'woocommerce' ),
'9.8.0'
);
return;
}
if ( WC()->cart->needs_payment() ) {
$available_gateways = WC()->payment_gateways()->get_available_payment_gateways();
WC()->payment_gateways()->set_current_gateway( $available_gateways );
} else {
$available_gateways = array();
}
wc_get_template(
'checkout/payment.php',
array(
'checkout' => WC()->checkout(),
'available_gateways' => $available_gateways,
'order_button_text' => apply_filters( 'woocommerce_order_button_text', __( 'Place order', 'woocommerce' ) ),
)
);
}