We have two shipping methods: package and postal. Postal is the cheapest.
We have shipping rules based on weight.
One of our products is large sheets of paper, because this cannot be send as postal we gave this product a high weight.
This works fine, when a large sheet of paper is ordered the package shipping method is selected.
Now we've added a custom option to the product, saying 'cut before sending'.
When the customer selects it, we will cut the large sheet of paper in 4 and send it as postal.
But how can we change the weight of the product when the 'please cut' option is selected? The package shipping method is still selected, but the postal method should be selected.
Best Answer
Paul,Magento have magic logic to change the
weight of cart item
.When magento is added a product in cart it fire an eventsales_quote_item_set_product
and it send two params one isQuote item(Quote Object)
and another is Current Carted product object(Mage_Catalog_Model_Product
)See at Class
Mage_Sales_Model_Quote_Item
eventI suggest to the trigger an event/observer on this occasion and you can change weight of quote items using
setter
functionsetWeight()
and another thing is that magento is savequote item weight
atsales_flat_quote_item
Table at database.Code of Observer: