Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
v:2.0:snippets:updating_total_price_with_option_modifers [2023/07/12 10:33] – [Step 1: Include snippet] adamv:2.0:snippets:updating_total_price_with_option_modifers [2023/07/12 10:38] (current) – [Dynamically triggering recalculation] adam
Line 41: Line 41:
  
 <code javascript>initDynamicPrice();</code> <code javascript>initDynamicPrice();</code>
 +
 +==== Modify dynamically calculated total price ====
 +
 +If you need to dynamically modify the calculated price, for example if your product prices are tax exclusive, but you want to show the calculated price as tax inclusive, you can define a function on your page to achieve that result. The function has a name of ''fc_adjust_price_display'', and is passed a single argument which is the dynamically calculated total price. The function should return your modified price.
 +
 +As an example, let's say you want to account for a 25% inclusive tax on your product prices, that would look like this:
 +
 +<code javascript><script>
 +  function fc_adjust_price_display(price) {
 +    return price * 1.25;
 +  }
 +</script></code>
 ===== That's it! ===== ===== That's it! =====
  

Site Tools