1

I want to add product to cart with some product already create custom option values put. So what happen current magento create new product in cart while same product different custom options or values. I need same product but values increment.

Product in already created 2 custom options and not required so Add to cart before I want to put both custom options custom values. thanks

0

You can use catalog_product_type_prepare_full_options event to add custom option before adding product into cart.

In this event you will get product object like this,

$product = $observer->getEvent()->getProduct();

and then you can set your custom condition If its satisfy then you can add your custom option

      if (someconditon == true) {
        $infoOptions[] = array(
            'label' => "YOUR_LABEL",
            'value' => "YOUR_VALUE",
        );
        $product->addCustomOption('additional_options', serialize($infoOptions));
    }

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.