Last active
November 30, 2022 10:26
-
-
Save aldrienht/52eb41ae8151ae88f411672f854a269b to your computer and use it in GitHub Desktop.
Display points amount on product page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if template.name == 'product' %} | |
<script> | |
document.addEventListener('readystatechange', event => { | |
if (event.target.readyState === "complete") { | |
const orderPlacedSettings = window.BoosterApps.loy_config.ways_to_earn.filter(function(w) { return w.trigger === "order_placed" })[0]; | |
if(!orderPlacedSettings || !window.BoosterApps?.common?.product){ | |
return; | |
} | |
const brandThemeSettings = window.BoosterApps.loy_config.brand_theme_settings; | |
const translations = window.BoosterApps.loy_config.brand_panel_settings; | |
const potentialPoints = (window.BoosterApps.common.product.price / 100) * orderPlacedSettings.points_amount; | |
console.log('TODO - set selector where points amount content will appear: '+ potentialPoints) | |
document.getElementById(‘test_div’).innerHTML = `<div>some data and html tags here</div> ` | |
} | |
}); | |
</script> | |
{%- endif -%}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment