Add multiple attributes
-
I’m creating a variable product and to set the attribute I have the following code that works just fine:
$attribute = new WC_Product_Attribute(); $attribute->set_id(0); $attribute->set_name('Group 1'); $attribute->set_options(array('Blue', 'Green', 'Red')); $attribute->set_position(0); $attribute->set_visible(0); $attribute->set_variation(1); $product->set_attributes(array($attribute));
How do I add more than one Name and Options? So like Group 2 and its options: A, B, C… just need to understand the syntax of how I can add multiple attributes. Thanks!!!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Add multiple attributes’ is closed to new replies.