I manage a woocommerce website with the Woo Rest API.
WP and Woo are up to date and using the last Woo Rest API.
Everything is working well.
My main problem is when I update a product, the image is not overwriting the existing one. It copy a new file with a “-number” at the end of the file and keeping the old one. It’s ok and quite secure but it’s a big problem for disk space.
In wordpress, we already have for one uploaded image, 3 thumbs : so 4 files.
And in my case, I have this 4 files created for each catalog update. So the upload folder become so huge, that it can crash my server because of lack of space.
How can we properly update a product without having copies of the image, or delete the old image and keep the newest by the Woo Rest API ?
Thanks in advance
Here is the json below :
[{"id":1945,"name":"my_product","type":"simple","status":"publish","catalog_visibility":"visible","images":[{"src":"http:\/\/mywebsite.com\/client\/folder\/upload_article_web\/img.jpg"}],"featured":false,"description":"","short_description":"","sku":"4765812","regular_price":"8","sale_price":"","date_on_sale_from":"","date_on_sale_to":"","tax_status":"taxable","tax_class":"1","manage_stock":true,"stock_quantity":-555,"backorders":"yes","reviews_allowed":false,"attributes":[{"name":"La portion","options":["250g"],"visible":true},{"name":"Prix unitaire","options":["32 Euro \/ Kilogramme"],"visible":true},{"name":"Vendu sous vide","options":["OUI"],"visible":true},{"name":"Conseils de pr\u00e9paration","options":[],"visible":false},{"name":"Conseils de conservation","options":[],"visible":false},{"name":"Trucs et astuces","options":[],"visible":false},{"name":"Ingr\u00e9dient","options":[],"visible":false},{"name":"Info Produit","options":[],"visible":false},{"name":"Label2","options":[],"visible":false},{"name":"Producteur","options":[],"visible":false},{"name":"Label1","options":[],"visible":false}],"categories":[{"id":1247}],"_fields":["id","_method","name","type","status","featured","catalog_visibility","description","short_description","sku","regular_price","sale_price","date_on_sale_from","date_on_sale_to","tax_status","tax_class","manage_stock","stock_quantity","backorders","reviews_allowed","attributes","images","categories"]}]
here img.jpg will become img-2.jpg and keeping the img.jpg on the server.
Hello,
I manage a woocommerce website with the Woo Rest API. WP and Woo are up to date and using the last Woo Rest API.
Everything is working well.
My main problem is when I update a product, the image is not overwriting the existing one. It copy a new file with a “-number” at the end of the file and keeping the old one. It’s ok and quite secure but it’s a big problem for disk space.
In wordpress, we already have for one uploaded image, 3 thumbs : so 4 files.
And in my case, I have this 4 files created for each catalog update. So the upload folder become so huge, that it can crash my server because of lack of space.
How can we properly update a product without having copies of the image, or delete the old image and keep the newest by the Woo Rest API ?
Thanks in advance
Here is the json below :
[{"id":1945,"name":"my_product","type":"simple","status":"publish","catalog_visibility":"visible","images":[{"src":"http:\/\/mywebsite.com\/client\/folder\/upload_article_web\/img.jpg"}],"featured":false,"description":"","short_description":"","sku":"4765812","regular_price":"8","sale_price":"","date_on_sale_from":"","date_on_sale_to":"","tax_status":"taxable","tax_class":"1","manage_stock":true,"stock_quantity":-555,"backorders":"yes","reviews_allowed":false,"attributes":[{"name":"La portion","options":["250g"],"visible":true},{"name":"Prix unitaire","options":["32 Euro \/ Kilogramme"],"visible":true},{"name":"Vendu sous vide","options":["OUI"],"visible":true},{"name":"Conseils de pr\u00e9paration","options":[],"visible":false},{"name":"Conseils de conservation","options":[],"visible":false},{"name":"Trucs et astuces","options":[],"visible":false},{"name":"Ingr\u00e9dient","options":[],"visible":false},{"name":"Info Produit","options":[],"visible":false},{"name":"Label2","options":[],"visible":false},{"name":"Producteur","options":[],"visible":false},{"name":"Label1","options":[],"visible":false}],"categories":[{"id":1247}],"_fields":["id","_method","name","type","status","featured","catalog_visibility","description","short_description","sku","regular_price","sale_price","date_on_sale_from","date_on_sale_to","tax_status","tax_class","manage_stock","stock_quantity","backorders","reviews_allowed","attributes","images","categories"]}]
here img.jpg will become img-2.jpg and keeping the img.jpg on the server.