Write a little bit of code for my custom magento2 system
Project detail
OK so I am a php developer but I am struggling with a simple thing in magento2 I have written a custom php app for my client and I am struggling to add some code to add a product to the cart with a custom option .
Here is the code so you can see :
############ ADD SIMPLE PRODUCT NO OPTIONS
if ($_GET[‘process’] == ‘add’) {
$productId = $_GET[‘PID’];
$product = $objectManager->create(‘MagentoCatalogModelProduct’)->load($productId);
$quoteItem = $quote->addProduct($product);
$quoteItem->setQty($_GET[‘QTY’]);
//// your job is to add some code here to add the product to the quote with selected options by id !!!!!
if($CP>0) {
$quoteItem->setIsSuperMode(true);
$quoteItem->setCustomPrice($CP);
$quoteItem->setPrice($CP);
$quoteItem->setFinalPrice($CP);
$quoteItem->setData(‘price’, $CP);
$quoteItem->setOriginalCustomPrice($CP);
}
$quote->collectTotals();
$quote->save();
}
Once I find someone I will give them full access to the system to work on it. If you are any good I will for sure be able to give you more work too