Dynamic checkout button on the section rendered with Section rendering API

Hello I’d like to display dynamic checkout button in a modal where the section API is rendered.

Like ‘Buy it now’ button in flow theme

I tried this code in the ‘Snippets/product-form.liquid’

{%- form 'product', product-%}
    	
      {{ form | payment_button }}
{%- endform -%}

and not working

Output code:


Any ideas?

Shopify please reply me

I have succeeded in displaying “buy it now” button on collections page. This is obviously related with section rendering API(Fetch API). How can I display dynamic checkout button on modal window?

Hi James,

I had similar problem like this, I tried to find a solution and I found this thread but there was no answer and then I found out a solution. This is my solution:

After your modal loaded you need to re-initiate the payment button using this code

Shopify.PaymentButton.init()

I hope it can help others with similar problem.

You are better than Shopify. They just reply go to the community and ask for development questions and don’t care. This is a really irresponsible attitude.

You are better than Shopify. They just reply go to the community and ask for development questions and don’t care. This is a really irresponsible attitude.

You are better than Shopify. They just reply go to the community and ask for development questions and don’t care. This is a really irresponsible attitude. I can’t even delete mistyped my replies in this post.

This did not work for me. I’m using an ajax cart page and need the dynamic checkout buttons to reappear after the updated cart content is injected back into the dom.