I have a specific product that customers have made preorders for. Those who have preordered the product get it at a lower price. They can also order more products at the regular price.

The pre-ordered products are programatically added to the cart when the customer logs in. I'm using a a custom option to indicate whether a product is a preordered and in which preorder group (all having different pricing) the product belongs.

So far so good. But now, if the customer himself adds products to cart, he is not allowed to set the preorder product option. It would be best to hide this selection completely in the front end or force it to a specific value.

How can I do this? There are no default values for custom options and no read-only options (or at least not in the backend UI).

It is mandatory to have only one product, it is not possible to separate the preorder and normal products (due to shipping center integration).

In other words: I have several values for a custom option. Only one is available for customers that add the product to cart themselves, others are for when the product is added programatically. How do I prevent the customer from choosing the custom option value in the front end?

I'm aware that I can use observer to set the correct value for the custom option to the product in cart, but that would be confusing and bad UX. This is not what I want.

1 Answer 1


If the custom option is only set programmatically, you don't need to define it in the backend at all.

You can add arbitrary custom options, they are stored directly in the quote item, without reference to the custom options you defined (those are only needed for UI):

$product->addCustomOption($code, $value);
  • Thank you. How do I add a custom option with a price? Jul 2, 2015 at 10:36
  • $value is the price Jul 2, 2015 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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