dEbo Posted April 23, 2016 Share Posted April 23, 2016 Hi, i hope somebody from community or WHMCS staff could help with following question. I am trying to override price of the product in cart if some config options is selected (or other definitions). I am able to detect variables with for example: if productgroup==$somegroupid and configoption.id==$someconfigoptionid but i could not find how to manipulate the price in ordering process and update it to Order Summary. Yes, there is api to customize the invoice prices after the order is placed, but there is nothing to override price so customer can see the price while ordering. Does anyone know how to approach this issue? Thank you 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 23, 2016 Share Posted April 23, 2016 depending on where in the order process you're trying to do this, you may not be able using Smarty - it might need jquery. with regards to overriding price, the simplest built-in solution might be a promotional code - if you can detect your conditions to be true, you should be able to add a promo code to the cart automatically. http://docs.whmcs.com/Promotions 0 Quote Link to comment Share on other sites More sharing options...
dEbo Posted April 23, 2016 Author Share Posted April 23, 2016 Hi Brian, thanks for your reply. Promo codes couldnt do the job, it simply doesnt check config options. But i just completly missed hook OrderProductPricingOverride which does the job perfectly. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 23, 2016 Share Posted April 23, 2016 no I know it doesn't check config option, but I was envisaging your if code doing that, and if true, then applying the promo code - but if you found a hook alternative, so much the better. 0 Quote Link to comment Share on other sites More sharing options...
dEbo Posted April 23, 2016 Author Share Posted April 23, 2016 The longer iam looking into this issue the more problems i am running into. Promo code cannot be add while the product is being configured in the cart, moreover promo code cannot be add by an API. Brian, how exactly were you suggesting to add promo code automatically? Mention hook OrderProductPricingOverride could do the job, except it overrides ALL products in cart, not just the one it is meant to. It overrides SESSION var which is being transferred to other products as well 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 24, 2016 Share Posted April 24, 2016 The longer I am looking into this issue the more problems I am running into. that's WHMCS for you! Promo code cannot be add while the product is being configured in the cart, moreover promo code cannot be add by an API.Brian, how exactly were you suggesting to add promo code automatically? exactly how would depend on the template being used, but I was thinking of either a template change or jquery tweak to pass the promo code in the link... but it was a Saturday afternoon, so I might not have been thinking clearly! Mention hook OrderProductPricingOverride could do the job, except it overrides ALL products in cart, not just the one it is meant to. It overrides SESSION var which is being transferred to other products as well although not strictly an override, are you aware that you can price configurable options negatively ? so if you had two radio options, let's call them 'Tom' and 'Jerry' - selecting 'Tom' adds nothing to the overall price as it's price at 0.00, but selecting 'Jerry' reduces the overall price by $10 because it is priced at -10.00 - is that something you can use to help solve your situation? there would be more complicated methods, e.g using jquery to define rules based on config option values, but it's a minefield of issues! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.