Support

Content of the article

You need to log-in to create request (topic) to the support

individual price does not show after selecting variations

(new from 01-07-2019)
12

Hi, if i disable woocomeerce currency switcher, the selected variation individual price is shown above ADD TO CART button, but if enable WOOCS plugin, the individual price after variation is not shown, i have contacted support for themes and after looking at my website admin, they told me to contact PLUG IN SUPPORT, can you please help...thnx

Hello

Please  drop  me  exact  link  to the  issue  I  will  check  it

Hi,

 

 

heres the link

 

https://bazaar.id/product/girls-batik-dress/

Hello

Ok!  I got  it!

I research it. I will write to you as soon as the result

Hello

Try  in file - \wp-content\plugins\woocommerce-currency-switcher\classes\woocs_after_33.php

change function raw_woocommerce_price

New function:

public function raw_woocommerce_price($price, $product = NULL, $min_max = NULL, $display = NULL) {

if (isset($_REQUEST['woocs_block_price_hook'])) {
return $price;
}

//***

if (isset($_REQUEST['woocs_raw_woocommerce_price_currency'])) {
$this->current_currency = $_REQUEST['woocs_raw_woocommerce_price_currency'];
}

$currencies = $this->get_currencies();

if (in_array($this->current_currency, $this->no_cents)/* OR $currencies[$this->current_currency]['hide_cents'] == 1 */) {
$precision = 0;
} else {
if ($this->current_currency != $this->default_currency) {
$precision = $this->get_currency_price_num_decimals($this->current_currency, $this->price_num_decimals);
} else {
$precision = $this->get_currency_price_num_decimals($this->default_currency, $this->price_num_decimals);
}
}

//***
$is_price_custom = false;
if ($this->is_fixed_enabled) {
if ($this->is_multiple_allowed AND $product !== NULL AND is_object($product)) {

//if (isset($product->variation_id))
if ($product->is_type('variation')) {

$tmp_val = $this->_get_product_fixed_price($product, 'variation', $price, $precision);
} elseif($product->is_type('variable')){
$tmp_val=-1;
}else {
$tmp_val = $this->_get_product_fixed_price($product, 'single', $price, $precision);
}

if ((int) $tmp_val !== -1) {
$price = apply_filters('woocs_fixed_raw_woocommerce_price', $tmp_val, $product, $price);
$is_price_custom = true;
}
}
}
//***
if ($this->is_geoip_manipulation AND ! $is_price_custom) {
if ($product !== NULL) {
try {
$product_emulator = (object) array('id' => $product->get_id());
} catch (Exception $e) {

}

$price = $this->_get_product_geo_price($product_emulator, $price);
}
}
if ($this->is_fixed_user_role AND $product !== NULL) {
if ($product->is_type('variation')) {

$tmp_val = $this->_get_product_fixed_user_role_price($product, 'variation', $price, $precision);
} elseif($product->is_type('variable')){
$tmp_val=-1;
} else {
$tmp_val = $this->_get_product_fixed_user_role_price($product, 'single', $price, $precision);
}

if ((int) $tmp_val !== -1) {
$price = $tmp_val;
$is_price_custom = false;
}
}

//***

if (!$is_price_custom) {
if ($this->current_currency != $this->default_currency) {
//Edited this line to set default convertion of currency
if (isset($currencies[$this->current_currency]) AND $currencies[$this->current_currency] != NULL) {
$price = number_format(floatval((float) $price * (float) $currencies[$this->current_currency]['rate']), $precision, $this->decimal_sep, '');
} else {
$price = number_format(floatval((float) $price * (float) $currencies[$this->default_currency]['rate']), $precision, $this->decimal_sep, '');
}
}
}

return apply_filters('woocs_raw_woocommerce_price', $price);}

thnx for your reply, i dont not know how to use PHP edit as i am not a programmer but web designer only, do you mind to email me the edited revised version to my email at hendrayono80@gmail.com?

 

i tried to edit ealier by myself but the whole plugin got error and website crashed...

 

 

im getting error like this

 

Parse error: syntax error, unexpected 'if' (T_IF), expecting identifier (T_STRING) in /home/bazaarid/public_html/wp-content/plugins/woocommerce-currency-switcher/classes/woocs_after_33.phpon line 9

Hello

 

Please  drop  me FTP + wp-admin  access - https://c2n.me/42BAoj4.png

Please check  your FTP

 

done, please read private data, i have changed the access user and pass

hi,

 

may i know what is the progress?

Hello

Can I deactivate  plugins  to  test?

hi,

 

sure you can

Hello

Pleas do test!

hi

may i know what file did you change? so that i can download and save the file incase future update breaks the changes

hi,

 

i just check and still does not appear price after variation...

 

https://bazaar.id/product/girls-batik-dress/

Hello

 

https://c2n.me/42Y0Oac.jpg  AND https://c2n.me/42Y0RdX.jpg

Clear all cache

hi,

i clear all cache in Macos Safari and Chrome

i cleared all cache in Windows 10 pc Edge and Chrome

 

but it still display the same problem, no price after variation, is there any thing i missed?

hi,

 

ok, it worked in Rp mode but not USD mode...

Hello

My test - https://c2n.me/430yeDP

12