“proceedToCheckoutButtonLabel” JavaScript filter not working
-
I’m running on the following:
WordPress 6.9
Woocommerce 10.4.3
PHP 8.2I’m using both the
proceedToCheckoutButtonLabelandplaceOrderButtonLabelfilters in WooCommerce.placeOrderButtonLabelworks fine butproceedToCheckoutButtonLabelisn’t doing anything.Here’s my code as learned from WooCommerce docs:
// I added this condition first:
if ( "undefined" !== typeof window.wc ) {
const { registerCheckoutFilters } = window.wc.blocksCheckout;
// This works on the checkout page
const myPlaceOrderButtonLabel = ( defaultValue, extensions ) => {
return "Submit Request";
};
// Nothing happens with this
const myProceedToCheckoutButtonLabel = ( defaultValue, extensions, args ) => {
return "Confirm Selections";
};
registerCheckoutFilters( "my-woo-hooks", {
placeOrderButtonLabel: myPlaceOrderButtonLabel,
proceedToCheckoutButtonLabel: myProceedToCheckoutButtonLabel
} );
}So I tried to use plain JavaScript to edit the “Proceed to checkout” label as below:
let p2coBtn = document.querySelector( ".wc-block-cart__submit-container .wc-block-components-button__text" );
if ( p2coBtn ) {
p2coBtn.innerText = "Confirm Selections";
}This works and rewrites the label, but once you click on the button, the whole element crashes and the image below shows up:

Question 1: What’s wrong with my usage of the
proceedToCheckoutButtonLabelfilter?Question 2: Is it meant to have a little delay before the text is filtered? I notice the default button labels always show up first before filters kick in… is there a way to make the filters fire instantly?
I encounter this issue both on my localhost and live sites, and also deactivated miscellaneous plugins and changed theme to TwentyTwentyFive.
The page I need help with: [log in to see the link]
You must be logged in to reply to this topic.