Adding per unit prices to Collection page / Product grid

Solved
Tourist
8 1 1

Hi guys,

 

due to a law on prices in germany, I have to display the product prices also on a per unit (kg, liter, etc) basis. I have solved this problem on each product page by using metafields. Now I also have to show the per unit prices on the collection page / product grid. I have tried to create metafields in the collection.liquid, but it doesn't work. 

 

How can I make it work?

 

Thank you very much for your help in advance!!!

If I could help you, then please Like and Accept Solution.
0 Likes
Shopify Expert
2145 359 449

Send me your store url so i can check

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com
Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
0 Likes
Highlighted
Tourist
8 1 1

www.wholeshop.de

 

PW: chaugg

If I could help you, then please Like and Accept Solution.
0 Likes
Shopify Expert
2145 359 449

If you have already coded for product page then you can also get and show product metafield on collection page by collection object. 

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com
Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
0 Likes
Tourist
8 1 1

Yes but on collection.liquid the metafield doesn't show up.

 

 

Putting for example 

 

{%if product.metafields.global.price %}

{{ product.metafields.global.price }}

{% endif %}

 

under the code for the normal price, doesn't let the second price show up

If I could help you, then please Like and Accept Solution.
0 Likes
Tourist
30 0 0

Hey Alex!

I have the same problem as i am from Germany. Can you please tell me how you solved the problem? I've just checked your website and saw you could solve the problem. I need help for my product prices and also collection sites. Thank you very much!

0 Likes
New Member
1 0 0

Hi there! We are facing the exact same problem. Did you help Alex with his issue and is there a way you can help us, too?

With kind rgerds, 

Nana

0 Likes
Tourist
8 1 1

Hi,

 

Sorry for the late answer.

 

I solved the problem by using the chrome extension Shopifyfd (http://shopifyfd.com/).

 

You simply go on a product, (there were you can change the description and upload photos) and you press the shopifyfd extension. Then on the right side a field will open, where you can put in your metafield. Then put in some names or values. I used those keywords for example:

namespace= global

key = price.

Then in the field "value" you write with html code, what you want to be shown on the product page.

For example <p style=" color: blue;"> 1.70€/100g</p>

Create for every product exact the same metafield, just change the price and unit of the product in the value field.

 

Now go to your theme's code. Go to snippets and create a new one with the name = metafield-price.liquid . There put in

<!--Metafield-->
{%if product.metafields.global.price %}
{{product.metafields.global.price }}
{% endif %}

 

Make sure that you put your namespace and key in the code.

 

Now go to your product-template.liquid and write under the product price this code:

{% include 'metafield-price' %}

Be careful because the code above refer to the snippet you created.

Alternatively you could put directly the snippet's code in the product-template.liquid without creating a new snippet.

 

I use the debut theme so I put the metafield's code here:

product template.PNG

 

Now to make the same metafield show up on the product grid, go to snippets and open the product-card-grid.liquid .

Then go to the product price code und put this code under it:

{% include 'metafield-price' %}

 

product grid.PNG

 

If I could help you, then please Like and Accept Solution.
0 Likes
Tourist
4 0 0

Hello Alex,

it seems that shopifyfd is down completely.

And I can't add metafields. Could you help me somehow?

(I'm from germany too)

0 Likes
Tourist
8 1 1

Actually I was able last week to edit them. In the beginning when you open the product, you get an error  warning from shopifyfd. In that case just reload the page and press again the button of the shopifyfd extension. Then you should be able to edit the metafields again.

If I could help you, then please Like and Accept Solution.
0 Likes