woocommerce-api-import-products icon indicating copy to clipboard operation
woocommerce-api-import-products copied to clipboard

Cannot use object of type stdClass as array

Open djeraseit opened this issue 7 years ago • 2 comments

PHP Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /var/www/html/tnt.amazingoverstock.com/public_html/includes/woocommerce/import.php:54 Stack trace: #0 {main} thrown in /var/www/html/public_html/includes/woocommerce/import.php on line 54

djeraseit avatar Jan 16 '18 18:01 djeraseit

error lines are: status_message( 'Attribute added. ID: '. $wc_attribute['id'] ); $added_attributes[$product_attribute_name]['id'] = $wc_attribute['id'];

Var_dump does show as stdClass

djeraseit avatar Jan 16 '18 18:01 djeraseit

You need to change $wc_attribute['id'] to $wc_attribute->id, since thats a class you can't access it like an array.

Sorry for the delay but I hope it helps someone.

lmotascp avatar Nov 09 '20 16:11 lmotascp