K
K
Ksey1232018-11-08 06:53:01
WooCommerce
Ksey123, 2018-11-08 06:53:01

How to add an additional amount of a variable product that doesn't change from woocommerce quantity?

Suppose there is a variant of the product (1000 rubles - 1 pc.) In which, according to the condition of the variant, there is an additional markup of + 500 rubles. but with an increase in the quantity (1 pc / 2 pcs, etc.), it should not change, but remain fixed.
That is, there are 2 pcs in the basket. in the amount of 2000 rubles. + 500 rub. additional markup.
If 3 pcs. - 3000r. + 500 rub.
Now, when the quantity increases, the additional markup also increases.
If 3 pcs. - 3000r. + 1500 rub.
I hope I explained it clearly) I
did not find such an opportunity in extra product options. Thanks in advance for your reply.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pychev Anatoly, 2018-11-08
@pton

You need to understand what this extra charge is.
If this is a constant markup that is added to the cart if certain products are in it, then this should be done through fees. This is the markup on the basket, it can be positive and negative.
If your markup is individual for each variation or product, then you need to register an additional field for each variation or product where this value will be indicated and then again, through fees, determine which products are in the basket and calculate this markup picking up the values ​​for each product
look towards this hook "woocommerce_cart_calculate_fees"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question