• Resolved 1callservice

    (@1callservice)


    This filter now suddenly breaks the site with this fatal error in PHP… it was working fine before update?

    PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function displaystockestimatedate(), 1 passed in /…../wp-includes/class-wp-hook.php on line 288 and exactly 2 expected in /…../wp-content/themes/storefront-child/functions.php:128

    add_filter('woocommerce_get_stock_html','displaystockestimatedate');
    function displaystockestimatedate($existing,$product){
    
    	$productid=get_the_ID();
    	if(is_singular('product')){
    		if(get_post_meta($productid,'_estimated_backorder_available_date',true) != ""){
    			$output = $existing."<div class=\"backorderestimateavailability\">".get_post_meta($productid,"_estimated_backorder_available_date",true)."</div>";
    		}else{
    			$output = $existing;
    		}
    		return $output;
    	}else{
    		return $existing;
    	}
    }
    • This topic was modified 5 years, 7 months ago by 1callservice.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @1callservice!

    What happens when you add $priority and $accepted_args, like so:

    add_filter('woocommerce_get_stock_html','displaystockestimatedate', 10, 2);

    Does it make a difference?

    Cheers!

    • This reply was modified 5 years, 7 months ago by Rynald0s.
    Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Howdy!

    We haven’t heard back from you in a while, so I’m going to go ahead and mark this thread as resolved. If you have any other questions please start a new thread.

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fatal error after latest update’ is closed to new replies.