简体   繁体   中英

Magento set custom tax amount per product in checkout/cart

We're using Magento enterprise and I am fairly new to Magento in general. But my current goal is to set custom values (ie custom tax amount, promotion amount...etc.) in the cart and have them checkout with these custom values. I am setting these values by using checkout/session object.

For example:

$cart = Mage::getSingleton('checkout/session')->getQuote(); $cart->setPromotionAmount($amount);

When I look at the checkout/session object

print_r($cart->getData());

Everything looks to be set properly. But when I proceed to checkout. It loses these values and defaults to the default calculations that Magento performs. My assumption was that if I set my custom values in this checkout/session. It would flow through the normal checkout process. Checking out with these new values. (ie promotional amount, custom tax amount) This isn't the case. Can anyone give me advice as to how to accomplish this or suggestions? I am beginning to realize that I don't understand the full checkout process and would love any helpful links or debugging tips. Greatly appreciate any help or suggestions.

Are you calling $cart->save(); ? Since quotes are stored in the database, maybe you're only setting the pricing for the term of the page load in PHP. That could explain why once you continue your checkout, the quote is reloaded from the datbase with the original pricing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM