Shopify themes, liquid, logos, and UX
Apologies I'm very new to liquid/coding and I've googled as much as I can and can't find an answer. I'm looking to add text to my homepage that pulls the price of a product into the text of a homepage. I'd like a paragraph of text to say something like this:
"with 100 blades costing only [price of specific product] you are set for two plus years" (again this is not on the product page. but on a separate page, calling the price up of a specific product)
bonus points if I can also do math like [price of product / 2]
the idea is i have text for a page change based on the user, so it will display whatever price they're currently set to see. eg: canadians will CAD, americans will see USD. (but ideally not have the currency code)
I'm sure this is extremely simple, I'm just struggling to find an answer.
Thank you.
Solved! Go to the solution
This is an accepted solution.
figured it out. I was just messing up the product handle when trying to assign a product to a variable, so I had found the solution earlier, just messed up implementation. I knew it had to be simple.
{% assign content_price = all_products['asdf-asdf'] %} (the product handle is the name of the product in the URL eg:/products/asdf-asdf the handle is asdf-asdf
{{ content_price.title }} is {{ content_price.price | divided_by: 100 | money }}
result:
Asdf Asdf is $0.10
This is an accepted solution.
figured it out. I was just messing up the product handle when trying to assign a product to a variable, so I had found the solution earlier, just messed up implementation. I knew it had to be simple.
{% assign content_price = all_products['asdf-asdf'] %} (the product handle is the name of the product in the URL eg:/products/asdf-asdf the handle is asdf-asdf
{{ content_price.title }} is {{ content_price.price | divided_by: 100 | money }}
result:
Asdf Asdf is $0.10
User | RANK |
---|---|
155 | |
137 | |
75 | |
71 | |
62 |
Explore the 30-30-30 rule, a dynamic social media strategy for new businesses. Learn how t...
By Trevor Sep 20, 2023Discover how to leverage the often overlooked footer of your ecommerce site to gain custom...
By Skye Sep 15, 2023In this blog, we’ll be shining a light on Shopify Partners, Experts, and Affiliates. Who a...
By Imogen Sep 13, 2023