0

i have a custom module for shipping methods in magento 2

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

Date-block.html

<script type="text/javascript">
require(
    ['jquery','jquery/ui'],
    //function($) {
      $(document).ready( function() {
        //alert(1);
        // 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 = {
'1101':'4',}
for(var i = 0; i < quote_length; i++) {
           // quoteData[i].name
           //var prep_time = quoteData[i].prep_time; //assumed
           //prep_times.push(prep_time);

           var order_time = quoteData[i].created_at;
           creation_dates.push(order_time);

           var cake_name = quoteData[i].name;
           cake_names.push(cake_name);

           var item_id = quoteData[i].item_id;
           item_ids.push(item_id);

           var prep_time = cakes_prep_time_by_name[cake_name];
           console.log(cake_name+'/'+prep_time);
           prep_times.push(prep_time);
</script>

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 ? – Hassan Ali Shahzad Apr 2 at 10:51
  • Added code........................ – prabhakaran7 Apr 2 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 at 11:21
0

You can use.

alert(quoteData[i].product_id);

I hope it's helpful for you.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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