If product is found, show buy button script, if not show default html

Highlighted
New Member
3 0 0

Our external website store has hundreds of thousands of products, some of which are not ready to sell online yet.  We are just getting started on Shopify and we want customers to still see that these products are available through older means of sales (i.e. customer calling salesperson).  My plan was to upload products to the Shopify, and if they are uploaded and found, to show the buy button file, but if they were not uploaded to show the default information on the product that comes from our own server via html.  I am pulling the correct product by customizing each product handle in the csv files.

My problem is, I can't figure out a way to get my website to correctly check whether or not the product does indeed exist within a buy-button.  Is there a good way to do this? 

0 Likes
Highlighted
Astronaut
1083 178 213

Hello,

You can do this:

{% if product.available %}
product is found, show buy button script,
{% else %}
 product NOT found, show HTML
{% endif %}


Let me know whether it helps.

Kind regards,
Diego

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Hire me! Recommended by 25+ customers on Facebook. Click here to read their reviews.
◦ Contact me at: diego.boarutto.fortes@gmail.com
0 Likes
Highlighted
New Member
3 0 0

Thanks for the response!

I'm guessing that solution is for PHP.  Our website is in ASP.NET MVC.  Is there anywhere I can find documentation on something like this? 

0 Likes
Highlighted
Astronaut
1083 178 213

Hello,

You can't use PHP within a Shopify theme, only if for back-end when developing Shopify apps.

You'll need to use .liquid for this. 

Regards,
Diego

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Hire me! Recommended by 25+ customers on Facebook. Click here to read their reviews.
◦ Contact me at: diego.boarutto.fortes@gmail.com
0 Likes
Highlighted
New Member
3 0 0

I apologize for not being specific.  I am attempting to embed a buy button script into an external web page.  Is there any way to check to see that a product exists from an external page (i.e. check for an error)? I'm using Shopify Lite. 

0 Likes