duncanmcclean / simple-commerce

A simple, yet powerful e-commerce addon for Statamic.
https://statamic.com/addons/duncanmcclean/simple-commerce
Other
143 stars 36 forks source link

[5.x] Refactor product variants fieldtype to support field conditionals #917

Closed duncanmcclean closed 11 months ago

duncanmcclean commented 11 months ago

This pull request refactors the Product Variants fieldtype to support field conditions.

I spent quite a lot of time trying to make the existing one-component-for-everything setup work but in the end, once I split each of the options into its own Vue component, it was easy to make field conditionals work.

Field conditionals use a mixin called FieldConditions, which checks this.value on the component for the different fields. This obviously wouldn't work with the "mega component" we had before.

In this PR, I've also made some minor UI tweaks following Statamic 4.

Fixes #913

github-actions[bot] commented 11 months ago

Released as part of v5.4.0.