M
M
madc0de2018-04-25 02:03:53
WooCommerce
madc0de, 2018-04-25 02:03:53

How to update woocommerce rest api products, hide those that are not in the upload?

Hello.
There is a yml link by which I unload all the products through the script and add them through the rest api woocommerce.
I ask you to suggest the logic of updating the goods (there is a product or not). Remains are not added or updated, the product is always available for the site.
Let's say some product was removed from the search results and the script cycles through the array and updates the prices of products (only those that are in the link), and if some product has disappeared from the link, but it is in the database and on the site, like Should I remove it and catch it?
It is necessary to create a table and keep records in it, or somehow take an array of all products from a category and compare with an array by reference. How to do it right?
Example for understanding: Product 1 Product 2
was loaded by yml link
Product 3
The next day, the krone script launched and updated
Product 1
Product 2
Product 3
And added Product 4
On the 3rd day, the script started, but the supplier deleted Product 2 using the link
The script updates
Product 1
Product 3
Product 4
How to delete Product 2 in this case?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question