How to pass custom option values from product detail page to cart page in Magento 2?How to update product custom options on Cart Page?Check custom options of product is selected or notMagento2 - Getting the selected custom option value for a productHow to store value in custom option field programmatically from cart page?Custom shipping option price is not set in cart pagePass the values to rest api from magento2 checkout pageCustom option selection from checkout/cart in Magento 1.9remove price text from custom option from cart pageHow to create upload image and videos attribute in Admin product detail page in Magento2.2.5?how to pass product page selected value to cart in magento2

Cascading Switches. Will it affect performance?

I have a problematic assistant manager, but I can't fire him

How to trick the reader into thinking they're following a redshirt instead of the protagonist?

If I leave the US through an airport, do I have to return through the same airport?

How can I search for all contacts without email?

US doctor working in Tripoli wants me to open online account

Electricity free spaceship

How to decline a wedding invitation from a friend I haven't seen in years?

Ability To Change Root User Password (Vulnerability?)

How does the Around command at zero work?

Why we don’t make use of the t-distribution for constructing a confidence interval for a proportion?

Can I utilise a baking stone to make crepes?

Let M and N be single-digit integers. If the product 2M5 x 13N is divisible by 36, how many ordered pairs (M,N) are possible?

Why does logistic function use e rather than 2?

Are there any important biographies of nobodies?

What aircraft was used as Air Force One for the flight between Southampton and Shannon?

How to hide an urban landmark?

Is it legal for a bar bouncer to confiscate a fake ID

What ways have you found to get edits from non-LaTeX users?

Getting UPS Power from One Room to Another

New pedal fell off maybe 50 miles after installation. Should I replace the entire crank, just the arm, or repair the thread?

Does the Long March-11 increase its thrust after clearing the launch tower?

What is inside of the 200 star chest?

Overlapping String-Blocks



How to pass custom option values from product detail page to cart page in Magento 2?


How to update product custom options on Cart Page?Check custom options of product is selected or notMagento2 - Getting the selected custom option value for a productHow to store value in custom option field programmatically from cart page?Custom shipping option price is not set in cart pagePass the values to rest api from magento2 checkout pageCustom option selection from checkout/cart in Magento 1.9remove price text from custom option from cart pageHow to create upload image and videos attribute in Admin product detail page in Magento2.2.5?how to pass product page selected value to cart in magento2






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








2















I want to pass custom option values from product detail page to cart page in magento2.



Refer screenshot



enter image description here




I have selected here size: 5 and want to pass the value to cart page.




Here is my code:



<?php
if (!$cartItem):
//echo"Amyyyyyyyyyyyyyyyyyyy";
foreach ($currentProduct->getOptions() as $option)

//echo $option['label'].'=>'. $option['value'].

if ($option->getTitle() == 'Ring Size')
$values = $option->getValues();
$name = "options[" . $option->getId() . "]";
?>
<br>
<div class="drop-down5">
<select name="options" id ="ringSize">
<option>SELECT SIZE</option>
<option value="5">SIZE: 5</option>
<option value="5.5">SIZE: 5.5</option>
<option value="6">SIZE: 6</option>
<option value="6.5">SIZE: 6.5</option>
<option value="7">SIZE: 7</option>
<option value="7.5">SIZE: 7.5</option>
<option value="8">SIZE: 8</option>
<option value="8.5">SIZE: 8.5</option>
<option value="9">SIZE: 9</option>
</select>

<?php echo "<input type= 'hidden' name = " . $name . " id = 'ringSizeText' > "; ?>

</div>
<?php


endif;
?>



In checkout cart page default.phtml




<?php if ($_options = $block->getOptionList()): 
?>
<?php foreach ($_options as $_option) : ?>
<?php if($helper_sdi->isInEngravingCustomOptions($_option['label'])) continue; ?>
<?php $_formatedOptionValue = $this->getFormatedOptionValue($_option); ?>
<?php endforeach; ?>
<?php endif; ?>


<!--Foreach statement code start-->
<?php if(!empty($_formatedOptionValue))

?>
<section class="grid-3-3 no-padding-right ring-size" style="text-align: center;">
<?php if ($_options = $block->getOptionList()): ?>
<dl class="item-options">
<?php foreach ($_options as $_option) : ?>
<?php if($helper_sdi->isInEngravingCustomOptions($_option['label'])) continue; ?>
<?php $_formatedOptionValue = $block->getFormatedOptionValue($_option);
//print_r($_formatedOptionValue);
?>
<dt><?php echo $block->escapeHtml($_option['label']) ?></dt>
<dd style="margin: 20px 0 0px 0;"
<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?> >
<?php echo $_formatedOptionValue['value'] ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif; ?>
</section>
<?php ?>
<p>fjhguityguihgjnhgf</p>


please someone help where I am making mistake.



Any help would be appreciated.










share|improve this question
























  • are you getting any error or warnings?

    – Chintan Kaneriya
    Jun 1 at 12:32











  • No, I am not getting any errors

    – Amy
    Jun 1 at 13:03

















2















I want to pass custom option values from product detail page to cart page in magento2.



Refer screenshot



enter image description here




I have selected here size: 5 and want to pass the value to cart page.




Here is my code:



<?php
if (!$cartItem):
//echo"Amyyyyyyyyyyyyyyyyyyy";
foreach ($currentProduct->getOptions() as $option)

//echo $option['label'].'=>'. $option['value'].

if ($option->getTitle() == 'Ring Size')
$values = $option->getValues();
$name = "options[" . $option->getId() . "]";
?>
<br>
<div class="drop-down5">
<select name="options" id ="ringSize">
<option>SELECT SIZE</option>
<option value="5">SIZE: 5</option>
<option value="5.5">SIZE: 5.5</option>
<option value="6">SIZE: 6</option>
<option value="6.5">SIZE: 6.5</option>
<option value="7">SIZE: 7</option>
<option value="7.5">SIZE: 7.5</option>
<option value="8">SIZE: 8</option>
<option value="8.5">SIZE: 8.5</option>
<option value="9">SIZE: 9</option>
</select>

<?php echo "<input type= 'hidden' name = " . $name . " id = 'ringSizeText' > "; ?>

</div>
<?php


endif;
?>



In checkout cart page default.phtml




<?php if ($_options = $block->getOptionList()): 
?>
<?php foreach ($_options as $_option) : ?>
<?php if($helper_sdi->isInEngravingCustomOptions($_option['label'])) continue; ?>
<?php $_formatedOptionValue = $this->getFormatedOptionValue($_option); ?>
<?php endforeach; ?>
<?php endif; ?>


<!--Foreach statement code start-->
<?php if(!empty($_formatedOptionValue))

?>
<section class="grid-3-3 no-padding-right ring-size" style="text-align: center;">
<?php if ($_options = $block->getOptionList()): ?>
<dl class="item-options">
<?php foreach ($_options as $_option) : ?>
<?php if($helper_sdi->isInEngravingCustomOptions($_option['label'])) continue; ?>
<?php $_formatedOptionValue = $block->getFormatedOptionValue($_option);
//print_r($_formatedOptionValue);
?>
<dt><?php echo $block->escapeHtml($_option['label']) ?></dt>
<dd style="margin: 20px 0 0px 0;"
<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?> >
<?php echo $_formatedOptionValue['value'] ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif; ?>
</section>
<?php ?>
<p>fjhguityguihgjnhgf</p>


please someone help where I am making mistake.



Any help would be appreciated.










share|improve this question
























  • are you getting any error or warnings?

    – Chintan Kaneriya
    Jun 1 at 12:32











  • No, I am not getting any errors

    – Amy
    Jun 1 at 13:03













2












2








2








I want to pass custom option values from product detail page to cart page in magento2.



Refer screenshot



enter image description here




I have selected here size: 5 and want to pass the value to cart page.




Here is my code:



<?php
if (!$cartItem):
//echo"Amyyyyyyyyyyyyyyyyyyy";
foreach ($currentProduct->getOptions() as $option)

//echo $option['label'].'=>'. $option['value'].

if ($option->getTitle() == 'Ring Size')
$values = $option->getValues();
$name = "options[" . $option->getId() . "]";
?>
<br>
<div class="drop-down5">
<select name="options" id ="ringSize">
<option>SELECT SIZE</option>
<option value="5">SIZE: 5</option>
<option value="5.5">SIZE: 5.5</option>
<option value="6">SIZE: 6</option>
<option value="6.5">SIZE: 6.5</option>
<option value="7">SIZE: 7</option>
<option value="7.5">SIZE: 7.5</option>
<option value="8">SIZE: 8</option>
<option value="8.5">SIZE: 8.5</option>
<option value="9">SIZE: 9</option>
</select>

<?php echo "<input type= 'hidden' name = " . $name . " id = 'ringSizeText' > "; ?>

</div>
<?php


endif;
?>



In checkout cart page default.phtml




<?php if ($_options = $block->getOptionList()): 
?>
<?php foreach ($_options as $_option) : ?>
<?php if($helper_sdi->isInEngravingCustomOptions($_option['label'])) continue; ?>
<?php $_formatedOptionValue = $this->getFormatedOptionValue($_option); ?>
<?php endforeach; ?>
<?php endif; ?>


<!--Foreach statement code start-->
<?php if(!empty($_formatedOptionValue))

?>
<section class="grid-3-3 no-padding-right ring-size" style="text-align: center;">
<?php if ($_options = $block->getOptionList()): ?>
<dl class="item-options">
<?php foreach ($_options as $_option) : ?>
<?php if($helper_sdi->isInEngravingCustomOptions($_option['label'])) continue; ?>
<?php $_formatedOptionValue = $block->getFormatedOptionValue($_option);
//print_r($_formatedOptionValue);
?>
<dt><?php echo $block->escapeHtml($_option['label']) ?></dt>
<dd style="margin: 20px 0 0px 0;"
<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?> >
<?php echo $_formatedOptionValue['value'] ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif; ?>
</section>
<?php ?>
<p>fjhguityguihgjnhgf</p>


please someone help where I am making mistake.



Any help would be appreciated.










share|improve this question
















I want to pass custom option values from product detail page to cart page in magento2.



Refer screenshot



enter image description here




I have selected here size: 5 and want to pass the value to cart page.




Here is my code:



<?php
if (!$cartItem):
//echo"Amyyyyyyyyyyyyyyyyyyy";
foreach ($currentProduct->getOptions() as $option)

//echo $option['label'].'=>'. $option['value'].

if ($option->getTitle() == 'Ring Size')
$values = $option->getValues();
$name = "options[" . $option->getId() . "]";
?>
<br>
<div class="drop-down5">
<select name="options" id ="ringSize">
<option>SELECT SIZE</option>
<option value="5">SIZE: 5</option>
<option value="5.5">SIZE: 5.5</option>
<option value="6">SIZE: 6</option>
<option value="6.5">SIZE: 6.5</option>
<option value="7">SIZE: 7</option>
<option value="7.5">SIZE: 7.5</option>
<option value="8">SIZE: 8</option>
<option value="8.5">SIZE: 8.5</option>
<option value="9">SIZE: 9</option>
</select>

<?php echo "<input type= 'hidden' name = " . $name . " id = 'ringSizeText' > "; ?>

</div>
<?php


endif;
?>



In checkout cart page default.phtml




<?php if ($_options = $block->getOptionList()): 
?>
<?php foreach ($_options as $_option) : ?>
<?php if($helper_sdi->isInEngravingCustomOptions($_option['label'])) continue; ?>
<?php $_formatedOptionValue = $this->getFormatedOptionValue($_option); ?>
<?php endforeach; ?>
<?php endif; ?>


<!--Foreach statement code start-->
<?php if(!empty($_formatedOptionValue))

?>
<section class="grid-3-3 no-padding-right ring-size" style="text-align: center;">
<?php if ($_options = $block->getOptionList()): ?>
<dl class="item-options">
<?php foreach ($_options as $_option) : ?>
<?php if($helper_sdi->isInEngravingCustomOptions($_option['label'])) continue; ?>
<?php $_formatedOptionValue = $block->getFormatedOptionValue($_option);
//print_r($_formatedOptionValue);
?>
<dt><?php echo $block->escapeHtml($_option['label']) ?></dt>
<dd style="margin: 20px 0 0px 0;"
<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?> >
<?php echo $_formatedOptionValue['value'] ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif; ?>
</section>
<?php ?>
<p>fjhguityguihgjnhgf</p>


please someone help where I am making mistake.



Any help would be appreciated.







magento2 checkout cart custom-options dropdown-options






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 1 at 10:11









liz cap

225




225










asked Jun 1 at 7:31









AmyAmy

40510




40510












  • are you getting any error or warnings?

    – Chintan Kaneriya
    Jun 1 at 12:32











  • No, I am not getting any errors

    – Amy
    Jun 1 at 13:03

















  • are you getting any error or warnings?

    – Chintan Kaneriya
    Jun 1 at 12:32











  • No, I am not getting any errors

    – Amy
    Jun 1 at 13:03
















are you getting any error or warnings?

– Chintan Kaneriya
Jun 1 at 12:32





are you getting any error or warnings?

– Chintan Kaneriya
Jun 1 at 12:32













No, I am not getting any errors

– Amy
Jun 1 at 13:03





No, I am not getting any errors

– Amy
Jun 1 at 13:03










0






active

oldest

votes












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%2f276946%2fhow-to-pass-custom-option-values-from-product-detail-page-to-cart-page-in-magent%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















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%2f276946%2fhow-to-pass-custom-option-values-from-product-detail-page-to-cart-page-in-magent%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