D
D
Dmitry Borisov2019-04-27 00:57:22
WordPress
Dmitry Borisov, 2019-04-27 00:57:22

How to swap the price of a variable product only in the product card?

Good day, everyone!
Please help me figure out how to swap the product variation and price only in the product card without affecting the changes in the product catalog.
There is a function in function.php :
remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation', 10);
add_action( 'woocommerce_before_variations_form', 'woocommerce_single_variation', 20);
After which the price rises above the product variation, but the same change occurs in the product category, because of which it does not look very nice
After making the change :
5cc37dad42315446008313.png
and in the catalog :
5cc37e1f3b0ae765667031.png
Is it possible to change the function so that the change concerns only the product card?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Yanchevsky, 2019-04-27
@deniscopro

Good.
So?

if( is_product() ) {
    remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation', 10);
    add_action( 'woocommerce_before_variations_form', 'woocommerce_single_variation', 20);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question