0

I have attached screenshot, I want to add default values in position, for example when I add product in category position should show 100. Thanks in advance

enter image description here

1 Answer 1

0

I have set my default position for products to 100 by using this patch. This sets it to 100 when a product is added to a new category.

    @package magento/module-catalog

diff --git a/Controller/Adminhtml/Product/Initialization/Helper.php b/Controller/Adminhtml/Product/Initialization/Helper.php
--- a/Controller/Adminhtml/Product/Initialization/Helper.php
+++ b/Controller/Adminhtml/Product/Initialization/Helper.php    (date 1666682384544)
@@ -513,7 +513,7 @@
             $categoryLink = $categoryLinks[$categoryId] ??
                 $this->categoryLinkFactory->create()
                     ->setCategoryId($categoryId)
-                    ->setPosition(0);
+                    ->setPosition(100);
             $newCategoryLinks[] = $categoryLink;
         }
 
1
  • Thanks, but I had done this I was overriden some magento core functionalities. Oct 25, 2022 at 10:36

Your Answer

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

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