Magento calculate the subtotal based on the undiscounted value, how fix it?

Job ID: 32177803

Budget: $10 – $75 USD

In magento I've set freeshipping(not based on cart rule) for order amount greater than 100.

Now I have a coupon code that will apply 100% discount on a particular product if added to cart.

for example:
PRODUCT A (the one that trigger discount) = 50€
PRODUCT B = 70€

subtotal before apply coupon = 120€
after coupon applied = 70€

My problem is that Magento calculate the subtotal based on the undiscounted value and will apply freeshipping, while in truth it should apply normal shipping because the final amount is 70€.

Seems lot of people are facing this "issue"

https://stackoverflow.com/questions/11393617/magento-free-shipping-shopping-cart-rule-to-be-applied-after-discount

https://magento.stackexchange.com/questions/208087/to-calculate-shipping-charge-after-discount-is-applied

Can you guys help me on this?

Thanks in advance
Related categories: PHP Magento MySQL Plugin Magento 2