i have a custom module for shipping methods in magento 2

i need to get config product id in the cart list using jquery


<script type="text/javascript">
    //function($) {
      $(document).ready( function() {
        // read checkoutconfig
        var quoteData = checkoutConfig.quoteItemData,
          quote_length = quoteData.length,
          prep_times = [],
          creation_dates = [],
          cake_names = [],
          item_ids = [];

        // Manually prepare this list either by cake name or by item id

        var cakes_prep_time_by_name = {
for(var i = 0; i < quote_length; i++) {
           // quoteData[i].name
           //var prep_time = quoteData[i].prep_time; //assumed

           var order_time = quoteData[i].created_at;

           var cake_name = quoteData[i].name;

           var item_id = quoteData[i].item_id;

           var prep_time = cakes_prep_time_by_name[cake_name];

when i go to check out i need to get all configurable products ids and new custom attribute

any one have idea???

  • share your code where you want this config mean configurable product id ? Apr 2, 2019 at 10:51
  • Added code........................ Apr 2, 2019 at 10:56
  • I would suggest to use window.checkoutConfig functionality. I am not sure what you exactly wanted by you may refer this link. magestore.com/magento-2-tutorial/…
    – Yash Shah
    Apr 2, 2019 at 11:21

2 Answers 2


You can use.


I hope it's helpful for you.

  • how i can get custom product attribute value in magento 2 Apr 6, 2019 at 8:14
  • Can you please give me your url ? Apr 6, 2019 at 8:16

I needed this for a tamper monkey script, and feel this might help you compile what you need or extend the logic, to get the product id from a given shopping cart item within the checkout using jQuery and knockout in tandem.

// Load the contexts when needed
let jQuery = require('jquery');
let ko = require('knockout');

// use jQuery to get all the items in the shopping cart. 
// Change the selector if your checkout plugin uses different stylings.
jQuery('.checkout-product__name-qty').each((i,e) => 
    // Get the knockout context for the given checkout element.
    let context = ko.contextFor(e);

    // The actual quote item data is in the parent of the selected element that I chose to target.
    let quote_item_id = ko.contextFor(e).$parent.item_id;

    // Get the checkoutConfig quote item data
    let quote_data = window.checkoutConfig.quoteItemData;

    // Filter out our quote item
    let quote_item = quote_data.filter((item) => {return parseInt(item.item_id) === quote_item_id}).pop();
    // get the product ID from the quote item.
    let product_id = quote_item.product.entity_id;

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.