Support » Plugin: WooCommerce » form-pay.php override and filters not working

  • Resolved Will Hawthorne


    I initially tried various version of the following code for a filter on the form-pay.php template:

    add_filter( 'woocommerce_pay_order_button_html', 'mandr_woo_pay_order_button_html' );
    function mandr_woo_pay_order_button_html($str) {
    	$return = str_replace( 'input', 'button', $str );
    	return $return;

    Then I tried overriding the template complete since that didn’t work, but overriding didn’t work either. Yes it was in /woocommerce/checkout/. And the code I wrote was included correctly because it’s in a file with other filters that are working. And I have a different template override that is working.

    Is this a bug, or does anyone have any idea what coudl be causing nothing to override form-pay.php?

Viewing 1 replies (of 1 total)
  • I found my problem. The form-pay.php template is for the Checkout shortcode. What I was looking for was in the payment.php template file, which is the template for the checkout page. Why there is a need for WooCommerce to be WET here I do not know.

    The filter in payment.php is ‘woocommerce_order_button_html’

    And in case anyone tries to use the above function, I ended up not using str_replace, instead just rewriting the html button. Hopefully this will not break anything in future updates, or maybe they will include more variables to filter on.

Viewing 1 replies (of 1 total)
  • The topic ‘form-pay.php override and filters not working’ is closed to new replies.