I
I
Ivan Trubchaninov2016-11-03 12:31:23
WordPress
Ivan Trubchaninov, 2016-11-03 12:31:23

Woocommerce: how to store the price of a variable product?

It is necessary to multiply the price by the coefficient in the variable product.
I have created two fields: price and ratio. Now we need to save the result in the price field.
For a simple product, I use $custom_price and add it via add_action( 'save_post', 'wc_myprice_save_product' );
A variable product has: regular_price, price and sale_price. When saving the result of multiplication in any of them, the admin panel crashes.
Maybe someone has a link at hand, how does this whole system with a variable product work?
I got lost in the official documentation, but I will be grateful even if you poke my nose in a specific place in it.

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