Saturday, July 23, 2022
HomeWordPress Developmentplugins - apply_filters(woocommerce_get_item_data, ...) Inflicting errors when including to cart

plugins – apply_filters(woocommerce_get_item_data, …) Inflicting errors when including to cart


The /wp-content/plugins/woocommerce/contains/wc-template-functions.php file has a perform referred to as wc_get_formatted_cart_item_data() that runs each time I try so as to add a product to cart. Inside that perform there’s this block of code

$item_data = apply_filters( 'woocommerce_get_item_data', $item_data, $cart_item );

// Format merchandise knowledge able to show.
foreach ( $item_data as $key => $knowledge ) {
   ...
}
...
if ( rely( $item_data ) > 0 ) {
   ...
}

The apply_filters( 'woocommerce_get_item_data', $item_data, $cart_item ) on the primary line returns an empty string which throws a warning when the loop on the $item_data variable runs and a deadly error when rely($item_data) runs.

Any thought the way to repair this subject long-term? presently, I am simply skipping the rely() perform if $item_data is a string however I need one thing for strong.

Thanks.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments