• Hi,

    I want to add the following to the snippet but when i try to save and activate i get: An error occurred when saving the snippet

    Thank you

    add_filter(‘woocommerce_valid_order_statuses_for_payment’, ‘allow_payment_of_cancelled_orders’);
    function allow_payment_of_cancelled_orders($valid_statuses) {
    $valid_statuses[] = ‘cancelled’;
    return $valid_statuses;
    }

Viewing 1 replies (of 1 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    The only thing I can think of is that you are running into a duplicate function issue. Rewriting this to use an anonymous function might fix the problem.

    add_filter( 'woocommerce_valid_order_statuses_for_payment', function ( $valid_statuses ) {
    	$valid_statuses[] = 'cancelled';
    
    	return $valid_statuses;
    } );
Viewing 1 replies (of 1 total)
  • The topic ‘Getting an error while saving snippet’ is closed to new replies.