Search code examples
shopwareshopware6

Which event should be using for save product in administrator interface?


I want add some adjustments when I edit a single product in administrator. Which event should I use for that (on save product)?

Could you give me an example?


Solution

  • You may want to override the sw-product-detail component and the onSave method to make some changes prior to calling the original method.

    Shopware.Component.override('sw-product-detail', {
        methods: {
            onSave() {
                this.product.somePropertyToChange = 'foobar';
                
                this.$super('onSave');
            }
        }
    });