WooCommerce Rename Place Order Button at Checkout
Today, I will show you the easiest way to dynamically and conditionally change it based on the selected payment gateways while checking out. To do this? this snippet requires a payment gateway “ID”. Here is the reference for payment gateway IDs in case you don’t know how to retrieve them.
WooCommerce find gateway ID
PHP Snippet: Rename the “Place Order” Button Dynamically @ WooCommerce Checkout Page
/** * @snippet Rename "Place Order" By Gateway @ WooCommerce Checkout * @how-to Get Resources FREE * @author WP Coders Club * @source https://wpcodersclub.com/woocommerce-rename-place-order-button-at-checkout/ * @compatible WooCommerce 6 */ add_filter( 'woocommerce_available_payment_gateways', 'wpc_rename_place_order_button' );add_filter( 'woocommerce_available_payment_gateways', 'wpc_rename_place_order_button_bacs' ); function wpc_rename_place_order_button( $gateways ) { if ( $gateways['cod'] ) { $gateways['cod']->order_button_text = 'Confirm Cash on Delivery'; } return $gateways;}function wpc_rename_place_order_button_bacs($gateways){ if($gateways['bacs']){ $gateways['bacs']->order_button_text = 'View Bank Details'; } return $gateways;}
Your website is a joy to browse. Keep up the excellent work!