Magento: Add a "fake" product to cart/quote

Magento: Add a "fake" product to cart/quote

August 21, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento: Add a "fake" product to cart/quote

Magento: Creating Temporary Products for Cart/Quote

As a senior developer specializing in e-commerce platforms, I often get asked about generating temporary products that can be added to the cart without being saved to the database permanently. This is particularly useful for made-to-order scenarios where you want to capture customer selections but don’t need to maintain the product record.

Understanding Magento’s Product System

Magento is built on a robust product management system. Each product has attributes, SKUs, prices, and various other metadata associated with it in the database. When you add a product to a quote or cart, Magento relies heavily on these database records to validate, calculate totals, and generate the final order.

Why You Might Want a “Fake” Product

In a made-to-order situation, you might want to create a bundle product that represents all possible configurations. The user selects their options, and you add this bundle to the cart. However, maintaining thousands of potential configurations in the database can be inefficient and cluttering.

You could also consider creating a generic base product with custom options added on-the-fly based on user selections. This approach requires more dynamic coding but keeps your product catalog cleaner.

Challenges of Temporary Products

There are several challenges to creating temporary products:

  1. Product Validation: Magento checks if the selected product exists in the database before adding it to the cart. If you try to add a non-existent SKU, you’ll encounter errors.

  2. Total Calculation: The shopping cart totals and tax calculations rely on the product’s attributes. A missing or incorrect product can lead to inaccurate pricing.

  3. Database Consistency: Changes in the product record (like price updates) won’t be reflected if the product isn’t saved correctly to the database.

Possible Workarounds

1. Create a Giant Bundle Product

You could create one giant bundle product that contains all potential configurations as its items. This approach keeps everything within the Magento framework but requires managing an enormous product record.

$bundle = $this->productFactory->create();
$bundle->setSku('MADE-TO-ORDER-BUNDLE');

2. Manually Create the Quote with Custom Options

Another approach is to create a generic base product and manually add custom options based on user selections when adding it to the quote.

$quote = $this->cartManagement->createEmptyCart();
$quoteItem = $this->quoteItemFactory->create();

$option = $this->quoteOptionFactory->create();
$option->setProductId($productId); // ID of your base product
$option->setCode('option_name');
$option->setValue($selectedValue);

$quoteItem->addOption($option);
$quote->addItem($quoteItem);

3. Customize the Product Validation Process

You could override Magento’s product validation process to accept temporary SKUs or IDs. This involves a deeper level of core modification and should be approached with caution.

Best Practices

  1. Always backup your database before attempting these modifications.
  2. Consider the performance implications of managing temporary products.
  3. Ensure that your custom logic handles edge cases properly (like price updates, stock management).
  4. If you’re unsure about a specific implementation, consult Magento’s official documentation or seek advice from experienced developers.

Conclusion

While it is technically possible to create “fake” or temporary products in Magento, it requires careful consideration of the trade-offs involved. The approach will depend heavily on your specific use case and technical constraints.

It’s often more effective to rethink your product structure or user interface to minimize the need for these workarounds. However, if you find that a made-to-order system is crucial, approach this challenge with a clear understanding of Magento’s architecture and a willingness to invest in custom development.

For more detailed guidance on Magento development best practices, I recommend checking out our comprehensive guide at https://laravelcompany.com/magento-development-best-practices.

Checkout Catalog Database Configuration

Our network