I need to import 6.5k products from xml file
-
Hi, I need to import 6.5k products. I am using code below but I can upload only 400 products and then time out … what should I need to do ?
$xml_response = simplexml_load_file('as.xml'); foreach($xml_response as $xml){ $my_post = array( 'post_title' => (string) $xml->brand." ".(string) $xml->description, 'post_content' => (string) $xml->description, 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'product' ); $id = wp_insert_post( $my_post ); wp_set_object_terms( $id, array(6), 'product_cat' ); wp_set_object_terms( $id, 'product_type_custom', 'product_type' ); update_post_meta($id, "_sku", (string) $xml->sku); update_post_meta($id, "_price", (string) $xml->price); update_post_meta($id, "_regular_price", (string) $xml->price); update_post_meta($id, "_manage_stock", 'yes'); update_post_meta($id, "_stock_status", 'instock'); update_post_meta($id, "_stock", (string) $xml->qty_available); update_post_meta($id, "_visibility", 'visible'); update_post_meta($id, "_downloadable", 'no'); update_post_meta($id, "_virtual", 'no'); update_post_meta($id, "_featured", 'no'); update_post_meta($id, "_backorders", 'no'); update_post_meta($id, "_retread", (string) $xml->retread); update_post_meta($id, "_baseprice", (string) $xml->Baseprice); update_post_meta($id, "_weight_bruto", (string) $xml->weight_bruto); }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘I need to import 6.5k products from xml file’ is closed to new replies.