My cart shows wrong subtotal and tax - php

My cart shows wrong subtotal and I think this is also affecting calculation of tax (20%). In the shopping cart and in the checkout, price displayed are correct but subtotal and total have no 20% VAT TAX effect on it.
Any idea what could be the problem?

In the admin panel you can set whether totals and prices are shown with/without tax, go to:
System->Configuration->Sales->Tax
Amongst other things, you can set
Display Prices
Display Subtotal
Display Shipping Amount
To be including tax, excluding tax or including and excluding tax, and
Include Tax In Grand Total
Display Full Tax Summary
Display Zero Tax Subtotal
to be yes or no for places like the cart, the invoice, etc.

Related

WooCommerce override "Tax Included In Price" setting for user role?

We've got a custom user role called "Trade Customer."
For normal customers, the price is set in the system as INCLUDING tax - so £59.99 is the price including tax. For Trade Customers, the price is imported from an external system and for example would be £15.00 and that's NOT INCLUDING tax.
Under WooCommerce > Settings > Tax we've got the Prices entered with tax option set to Yes, I will enter prices inclusive of tax.
The tax band is 20%.
So when a customer buys the £59.99 item at the cart it shows £47.99 + £12 TAX.
With a trade customer, we want this to work the other way round, so the price in the store is £15.00, then when they get to the checkout it shows £15.00 + £3 TAX for a total of £18.
We've tried the following code to change the tax to show at the cart for Trade Users:
// Change tax setting for trade
function s9_override_tax_settings_trade( $value ) {
if ( s9_has_user_role('trade_customer') ) {
return 'excl';
}
return $value;
}
add_filter( 'pre_option_woocommerce_tax_display_shop', 's9_override_tax_settings_trade' );
add_filter( 'pre_option_woocommerce_tax_display_cart', 's9_override_tax_settings_trade' );
The problem is, this only inverts the price so instead of showing £15.00 + £3 VAT, it shows £12.00 + £3 VAT when we want it to show £15.00 + £3 VAT.
We effectively need to override the Prices entered with tax option of Yes, I will enter prices inclusive of tax to No, I will enter prices exclusive of tax but only for trade customers but I can't seem to find a filter for this.
Any ideas on how this can be achieved?

Woocommerce tax calculation for coexistence of products incl VAT and excl VAT

Working with Woocommerce I have the following issue:
The shop consists of products with prices the incl VAT and exclude VAT.
All of the products have the same VAT of 19%.
Unfortuantely in Woocommerce you can only choose between include VAT in your prices and exclude VAT in your prices.
As I use a PDF Invoice Plugin I need woocommerce to distinguish between two calculations that should look like that in the end.
order calculation for a prod with price set excl VAT:
Product#1 2,00€
subtotal 2,00€
+ 19% VAT 0,38€
TOTAL. 2,38€
order calculation for a prod with price set incl VAT:
Product#2 3,50€
subtotal 2,94€
+ 19% VAT 0,56€
TOTAL. 3,50€
I really have no idea how to solve this as I depend on this to finish the shop for my client. Any help is welcome.
Please not that this is not about how the product is displayed in the shop, but how the information might look when in shop_order.

Apply Coupon code discount to the final order total

We sell trails and the trails are "products" in WooCommerce. >>
Check this link
Try clicking on the "Let's Play" link and it will take you to the checkout. >> (Screenshot)
The price of each trail is set to zero (in WooCommerce admin) because the pricing is "per person".
We had to use the following code snippet to make the products "work", with the "$0" price.
add_filter( 'woocommerce_is_purchasable', 'wpa_109409_is_purchasable', 10, 2 );
function wpa_109409_is_purchasable( $purchasable, $product ){
if( $product->get_price() >= 0 )
$purchasable = true;
return $purchasable;
}
After making the products "work", with the "$0" price, we successfully added some required fields on the checkout page which are used for adding a "fee" for every "person", the visitor will select.
The order total will only update when the user will select the number of players field on the checkout page, notice the "Select No of Players" options.
(Screenshot)
The Issue:
Whenever we apply a "Coupon" (For example "enjoy10" - 10% discount), it only applies to the product price, which is currently set-to "$0".
(Check this Screen Record)
So, technically, the coupon code doesn't work and applied only "$0" discount because the coupon doesn't apply on the order total, it only applies to the product price, which is set to "$0", because we're charging on a per person basis.
I want the coupon code to apply to the final order total, not just the product price.
In default, the coupon will be applied to subtotal or on the product price. Subtotal means the total amount of product.
When you submit some additional fields in the checkout, the additional amount will be added as fee in WooCommerce. The fee is the same as the coupon. Using fee, we can increase or reduce the total amount. When we apply a coupon, WooCommerce applies a negative fee on the subtotal and that so the total amount is reduced.
The options possible are either change your coupon amount as per the latest fee or add a negative fee (additional discount) for the checkout field fee by calculating the amount of coupon.

Magento get final price with Cart discount

I am working with cross-selling on my shopping cart page.
I have two products: #001 and #002.
Currently, if product #001 is in the cart, the upsell will display a message about #002.
I would like to get #002's finalPrice-(cart rules), so that the price is displayed with the discount, based on the fact that product #001 is in the cart.
How can I subtract the cart discount given on #002?
Currently, with getFinalPrice(), the full price "499,-" is displayed, even though #001 is added to the cart, and has rules that tells #002 to have 50% discount.

Magento Tax - Custom calculation

I have products added to my Magento store with 20% tax included.
I have a store view that is shown to USA customers.
I require the price to remain the same, but hide the Tax in the cart/orders. Also I need to double the tax and show it, if they are in the USA but their shipping address is not.
Examples:
Normal price £10 (inc £2 tax)
USA price: $10 (no reference of tax/$0 tax)
USA price but shipping to another country: $12 (inc $2 tax)
I have the prices working as required, I just need some help as to where I can hide the tax and also double it depending on shipping country.
In Magento admin, in the Promotion menu, there are the so called "Shopping Cart Tax Rules" and "Catalog Price Rules". Here you can set taxes to Countries, Customers, Categories, etc.
Also in System->Configuration->Taxes (if I remember well) there are some settings regarding the display of taxes.
Have you tried any of these?

Categories