K
K
Konstantin2020-11-29 12:47:05
WordPress
Konstantin, 2020-11-29 12:47:05

How to implement scheduled price updates?

There is a site with goods, implemented on wp + woocommerce.

Products are imported every night (updating balances, adding new products via wp all import) using the supplier's link.

The price field indicates the wholesale price. But I want to massively change prices, by ranges, if the product is from 100 to 500 rubles, then the markup is 20% ... and so on, in principle, I found a plugin that changes massively, but the problem is that the plugin has set new prices, but at night the import took place and the prices were updated (overwritten).

What are the ways to solve this problem, so that the margin on the goods is set according to the schedule after each import?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Zolin, 2020-11-29
@gradk

1. We get all the goods get_posts( [ 'post_type' => 'product' ] );
2. In the loop we get the required field using get_post_meta()
3. We do something with it
4. Push back update_post_meta()
5. We hang everything on the crowns and test

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question