/** * Add custom options to buy request. * * @param CartItemInterface $cartItem * @param \Magento\Framework\DataObject|float $params * @return \Magento\Framework\DataObject|float */ private function addCustomOptionsToBuyRequest(CartItemInterface $cartItem, $params) { if (isset($this->cartItemProcessors['custom_options'])) { $buyRequestUpdate = $this->cartItemProcessors['custom_options']->convertToBuyRequest($cartItem); if (!$buyRequestUpdate) { return $params; } if ($params instanceof \Magento\Framework\DataObject) { $buyRequestUpdate->addData($params->getData()); } else { if (is_numeric($params)) { $buyRequestUpdate->setData('qty', $params); } } return $buyRequestUpdate; } return $params; }