Thread Starter
csabal
(@csabal)
I figured out, IF I switch currency AFTER everything is in tha cart, everything ok.
So I am so close … can you help me?
csab
Thread Starter
csabal
(@csabal)
Hello, unfortunately WOOCS plugin needs many hacks and workarounds to work with other plugins. Every price goes through that method https://github.com/piatkowski/wckalkulator/blob/master/src/FieldsetProduct.php#L788
In that if statement add code like below:
if (class_exists('WOOCS')) {
global $WOOCS;
$result['value'] = $WOOCS->woocs_exchange_value(floatval($result['value']));
}
Thread Starter
csabal
(@csabal)
Hi
Almost okay.
Added the mentioned code, now it is changing the addon price to the right currency, and amount, however it is not added to the total product price (the sum would be 0). So, when I click add to cart, it is adding the product with 0 value to the cart….
Maybe we should add something to the function.php?
Thread Starter
csabal
(@csabal)
I meant, the plugin shows only the addon price, not the total, and only this is added to the cart ( not the total price). I had try to move your mentioned code to other places, but no luck.
We are so close to solve this issue, could you pls take a look?
@csabal please show me screen shots of your fieldset configuration and formula.
Thread Starter
csabal
(@csabal)
Thread Starter
csabal
(@csabal)
Forgot to mention, that it is work well with the default currency (HUF) but if you switch to EUR it is not counting well. Your code is inserted to the fieldsetproduct.php as you mentioned before
I see now.
First of all in FieldsetProduct.php code should look like
$result = $parser->execute();
if (isset($result['value']) && $result['is_error'] === false) {
if (class_exists('WOOCS')) {
global $WOOCS;
$result['value'] = $WOOCS->woocs_exchange_value(floatval($result['value']));
}
$this->user_input['total_price'] = $result['value'] * $this->user_input["quantity"];
}
return $result;
And then open ProductHelper.php and find every method which returns price (price, sale price, regular price) and apply woocs_exchange_value.
I note that to add in the future releases, because you will lost these changes on update.
Thread Starter
csabal
(@csabal)
HI
Thank you!
How do I add the woocs_exchange_value to the ProductHelper.php ? What would be the exact method? Thx!
Thread Starter
csabal
(@csabal)
Hi, I added this, but did work (sorry I have very limited knowledge of coding)
Could you pls send me an exact example? Thanks a lot in advance.
public function sale_price()
{
return floatval($this->product->get_sale_price());
return floatval($this->product->woocs_exchange_value());
}
/**
* Get regular price of the product or variation
*
* @return mixed
* @since 1.0.0
*/
public function regular_price()
{
return floatval($this->product->get_regular_price());
return floatval($this->product->woocs_exchange_value());
}
Thread Starter
csabal
(@csabal)
Thank you!!!
Code added, browser cache flashed (there is no cache on the server side yet), but still when you change to EUR, it is not calculating in the right method.. 🙁
csaba
Thread Starter
csabal
(@csabal)
Khm, maybe it is because this is a variation products! Not a single woo product!
We may need add this to the variation part of the ProductHelper.php, I guess!