0

I want to add a sku product selection to the widget, but I can't find how to do it Please tell me how can this be done

1 Answer 1

0

If you need to select the single product you can reuse Magento Chooser in following way

<?xml version="1.0" ?>
<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd">
    <widget id="..." class="...">
        <parameters>
            <parameter name="id_path" xsi:type="block" visible="true" required="true" sort_order="10">
                <label translate="true">Product</label>
                <block class="Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser">
                    <data>
                        <item name="button" xsi:type="array">
                            <item name="open" xsi:type="string">Select Product...</item>
                        </item>
                    </data>
                </block>
            </parameter>
        </parameters>
    </widget>
</widgets>

Where id_path will be in format product/$ID or product/$ID/$CAT_ID

If you want to have like multiply SKUs i think Magento 2, add sku selector to custom widget can help you

1
  • Thanks a lot! I did just that, but I forgot to close the question. I'll leave this here, maybe it will be useful to someone. Commented Jun 24, 2022 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.