vuestorefront / vue-storefront-1

The open-source frontend for any eCommerce. Built with a PWA and headless approach, using a modern JS stack. We have custom integrations with Magento, commercetools, Shopware and Shopify and total coverage is just a matter of time. The API approach also allows you to merge VSF with any third-party tool like CMS, payment gateways or analytics. Newest updates: https://blog.vuestorefront.io. Always Open Source, MIT license.
https://www.vuestorefront.io
MIT License
19 stars 13 forks source link

isVirtualCart should allow for custom product types #214

Closed bloodf closed 3 years ago

bloodf commented 3 years ago

From vue-storefront created by rain2o: vuestorefront/vue-storefront#5448

What is the motivation for adding / enhancing this feature?

Currently, the isVirtualCart getter checks if all product types are either downloadable or virtual. I imagine these "types" are not present in all backend platforms (these seem to be specific to Magento, not sure about other systems), but this also restricts virtual products to these types. In Magento at least, you have the ability to create custom Product Types, which can be used quite often for different needs. These types can be "virtual" or physical.

It would be very useful if this getter was more flexible in some way. One idea is to have a configurable array of virtual product types in the config. Another option, though I don't know if this would be applicable to systems outside of Magento, would be to utilize the is_virtual property which already exists on the Quote/Cart object in Magento (and on the Order object). This could be mapped to the state when the cart is synced and used directly, as Magento handles the logic for this value already. But as I said, I don't know that this value is available on all backend systems currently supported by VSF.

What are the acceptance criteria

Version of Vue Storefront

Can you complete this feature request by yourself?

Additional information

I believe the option of using cart.is_virtual is the best option, to avoid unnecessary processing. However, this could very well be a Magento specific attribute on the Cart/Order objects. If we can have some feedback from developers who use other platforms to better inform this decision, that would be greatly helpful to ensure we make a decision that is as platform agnostic as possible, while still being performance-conscious.