Help with hotmart widget and onclick function

Hello guys,

I want to open the Hotmart widget when I click on my webflow button. Here’s the hotmart code:

<script type="text/javascript">
	function importHotmart(){ 
 		var imported = document.createElement('script'); 
 		imported.src = 'https://static.hotmart.com/checkout/widget.min.js'; 
 		document.head.appendChild(imported); 
	} 
 	importHotmart(); 
 </script> 
 <a onclick="return false;" href="https://pay.hotmart.com/G20820008X?checkoutMode=2&off=jdjalttn" class="hotmart-fb"><img src='https://static.hotmart.com/img/btn-buy-green.png'></a> 

I don’t want to use the button provided with the widget so I need to call:

<a onclick="return false;" href="https://pay.hotmart.com/G20820008X?checkoutMode=2&off=jdjalttn" class="hotmart-fb"><img src='https://static.hotmart.com/img/btn-buy-green.png'></a> 

When I click on my webflow button. But I’m not getting it right.

Thanks!


Here is my public share link: LINK
(how to access public share link)

Ok, i was able to find a solution.

I just replaced the webflow buttons with a custom code that is:

<a onclick="return false;" href="https://pay.hotmart.com/G20820008X?checkoutMode=2&off=oizuita2" class="button-basico red-button full-width w-button hotmart-fb">inscreva-se</a>

Hello Alberto! I also want to setup my webflow payment button to open the Hotmart widget upon being clicked. Just to clarify the process, you hired the Webflow E-commerce plan, added the payment button, and then replace the button code with this one? <a onclick="return false;" href="https://pay.hotmart.com/G20820008X?checkoutMode=2&off=oizuita2" class="button-basico red-button full-width w-button hotmart-fb">inscreva-se</a> . Obviously I would need to replace the pay.hotmart.com ID with my own, but besides from that, that’s it?

Also, after setting this up, did Hotmart work as intended? I mean, did it show all the available payment methods according to the selected country?

Any advice and feedback will be fully appreciated.

Best!
Luismi

Hey Luis,

You don’t need the e-commerce plan to add the payment button. You just need to insert the hotmart script on the page and put that line of code that creates the button inside a custom code element. To use the same layout of your site just add the classes that your represents your buttons and the custom code will look as a regular button.

Example:
<a onclick=“return false;” href=“hotmart URL" class=“button classes”>button text