WordPress Development Asked by Pierre-max Halldegare on December 1, 2021
Hello i got many errors in my debug.log about product attribute called wrong way.
here is what i got :
PHP Notice: post was called incorrectly. Product properties should not be accessed directly.
here is my code :
$formateur = $product->attributes[formateur][options][0];
what should i use now ? does this can affect my website ?
i tried to use get_attributes()
but i get an array :
Array ( [duree] => WC_Product_Attribute Object ( [data:protected] => Array ( [id] => 0 [name] => Durée [options] => Array ( [0] => 35 heures – 5 jours ) [position] => 0 [visible] => 1 [variation] => ) ) [formateur] => WC_Product_Attribute Object ( [data:protected] => Array ( [id] => 0 [name] => Formateur [options] => Array ( [0] => Expert FEECS ) [position] => 1 [visible] => 1 [variation] => ) ) [lieu] => WC_Product_Attribute Object ( [data:protected] => Array ( [id] => 0 [name] => Lieu [options] => Array ( [0] => Intra ou Inter ) [position] => 2 [visible] => 1 [variation] => ) ) [niveau] => WC_Product_Attribute Object ( [data:protected] => Array ( [id] => 0 [name] => Niveau [options] => Array ( [0] => niveau 1 ) [position] => 3 [visible] => 1 [variation] => ) ) )
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP