Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- http://dominykasgel.com/woocommerce-rest-api-import-products-json/
- Explanation: This allows you import an image to a simple product.
- Add "image" to products.json file.
- ------------------------------------------------------------------
- {
- "product_id": 100,
- "type": "simple",
- "name": "My product 1",
- "description": "My product description 1",
- "regular_price": 100,
- "manage_stock": 1,
- "stock": 3,
- "weight": 0,
- "has_variations": 0,
- "image": "http://localhost/my-image.png"
- },
- ------------------------------------------------------------------
- In get_products_and_variations_from_json() function, below this line: if ( $pre_product['type'] == 'simple' ) :
- Add this code:
- ------------------------------------------------------------------
- if ( $pre_product['image'] ) {
- $product[$key]['images'][] = array(
- 'src' => (string) $pre_product['image'],
- 'position' => 0
- );
- }
Add Comment
Please, Sign In to add comment