Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In Magento you can create your own events wherever you need but in this case you can use <code>checkout_cart_product_add_after</code> event to update the quore address details.</p> <p>So here is the code for the same</p> <pre><code>$quote = Mage::getSingleton('checkout/session')-&gt;getQuote(); $billingAddress = Mage::getModel('sales/quote_address') -&gt;setStoreId($storeId) -&gt;setAddressType(Mage_Sales_Model_Quote_Address::TYPE_BILLING) -&gt;setCustomerId(('Your_Value_Here')) -&gt;setCustomerAddressIpd(('Your_Value_Here')) -&gt;setCustomer_address_id(('Your_Value_Here')) -&gt;setPrefix(('Your_Value_Here')) -&gt;setFirstname(('Your_Value_Here')) -&gt;setMiddlename(('Your_Value_Here')) -&gt;setLastname(('Your_Value_Here')) -&gt;setSuffix(('Your_Value_Here')) -&gt;setCompany(('Your_Value_Here')) -&gt;setStreet(('Your_Value_Here')) -&gt;setCity(('Your_Value_Here')) -&gt;setCountry_id(('Your_Value_Here')) -&gt;setRegion(('Your_Value_Here')) -&gt;setRegion_id(('Your_Value_Here')) -&gt;setPostcode(('Your_Value_Here')) -&gt;setTelephone(('Your_Value_Here')) -&gt;setFax(('Your_Value_Here')); $quote-&gt;setBillingAddress($billingAddress); $shippingAddress = Mage::getModel('sales/quote_address') -&gt;setStoreId($storeId) -&gt;setAddressType(Mage_Sales_Model_Quote_Address::TYPE_SHIPPING) -&gt;setCustomerId(('Your_Value_Here')) -&gt;setCustomerAddressId(('Your_Value_Here')) -&gt;setCustomer_address_id(('Your_Value_Here')) -&gt;setPrefix(('Your_Value_Here')) -&gt;setFirstname(('Your_Value_Here')) -&gt;setMiddlename(('Your_Value_Here')) -&gt;setLastname(('Your_Value_Here')) -&gt;setSuffix(('Your_Value_Here')) -&gt;setCompany(('Your_Value_Here')) -&gt;setStreet(('Your_Value_Here')) -&gt;setCity(('Your_Value_Here')) -&gt;setCountry_id(('Your_Value_Here')) -&gt;setRegion(('Your_Value_Here')) -&gt;setRegion_id(('Your_Value_Here')) -&gt;setPostcode(('Your_Value_Here')) -&gt;setTelephone(('Your_Value_Here')) -&gt;setFax(('Your_Value_Here')); $quote-&gt;setShippingAddress($shippingAddress) -&gt;setShipping_method('flatrate_flatrate') -&gt;setShippingDescription($this-&gt;getCarrierName('flatrate')); $quote-&gt;save(); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload