How do I obtain the value of an order (cart) without taxes, shipping order and voucher discounts?

I am trying to develop a module that calculates the value of a parameter and shows it in a page. (I am 95% sure that I need the value that is shown by default in cart subtotal at the cart checkout) How can I obtain that value and calculate it in a controller? (How do I obtain the value of the tax, shipping order and the voucher discount, cart subtotal). Are there differences between where the parameters are saved in the database based on the extensions that the user had installed?


I do not recommend that you use object manager but this is how to get the cart sub total within your controller

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$cart = $objectManager->get('\Magento\Checkout\Model\Cart'); 

// get quote items collection
$itemsCollection = $cart->getQuote()->getSubtotal();

Similar questions

Promotions and Discounts are not applied in custom shipping method (module)
I created a module that calculates the delivery price according to the price of the item and it works well. However promotions (Example: Free Shipping by categories or number of items) and discounts are not applied in my custom shipping method (module). How can I make the promotions are applied in my custom shipping method? PS: The promotions are a...
Setting magento voucher rules on the admin backend
basically if a user has added two products on cart he is allowed to add two vouchers, and i've done that part but when a product that was added on basket has been removed by the user the voucher still exist on cart. can i use voucher rules to solve this problem?
Voucher generated code giving store credit/userpoints
I am looking into how to integrate vouchers and give specific users store credit, for each voucher code they type in. The steps/logic would be Voucher generated Customer at checkout inputs voucher generated code Specific user tied to that voucher gets x% store credit/userpoints on their account. Is there any way to do this easily in Magento, or kno...
trying to limit products that a customer can buy with a voucher code , not working
I've been trying to create a voucher code . i want to limit the products discount to 3 per person (so that the 100 % discount would be valid only on 3 products ) but for some reason it makes the whole SKU on the voucher code list discounted , it should be just maximum 3 products not all of them . please view
20% off a product with a voucher
I am sure its possible but can't see how its done. I would like to set up a promotion where a customer gets 20% off a sku if they enter in a promotion code. I presume I need to use "Percentage of a price discount" and set the shopping cart rule to be 20% and but it seems to be taking 20% off every product and not just the 1 SKU I want it to take of...
Magento 2 - Changing "enter coupon here" to "Enter coupon or voucher here"
I'd like to change placeholder on the coupon field from "enter coupon here" to "enter coupon or voucher here". I've enabled template hints but couldn't find out what template it's pulling from.

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.