Create woocommerce order by Uploading Excel file
-
Import orders from excel file to woocommerce
Create woocommerce order by Uploading Excel file
We have some orders from our customer that they are orderd by directly calling to us . So we have save their details in excel file with every details (customer name address etc to product name , product id , variation id , discount ,coupon details etc ).
We know how to upload data to databse through excel by php code .
for a sample example
` <form name=”import” method=”post” enctype=”multipart/form-data”>
<input type=”file” name=”file” />
<input type=”submit” name=”submit” value=”Submit” />
</form>``if(isset($_POST[“submit”]))
{
$file = $_FILES[‘file’][‘tmp_name’];
$handle = fopen($file, “r”);
$c = 0;
while(($filesop = fgetcsv($handle, 1000, “,”)) !== false)
{
$name = $filesop[0];
$email = $filesop[1];$sql = mysql_query(“INSERT INTO order (name, email) VALUES (‘$name’,’$email’)”);
}if($sql){
echo Correctly uploaded “;
}else{
echo “it’s not working “;
}
}`and we know how to fetch each and every details of product .
But please help to integrate with woocommerce . Since we noticed that each order is saved in
wp_posts
, withpost_type='shop_order'
, and order status as a taxonomy namedshop_order_status
, customer details of order is save as post_meta field ets and we know how to use each class in woocommerce for retrieving data for exampleWC_Order,WC_Order_Item_Meta.
Please help to complete this . If any one can explain the basic table structure of woocommerce for inserting query through sql, it is also helpful.
Thank you .
- The topic ‘Create woocommerce order by Uploading Excel file’ is closed to new replies.