Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- See how it's done in products.json file:
- We have the parent Variable product with "attribute_name": "Gendre" . If your variable product belongs to more than one attribute, then add it. For example: "attribute_name2": "Size".
- --------------------------------------------
- {
- "product_id": 200,
- "type": "variable",
- "name": "My product 2",
- "description": "My product description 2",
- "regular_price": 0,
- "manage_stock": 0,
- "stock": 0,
- "weight": 0,
- "attribute_name": "Gendre",
- "attribute_name2": "Size",
- "has_variations": 1
- }
- --------------------------------------------
- Secondly, what we have here is a child product variation:
- Here we assign a product variation to a certain attribute and its value. "attribute_name": "Gendre" and "attribute_value": "Woman". Here, I will also add our second attribute "attribute_name2": "Size" and value "attribute_value2": "Small",
- {
- "type": "product_variation",
- "parent_product_id": 200,
- "description": "My product variation 1",
- "regular_price": 120,
- "manage_stock": 1,
- "stock": 5,
- "weight": 0,
- "attribute_name": "Gendre",
- "attribute_value": "Woman",
- "attribute_name2": "Size",
- "attribute_value2": "Small"
- }
- What you to do next is to go over the import script and process attribute_name2 and attribute_value2 too.
- function get_attributes_from_json( $json ) - should include attribute_name2 and attribute_value2 too.
- The same is function get_products_and_variations_from_json( $json, $added_attributes ) - your attribute_name2 and attribute_value2 should be there...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement