I have a code that I add to my product page and my cart page. but when I add script string code to it, the page doesn't load and I receive a 500 code error. Can someone help me what is the problem? (I have a very limited knowledge of coding) this is the document that I'm using as a reference. https://developer.paybright.com/docs/prequalify-sdk-woocommerce This is the code which works fine:
<?php
function pb_modal() {
$pb_product_price = get_post_meta( get_the_ID(), '_price', true);
$pb_product_format = number_format((float)$pb_product_price, 2, '.', '');
echo "<script id='pb_prequalify' type='text/javascript' src='https://app.paybright.com/dist/sdk.js?public_key=INSERT_PUBLIC_KEY&financedamount=$$pb_product_format'></script>
<script>
pb_prequalify_init();
</script>
<div id='paybright-widget-container'></div>";
}
add_action( 'woocommerce_after_add_to_cart_form', 'pb_modal', 1);
?>
And whenever I change the script (the following code) I get the error 500:
<script>
pb_prequalify_init({
triggerText:"Learn more",
});
</script>