How to save state of the custom block while saving the product?

Hi everyone! I will be grateful for your advice!
I need to save state of the custom switch in the product.
To the file sw-product-basic-form.html.twig i added this switch. When the state of the switch changes it shows or hides the block. By default the block is hidden. This is switch code.

But when the product is saved, the state of the switch is not saved. I suggested that need to rewrite the function onSave().
I found a file app/administration/src/module/sw-product/page/sw-product-detail/state.js . If I understand correctly (but this is most likely a mistake ) it stores the states of the different parts of the product. So i add in state qrCode: {} and in loading - qrCode: false. Then i add a mutation

    setQrCode(state, newQrCode) {
        state.qrCode = newQrCode;

Then in file app/administration/src/module/sw-product/page/sw-product-detail/index.js i added a call to my custom state

    loadQrFeature() {
        Shopware.State.commit('swProductDetail/setLoading', ['qrCode', true]);

        return, Shopware.Context.api).then((res) => {
            Shopware.State.commit('swProductDetail/qrCode', res);
        }).then(() => {
            Shopware.State.commit('swProductDetail/setLoading', ['qrCode', false]);

and add criteria for this one

    customQrCodeCriteria() {
        const criteria = new Criteria(1, 1);
        return criteria;

And declared this function in createState() function promise. But it didn’t work.

The task itself is not difficult, but I’m confused. As I said at the beginning - I will be grateful for advice and hints on how to do it right.