how to edit Woocommerce Variable Product Price " from - to " !!


#1

hello guys,

I have a small problem on my website .
http://zworks.net/

I want to make different version for each 3d character like " 3d max , maya , poser … etc " and I want to make each option have a different price .

So I have to make Variable Product download for Woocommerce . But my proplem is
when I put different price . price show " From 20$ to 100$ "

How can I show only one price and after selecting the other option it show the other price ?


#2

Example : http://s29.postimg.org/l9j32ur13/ergwge3w.jpg


#3

I looked at your site, and it only shows one price for the “army soldier” product. Did you enter the same price for all variations, or have you managed to implement the change you requested?


#4
aelia_co said

I looked at your site, and it only shows one price for the “army soldier” product. Did you enter the same price for all variations, or have you managed to implement the change you requested?

Actually I make them now same price until fix this issue … if I make different price it will automaticly show the min and max price …


#5
Zworks_Store said

Actually I make them now same price until fix this issue … if I make different price it will automaticly show the min and max price …

In such case, you can alter how the price is displayed by adding some filters on your theme. The filters you should target are the following:

  • woocommerce_variable_price_html. Triggered when a product is not on sale.
  • woocommerce_variable_sale_price_html. Triggered when a product is on sale.

You can then add a filter to your theme’s functions.php, like in the the following example:

// Alter the price displayed for variable products NOT on sale
function my_variable_price_display($formatted_price, $product) {
// $formatted_price contains the HTML that will display the price
// Simply modify $formatted_price as you wish, then return it (see below)
return $formatted_price;
}
add_filter(‘woocommerce_variable_price_html’, ‘my_variable_price_display’, 10, 2);

This should get you started. :slight_smile:


#6
aelia_co said
Zworks_Store said

Actually I make them now same price until fix this issue … if I make different price it will automaticly show the min and max price …

In such case, you can alter how the price is displayed by adding some filters on your theme. The filters you should target are the following:

  • woocommerce_variable_price_html. Triggered when a product is not on sale.
  • woocommerce_variable_sale_price_html. Triggered when a product is on sale.

You can then add a filter to your theme’s functions.php, like in the the following example:

// Alter the price displayed for variable products NOT on sale
function my_variable_price_display($formatted_price, $product) {
// $formatted_price contains the HTML that will display the price
// Simply modify $formatted_price as you wish, then return it (see below)
return $formatted_price;
}
add_filter(‘woocommerce_variable_price_html’, ‘my_variable_price_display’, 10, 2);

This should get you started. :slight_smile:

I tried to added it but it’s not fix anything !
take a look : http://s29.postimg.org/m1fbio4wn/grfd.jpg

how to show one price only !!


#7
Zworks_Store said

I tried to added it but it’s not fix anything !
take a look : http://s29.postimg.org/m1fbio4wn/grfd.jpg

how to show one price only !!

The code I posted was never meant to be a complete solution. The snippet is a “skeleton” to get you started, so that you could write your own solution. In my_variable_price_display there is clearly written Simply modify $formatted_price as you wish, then return it (see below). It’s up to you to add the code to modify the price to be displayed. If you leave the code I sent you as is, it won’t change anything. :slight_smile:

If you are not familiar with coding, and you would prefer to have a full solution developed for you, you can hire us, or one of the many developers on this site.


#8
aelia_co said
Zworks_Store said

I tried to added it but it’s not fix anything !
take a look : http://s29.postimg.org/m1fbio4wn/grfd.jpg

how to show one price only !!

The code I posted was never meant to be a complete solution. The snippet is a “skeleton” to get you started, so that you could write your own solution. In my_variable_price_display there is clearly written Simply modify $formatted_price as you wish, then return it (see below). It’s up to you to add the code to modify the price to be displayed. If you leave the code I sent you as is, it won’t change anything. :slight_smile:

If you are not familiar with coding, and you would prefer to have a full solution developed for you, you can hire us, or one of the many developers on this site.

yes please this is my email : differentguy94@hotmail.com