Bug Found: Cart showing incorrect price

Posted about 7 years ago by Caesar

Post a topic
Answered
Caesar
Caesar

Hello,


I think there may be a bug within the plugin. For my site, the base price of a product is $7.00. For custom uploaded images as well as fancy designs, each image price is an additional $3.00. On the product/designer page it first displays the base product price of $7.00 which is correct. Then, when I add a custom upload image, the price increases to $10 which is correct because of the additional $3.00 for custom images. But, when I add to cart, the product total is $9.28 when it should be $10.00. I've attached screenshots to help display this issue. What's odd is that it's showing the total price (at the bottom of the "cart showing incorrect price" screenshot) as $10.00 because it then adds tax $0.72 to the product total of $9.28. This is incorrect as it should be adding tax to the $10.00 not $9.28.


So, the product total should be the base product price, + additional custom image/fancy design/text THEN tax and shipping should be added afterwards...



Is there something I need to configure so prices will be added properly?

0 Votes

Efbi

Efbi posted almost 7 years ago Best Answer

Hi guys, I found a temporary solution ;


In the plugin folder => woo => open the file "class-wc-cart.php"


Then in the code, find the function : 

 

public function add_cart_item( $cart_item )

 

and transform the line (or put in comment with '//') :

// $final_price = $final_price - $tax_amount;


      

INTO : 

$final_price = $final_price; // TEMPORARY SOLUTION

 

The cart now display the product with good taxes for myself !




(I think it's not a big deal developpers, can you look into the woocommerce 3 if it's not a new name of hook something else ?)

0 Votes


15 Comments

Sorted by
Efbi

Efbi posted almost 7 years ago

I don't have this issue, maybe a conflict or something like that.. 

0 Votes

Caesar

Caesar posted almost 7 years ago

Ok thank you VERY much! This really helps my tax issue.


May I ask if you have the following problems similar to mine?


Clicking Re-Edit doesn't display Add to Cart button, until you remove the design then re-add it:

When I added a designed product to the cart then decide to revise the product by clicking on the "click here to re-edit" link, it takes me back to my design screen which is correct. But, the Add to Cart button is not displayed even though the design is already displayed. Keep in mind that I've already added my  variation options. Because of this, it would force customers to delete the design, then re-add it just to make the Add to Cart button appear so I believe this may be a bug...

0 Votes

Efbi

Efbi posted almost 7 years ago

Yes it's that !


Yes each time you update your plugin, you'll have to do this fix until the author make a new release

0 Votes

Caesar

Caesar posted almost 7 years ago

Ok, I tried the temporary solution and it seems to have fixed the tax issue for me which is really great. I'm new to coding so I'm not sure what this will do in the long term. Should I not update the plugin until there is an official fix?


Here is how I have the block of code setup, please let me know if this is correct:

 

//prices exclusive of tax
		           	if( !wc_prices_include_tax() ) {
			            $tax_rates 		= WC_Tax::get_rates( $product->get_tax_class() );
						$taxes      	= WC_Tax::calc_inclusive_tax( $fpd_data['fpd_product_price'], $tax_rates);
						$tax_amount 	= WC_Tax::get_tax_total( $taxes );
						// $final_price 	= $final_price - $tax_amount;
						$final_price = $final_price; // TEMPORARY SOLUTION
		            }

 


0 Votes

Efbi

Efbi posted almost 7 years ago

It's not in the "includes" folder

It's in the "Woo" folder 


.../wp-content/plugins/fancy-product-designer/woo/class-wc-cart.php

0 Votes

Caesar

Caesar posted almost 7 years ago

I couldn't find this in the php file


I went to /wp-content/plugins/woocommerce/includes/class-wc-cart.php


and couldn't find the code you were referring to.

0 Votes

Efbi

Efbi posted almost 7 years ago Answer

Hi guys, I found a temporary solution ;


In the plugin folder => woo => open the file "class-wc-cart.php"


Then in the code, find the function : 

 

public function add_cart_item( $cart_item )

 

and transform the line (or put in comment with '//') :

// $final_price = $final_price - $tax_amount;


      

INTO : 

$final_price = $final_price; // TEMPORARY SOLUTION

 

The cart now display the product with good taxes for myself !




(I think it's not a big deal developpers, can you look into the woocommerce 3 if it's not a new name of hook something else ?)

0 Votes

Efbi

Efbi posted almost 7 years ago

The bug doesn't appears in the previous version but I can't use it because of woocommerce 3 compatibility ...

0 Votes

Efbi

Efbi posted almost 7 years ago

Same problem here..

0 Votes

O

Ove Brandt posted almost 7 years ago

This is a major problem for me too.
It was fine in the previous version of FPD, but now I can't launch the site before this is fixed.


Our site caters mainly to business customers, and prices without tax is the standard toward business customers in our country. We only show taxes when the customer is a private individual.


If someone has a temporary fix, please tell!

0 Votes

Caesar

Caesar posted almost 7 years ago

As far as I know they're working on it, but I hope there's a fix soon because it's affecting the launching of my site. :(

0 Votes

N

Nathan Stiteler posted almost 7 years ago

Is there any update on this? Unfortunately we only add sales tax to items in a state or two so adding it to the base price isn't really an option for us

0 Votes

D

Deleted Agent posted almost 7 years ago

Yes enter the prices including taxes (and change the settings to that). No I can't give you a specific time, sorry.

0 Votes

Caesar

Caesar posted almost 7 years ago

Ok, is there an estimate on when this will be fixed? Is there a temporary solution until it's fixed?

0 Votes

D

Deleted Agent posted about 7 years ago

At the moment FPD only supports product prices entered including tax - that causes the problem you are describing when the prices are entered without taxes (and that setting is chosen). We re looking at fixing this.

0 Votes

Login or Sign up to post a comment