Answer the question
In order to leave comments, you need to log in
How to save price for all languages (translation) of a Woocommerce product?
Developed a plugin for importing prices from a file. Based on the sku, I get the product ID using wc_get_product_id_by_sku() , create an object and execute set_regular_price(), set_price() . But this is only for one main language. How to update price for product translation (Woocommerce Multilingual) too? Or how to synchronize the original and translation?
Answer the question
In order to leave comments, you need to log in
See. You don't need to store the price for all languages. You need to store the price of the exchange rate of the currency you need. What am I leading to. The prices themselves usually take up little space, but the exchange rate itself changes very often.
Imagine that you have 20k goods in rubles and their price will change only in a month. You have an additional 2 currencies: euro and dollar. You decide that it is more profitable to keep the ready price, because this allows you to get all the prices of currencies on the detailed page at once and you do not need to calculate anything. How convenient.
Now imagine what is going on in your backend. You need to update 40k rows daily instead of 2 rows! And in addition, in a month you make transactions in the database with only two currencies for 1 million 200 thousand transactions instead of 60.
At the same time, the programmer's labor costs will be reduced, because it is much easier to update two currencies with one request and then calculate it on the client than a programmer will do ingenious noodle codes to update 20k products and so that it does not fall yet. Of course, you can write a function in the database that will update the price itself, but this is an overhead and overqualification.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question