Menu Close
    Hire us Request quote Reading list Switch to dark mode

    How to check if the cart is virtual

    In this blog we will see how to check if the cart is virtual or not in magento 2.

    After adding the products to the cart, when ever we need to check if the products added in the cart is virtual without looping over quote item or doing some other stuffs.

    we will use the Quote object containing the quoted data and use isVirtual method of the quote class.

    Here i will show you how.

    . . .
    Subscribe Articles

    Just enter your email below to subscribe and receive weekly updates about the most interesting similar articles.

    You need to accept conditions to receive letters.
    You've Subscribed!

    Share article via

    . . .
    Now, the return type we are going to get is bool. And perfom our operation using the stuff.

    Thank you for checking this blog.

    Please let me know if you find any issue.

    . . .


    Add Your Comment

    Be the first to comment.

    Back to Top
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again