I want to add two prices on single product, first simple price was showing but when clicking on cariation size, price was duplicating, simple and variation both price showing, I want to show one price at a time.
Asked
Active
Viewed 1,050 times
1
-
1**This require to use jQuery**… But as you are using a custom plugin (or some customizations) to display sizes as swatches, you will need to adapt the code from this answer to make it work for you: [Replace the Variable Price range by the chosen variation price in WooCommerce 3](https://stackoverflow.com/a/44914240/3730754) – LoicTheAztec Oct 25 '18 at 08:30
3 Answers
1
Fix 2x price GoTo: www.YOURDOMAIN/wp-admin/admin.php?page=wc-settings&tab=tax then remove {price_excluding_tax} from "Price display suffix" input field

Andrew
- 11
- 1
0
You Can try with jquery onchange function and get above product price and show at bottom

Vijay Rana
- 1
- 4
-
I have checked that also I put the if else statement, but it was not working on variation. – Sharjeel Moin Oct 25 '18 at 05:45
0
You can try to use this code. Hope it will work.
add_action( 'init', 'wp1232_remove_price_for_variations', 99 );
function wp1232_remove_price_for_variations() {
global $product;
if ( 'variable' == $product->get_type() ) {
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
}
}

Sabbir Ahmed
- 141
- 2
-
I add this code to my function.php file but it didn't change anything. – Sharjeel Moin Oct 25 '18 at 06:52
-
Can you try one time to change this action `add_action( 'init', 'wp1232_remove_price_for_variations', 99 );` to `add_action( 'woocommerce_single_product_summary', 'wp1232_remove_price_for_variations', 9 );` – Sabbir Ahmed Oct 25 '18 at 07:15
-
somethingndid work but there is still a problem, that by default no price was showing up. And when I am clicking on variation then the price will show up. – Sharjeel Moin Oct 29 '18 at 14:03
-