Extension point for set website ids product in case admin not set websiteHow to get the URL for the B2C website/storeview from a B2B website/storeview/product-pageMagento 2: Default REST API unable to update product data to multiple storesHow can I rewrite URL which can help for SEO with multiwebsite?Magento 2.1 Create a filter in the product grid by new attributeMagento2 : how to set per website is_required custom attribute for account creation formmysql deadlock when saving product with website ids through console commandMagento 2 Plugin for Contact Form Post ControllerMagento 2: I Want to add multiple product using checkboxI have created one field using product form field for my price i want save my field value at product creation time from backend magento2Get Quote Item's Selected Custom Options

How do I exit BASH while loop using modulus operator?

What is the most common color to indicate the input-field is disabled?

How to Prove P(a) → ∀x(P(x) ∨ ¬(x = a)) using Natural Deduction

Avoiding the "not like other girls" trope?

Am I breaking OOP practice with this architecture?

Can I hook these wires up to find the connection to a dead outlet?

Could the museum Saturn V's be refitted for one more flight?

Theorists sure want true answers to this!

How to remove border from elements in the last row?

What is required to make GPS signals available indoors?

How badly should I try to prevent a user from XSSing themselves?

files created then deleted at every second in tmp directory

OP Amp not amplifying audio signal

Ambiguity in the definition of entropy

What are the G forces leaving Earth orbit?

What exactly is ineptocracy?

How can saying a song's name be a copyright violation?

Finitely generated matrix groups whose eigenvalues are all algebraic

Send out email when Apex Queueable fails and test it

What historical events would have to change in order to make 19th century "steampunk" technology possible?

How to stretch the corners of this image so that it looks like a perfect rectangle?

Forgetting the musical notes while performing in concert

How to install cross-compiler on Ubuntu 18.04?

Why was Sir Cadogan fired?



Extension point for set website ids product in case admin not set website


How to get the URL for the B2C website/storeview from a B2B website/storeview/product-pageMagento 2: Default REST API unable to update product data to multiple storesHow can I rewrite URL which can help for SEO with multiwebsite?Magento 2.1 Create a filter in the product grid by new attributeMagento2 : how to set per website is_required custom attribute for account creation formmysql deadlock when saving product with website ids through console commandMagento 2 Plugin for Contact Form Post ControllerMagento 2: I Want to add multiple product using checkboxI have created one field using product form field for my price i want save my field value at product creation time from backend magento2Get Quote Item's Selected Custom Options













0















This is my scenario I have hidden website_ids field in product form (default magento show it)
So how i can use plugin for set website ids for product when it create. Is there any entry-point to do this



My goal is if not website ids available when post data so init default website ids for product



Added modifier for modify Form:



public function modifyMeta(array $meta)

$this->_meta = unset($meta['websites']);
return $this->_meta;










share|improve this question




























    0















    This is my scenario I have hidden website_ids field in product form (default magento show it)
    So how i can use plugin for set website ids for product when it create. Is there any entry-point to do this



    My goal is if not website ids available when post data so init default website ids for product



    Added modifier for modify Form:



    public function modifyMeta(array $meta)

    $this->_meta = unset($meta['websites']);
    return $this->_meta;










    share|improve this question


























      0












      0








      0








      This is my scenario I have hidden website_ids field in product form (default magento show it)
      So how i can use plugin for set website ids for product when it create. Is there any entry-point to do this



      My goal is if not website ids available when post data so init default website ids for product



      Added modifier for modify Form:



      public function modifyMeta(array $meta)

      $this->_meta = unset($meta['websites']);
      return $this->_meta;










      share|improve this question
















      This is my scenario I have hidden website_ids field in product form (default magento show it)
      So how i can use plugin for set website ids for product when it create. Is there any entry-point to do this



      My goal is if not website ids available when post data so init default website ids for product



      Added modifier for modify Form:



      public function modifyMeta(array $meta)

      $this->_meta = unset($meta['websites']);
      return $this->_meta;







      magento2 product plugin multi-website






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 18 hours ago









      Ashish Viradiya

      1,0811830




      1,0811830










      asked Mar 30 at 5:27









      mrtuvnmrtuvn

      1,88411829




      1,88411829




















          1 Answer
          1






          active

          oldest

          votes


















          0














          I post my answer here in case someone in future may need



          Create di.xml file for prepare plugin class



          <type name="MagentoCatalogControllerAdminhtmlProductInitializationHelper">
          <plugin name="updateProductWebsiteIds" type="NamespaceModulePluginControllerProductInitializationHelperWebsitePlugin" sortOrder="40" />
          </type>


          original class here



          Add new file Class WebsitePlugin



          public function afterInitialize(
          MagentoCatalogControllerAdminhtmlProductInitializationHelper $subject,
          MagentoCatalogModelProduct $product
          )
          if (Add your logic check here && isset($product))
          if (!$product->getWebsiteIds())
          $defaultWebsiteId = $this->storeManager->getDefaultStoreView()->getWebsiteId();
          $websitesIds = [$defaultWebsiteId];
          $product->setWebsiteIds($websitesIds);


          return $product;






          share|improve this answer

























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "479"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268028%2fextension-point-for-set-website-ids-product-in-case-admin-not-set-website%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I post my answer here in case someone in future may need



            Create di.xml file for prepare plugin class



            <type name="MagentoCatalogControllerAdminhtmlProductInitializationHelper">
            <plugin name="updateProductWebsiteIds" type="NamespaceModulePluginControllerProductInitializationHelperWebsitePlugin" sortOrder="40" />
            </type>


            original class here



            Add new file Class WebsitePlugin



            public function afterInitialize(
            MagentoCatalogControllerAdminhtmlProductInitializationHelper $subject,
            MagentoCatalogModelProduct $product
            )
            if (Add your logic check here && isset($product))
            if (!$product->getWebsiteIds())
            $defaultWebsiteId = $this->storeManager->getDefaultStoreView()->getWebsiteId();
            $websitesIds = [$defaultWebsiteId];
            $product->setWebsiteIds($websitesIds);


            return $product;






            share|improve this answer





























              0














              I post my answer here in case someone in future may need



              Create di.xml file for prepare plugin class



              <type name="MagentoCatalogControllerAdminhtmlProductInitializationHelper">
              <plugin name="updateProductWebsiteIds" type="NamespaceModulePluginControllerProductInitializationHelperWebsitePlugin" sortOrder="40" />
              </type>


              original class here



              Add new file Class WebsitePlugin



              public function afterInitialize(
              MagentoCatalogControllerAdminhtmlProductInitializationHelper $subject,
              MagentoCatalogModelProduct $product
              )
              if (Add your logic check here && isset($product))
              if (!$product->getWebsiteIds())
              $defaultWebsiteId = $this->storeManager->getDefaultStoreView()->getWebsiteId();
              $websitesIds = [$defaultWebsiteId];
              $product->setWebsiteIds($websitesIds);


              return $product;






              share|improve this answer



























                0












                0








                0







                I post my answer here in case someone in future may need



                Create di.xml file for prepare plugin class



                <type name="MagentoCatalogControllerAdminhtmlProductInitializationHelper">
                <plugin name="updateProductWebsiteIds" type="NamespaceModulePluginControllerProductInitializationHelperWebsitePlugin" sortOrder="40" />
                </type>


                original class here



                Add new file Class WebsitePlugin



                public function afterInitialize(
                MagentoCatalogControllerAdminhtmlProductInitializationHelper $subject,
                MagentoCatalogModelProduct $product
                )
                if (Add your logic check here && isset($product))
                if (!$product->getWebsiteIds())
                $defaultWebsiteId = $this->storeManager->getDefaultStoreView()->getWebsiteId();
                $websitesIds = [$defaultWebsiteId];
                $product->setWebsiteIds($websitesIds);


                return $product;






                share|improve this answer















                I post my answer here in case someone in future may need



                Create di.xml file for prepare plugin class



                <type name="MagentoCatalogControllerAdminhtmlProductInitializationHelper">
                <plugin name="updateProductWebsiteIds" type="NamespaceModulePluginControllerProductInitializationHelperWebsitePlugin" sortOrder="40" />
                </type>


                original class here



                Add new file Class WebsitePlugin



                public function afterInitialize(
                MagentoCatalogControllerAdminhtmlProductInitializationHelper $subject,
                MagentoCatalogModelProduct $product
                )
                if (Add your logic check here && isset($product))
                if (!$product->getWebsiteIds())
                $defaultWebsiteId = $this->storeManager->getDefaultStoreView()->getWebsiteId();
                $websitesIds = [$defaultWebsiteId];
                $product->setWebsiteIds($websitesIds);


                return $product;







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 18 hours ago

























                answered 18 hours ago









                mrtuvnmrtuvn

                1,88411829




                1,88411829



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268028%2fextension-point-for-set-website-ids-product-in-case-admin-not-set-website%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

                    Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                    Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form