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
18 stars 13 forks source link

Hooks for cart methodsActions #220

Closed bloodf closed 3 years ago

bloodf commented 3 years ago

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

What is the motivation for adding / enhancing this feature?

It would be beneficial to have hooks in some of the methods actions in the cart module.

Specifically, we have specific validation requirements for our Shipping and Billing addresses. We handle the validation in our checkout address forms, and save the data accordingly in the state. However, when setting the Shipping address in the syncShippingMethods action to our backend, it sends the address in the format which is pre-determined by Vue Storefront. The same for the action syncPaymentMethods. The data in this action currently fails our address validation (we handle validation of this on both front-end and back-end), causing an exception. It could be useful to add a before modifier hook to allow other modules to modify the address data sent to the backend.

This concept would be useful in multiple areas, but at the moment this is the challenge we are facing.

What are the acceptance criteria

Version of Vue Storefront

Can you complete this feature request by yourself?

Additional information