CRITICAL Uncaught TypeError: array_merge(): Argument #2 must be of type array, null given in /wp-content/plugins/taager/includes/ta-products-import.php:393
Stack trace:
7 {main}
thrown ?? wp-content/plugins/taager/includes/ta-products-import.php ?? ????? 393
error is caused by this code part
function taager_generate_product_data( $product ) {
$category = get_term_by( 'name', $product->category->text, 'product_cat' );
$extra_images = array(
$product->extraImage1,
$product->extraImage2,
$product->extraImage3,
$product->extraImage4,
$product->extraImage5,
$product->extraImage6,
);
$gallery_images = array_merge($extra_images, $product->additionalMedia);
variable $product->additionalMedia is null, which is causing the error when it is passed as the second argument to the array_merge() function.
To fix this issue, you could modify the taager_generate_product_data() function to check whether $product->additionalMedia is null or not before merging it with $extra_images.
function taager_generate_product_data( $product ) {
$category = get_term_by( 'name', $product->category->text, 'product_cat' );
$extra_images = array(
$product->extraImage1,
$product->extraImage2,
$product->extraImage3,
$product->extraImage4,
$product->extraImage5,
$product->extraImage6,
);
$gallery_images = $extra_images;
if (isset($product->additionalMedia)) {
$gallery_images = array_merge($extra_images, $product->additionalMedia);
}
-
This topic was modified 1 year, 6 months ago by MOXX.