Why isn't my 'Buy it now' button working on my product page?

daiki44
Shopify Partner
11 1 0
Hi!
I am adding a page template in Shopify to showcase my products.
I want to add a "Buy it now" button to this screen and have implemented it with the following code.
{% for product in collections.all.products %}
  {% if product.id == 'aaa' %}
    {% form 'product', product %}
      {{ form | payment_button }}
    {% endform %}
  {% endif %}
{% endfor %}
The button appears, but when I click on it, I get an error like the one in the screenshot.
Why is this happening?
Replies 11 (11)

Rishihuptech
Shopify Partner
486 82 94

Hi, @daiki44 
Can you share the store URL

If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required
daiki44
Shopify Partner
11 1 0

@Rishihuptech 

Thank you for your response!

 

Sorry, but the store is not yet open to the public and cannot be accessed.

The button is working on a non-customized Shopify product page.

Rishihuptech
Shopify Partner
486 82 94

Hi @daiki44 
You can share the password-protected page URL with the password so I can check if the store has any errors. I don't want the store login credentials. without the URL I'm not able to assist you.

If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required
daiki44
Shopify Partner
11 1 0

@Rishihuptech 

Thank you for your kind attention.
I will send you the information by message!

Rishihuptech
Shopify Partner
486 82 94

Hi @daiki44 
The product id fetched was wrong. That's why the checkout is not working. you need to add the default variant id of that product.
The second thing is the store is currently password-protected that's why the checkout is showing an error.

If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required
Rishihuptech
Shopify Partner
486 82 94

Hi @daiki44 
Can you please check this code

<form action="/cart/add" method="post" enctype="multipart/form-data">
      <input type="hidden" name="id" value="place id here" />
      {{ form | payment_button }}
    </form>
If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required
daiki44
Shopify Partner
11 1 0

@Rishihuptech 

Thank you for your response!
I added the code you gave me, but nothing showed up...

 

Please see the URL I sent you in my message.

Rishihuptech
Shopify Partner
486 82 94

Hi @daiki44 

I have tried this on my test store and found the same issue. but I have a solution for this also. You can use a featured product section here, Select the product you want to add to the cart then hide all the things like image, title, price, etc but not the Buy Now button.
In this way, it is possible to add a buy now button.
I have tested this method on my test store and it is working.

If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required
daiki44
Shopify Partner
11 1 0

@Rishihuptech 

Thank you for trying it!

I added the following code you provided and the button did not seem to display.
<form action="/cart/add" method="post" enctype="multipart/form-data">
<input type="hidden" name="id" value="place id here" />
{{ form | payment_button }}
</form>

Please let me know if there is another way to display the payment button on the custom page.

Rishihuptech
Shopify Partner
486 82 94

Hi @daiki44 
I have mentioned the method in the previous message you can try -> https://community.shopify.com/c/payments-shipping-and/payment-button-does-not-work/m-p/2371810/highl...

If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required
daiki44
Shopify Partner
11 1 0

Hi @Rishihuptech 
Thank you for your reply!

 

I'm sorry. I could not understand what you said in your previous message.

Would it be possible for you to give us the specific code🙇‍


I do not have the image of how to add a PaymentButton to a customized page in what you gave me.