Magento how to save additional shipping info to Quote during checkout

Magento how to save additional shipping info to Quote during checkout

September 24, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento how to save additional shipping info to Quote during checkout

Magento: How to Save Additional Shipping Info to Quote During Checkout

As a new developer working on Magento version 1.6.2.0, you’re trying to add your own custom shipping method module while dealing with the Threestep checkout extension already installed in your system. The goal is to save additional shipping information (like Store Pickup place) chosen during the third step of the checkout process and then store it in the Quote before finally saving it to the Order in the Review step.

The Current Approach

You’re currently using events such as checkout_controller_onepage_save_shipping_method to save data to the Quote, but you’re facing challenges in finding free places within the Quote and Order entities to store your custom data.

To address this issue, you’ve created an installer script for your module that adds new ‘packboxname’ attributes to both the order and quote tables:

$installer->addEntityType('quote', array(
    'entity_model' => 'sales/quote',
    'table'        => 'sales/quote',
));

This approach allows you to have a dedicated field for storing your custom shipping information. However, you’re uncertain about the best practices surrounding the use of addEntityType.

Magento Entity Types Explained

In Magento, an entity type represents a specific data structure in the system, such as a product, customer, or quote. Each entity type is associated with its respective model and database table.

When you add an entity type using addEntityType, you’re essentially defining a new data type that can be used within Magento’s core architecture. While this approach works for your current needs, it might not always be the most efficient or recommended way to handle custom data storage.

Alternative Approaches

1. Custom Order Attributes

Instead of creating an entirely new entity type, you could add a custom attribute directly to the existing ‘order’ and ‘quote’ entities using Magento’s attribute management system.

Here’s how you can achieve this:

$installer = $this;
$installer->startSetup();

$packboxName = array(
    // Define your attribute settings here...
);

$installer->addAttribute('order', "packboxname", $packboxName);
$installer->getConnection()->addColumn($installer->getTable('sales/order'), 'packboxname', 'varchar(255) DEFAULT NULL');

$installer->endSetup();

By following this approach, you’re reusing the existing entity type and simply extending its attributes with your custom field.

2. Custom Quote Attributes

Similar to the previous method, you can add a custom attribute directly to the ‘quote’ entity:

// Add attribute code here...

$installer->addAttribute('quote', "packboxname", $packboxName);

This approach allows you to store your data within the quote entity without creating a new entity type.

Best Practices

When handling custom data storage in Magento, consider the following best practices:

  1. Reuse existing entities when possible: Extend the built-in ‘order’ or ‘quote’ entities by adding custom attributes instead of creating entirely new entity types.

  2. Keep your database clean: Avoid adding unnecessary columns to core tables if you don’t need them for your specific use case.

  3. Use events wisely: Events are powerful tools in Magento, but be mindful not to overload the system with too many event listeners.

  4. Document your changes: Make sure to document any customizations made to the database schema, especially when working on a team or maintaining existing codebases.

Conclusion

In this article, we explored various approaches to storing additional shipping information within Magento during the checkout process. We discussed the use of addEntityType, as well as alternative methods such as adding custom attributes directly to the ‘order’ and ‘quote’ entities.

The choice between these methods depends on your specific requirements and preferences. However, it’s essential to consider best practices for maintaining a clean database structure and efficient overall performance in your Magento implementation.

For more advanced Magento development tips and best practices, be sure to check out our comprehensive resources at Laravel Company.

Checkout Catalog Database Extensions

Our network