Solved

Add product Weight in featured collections in Express Theme

grubio
Tourist
24 0 1

I want to add the product weight in gr. next the product price.

I tried after reading another question by adding <p>{{ variant.weight }}</p> in featured -product.liquid, but didn't work.

Anyone knows how I can do it?

Thanks

Accepted Solution (1)
g33kgirl
Shopify Partner
390 109 142

This is an accepted solution.

@grubio, I just checked your website. You were adding it to featured product and not collection. Add this code to Snippets -> product-card-list.liquid:

 

 Find this div ---> <div class="product-card__price-wrapper">
        {% render 'product-price-listing', product: product %}
        {% render 'product-price', variant: product.selected_or_first_available_variant, product: product, wrapper_class: 'price--listing price--variants' %}
        <a href="{{ product.url }}" class="rte product-card__view-details" data-product-card-link>
          {{ 'products.product.view_details' | t }}
        </a>
      </div> <---- add weight after this div
      {{ product.variants.first.weight | weight_with_unit }}

 

 

 

 

If you found my answer helpful, please LIKE and ACCEPT.
buymeacoffee.com/g33kgirl
If you're not comfortable with code, please modify code files at your own risk.

View solution in original post

Replies 16 (16)

JHKCreate
Shopify Expert
3571 639 916

Hi @grubio 

What theme are you using? Where did you paste the piece of code? Are you products variant dependent or just one version is available?

Did we solve your issue? Like & Mark As Solution to help the community
Should you need any direct help: contact@jhkcreate.com

Learn more about us: jhkcreate.com
grubio
Tourist
24 0 1

Hi @JHKCreate 

I'm using Express Theme.

Below  {% render 'product-price', variant: current_variant, product: product, show_vendor: section.settings.show_vendor %}

Only 1 version.

Thanks!

g33kgirl
Shopify Partner
390 109 142

Add this code:

{{ product.variants.first.weight | weight_with_unit }}
If you found my answer helpful, please LIKE and ACCEPT.
buymeacoffee.com/g33kgirl
If you're not comfortable with code, please modify code files at your own risk.
grubio
Tourist
24 0 1

Hi @g33kgirl 

Thanks for your reply.

I added the snipped code in the same place and I cannot see the weight yet.

Section-> featured -product.liquid
Below -> {% render 'product-price', variant: current_variant, product: product, show_vendor: section.settings.show_vendor %}

Any other idea?

 

 

g33kgirl
Shopify Partner
390 109 142

@grubio,  that should have worked. Try this:

 

<p>{{ current_variant.weight }}</p>

 

 

If you found my answer helpful, please LIKE and ACCEPT.
buymeacoffee.com/g33kgirl
If you're not comfortable with code, please modify code files at your own risk.
grubio
Tourist
24 0 1

Hi @g33kgirl 

It doesn't. I should do something wrong then.

Probably I'm not adding the code in the right place

Screenshot 2021-04-28 at 20.19.52.pngScreenshot 2021-04-28 at 20.22.33.png

g33kgirl
Shopify Partner
390 109 142

I installed the Express Theme on my development store and it shows the weight on featured-product section on homepage:

Screenshot 2021-04-28 at 7.35.04 pm.png

Screenshot 2021-04-28 at 7.35.11 pm.png

 

Have you added the featured-product section component on your homepage?

If you found my answer helpful, please LIKE and ACCEPT.
buymeacoffee.com/g33kgirl
If you're not comfortable with code, please modify code files at your own risk.
grubio
Tourist
24 0 1

Thanks @g33kgirl 

I don't see what I do wrong.

The code is the same in the same place:

Screenshot 2021-04-28 at 20.48.45.png

I have a weight for this product

Screenshot 2021-04-28 at 20.48.57.png

Which I can see in the product page (in kg, what I think this another issue)

Screenshot 2021-04-28 at 20.49.14.png

But in the featured collection

Screenshot 2021-04-28 at 20.49.23.png

I tried a different browser because the cache and on... and nothing. Doesn't work. 

Any idea?

Thanks a lot!!!!

g33kgirl
Shopify Partner
390 109 142

Are you adding this section to your homepage?

Screenshot 2021-04-28 at 10.58.25 pm.png

If you found my answer helpful, please LIKE and ACCEPT.
buymeacoffee.com/g33kgirl
If you're not comfortable with code, please modify code files at your own risk.
grubio
Tourist
24 0 1

Hi @g33kgirl 

I have a Featured Product section and Featured Collection in my homepage. I'm not adding a new one, should I do that?

Thanks

g33kgirl
Shopify Partner
390 109 142

No. Have you added the code to both Featured collection and Featured Product liquid files? 

If you found my answer helpful, please LIKE and ACCEPT.
buymeacoffee.com/g33kgirl
If you're not comfortable with code, please modify code files at your own risk.
grubio
Tourist
24 0 1

I had it in Featured Product liquid files. Now, I added it in both. In Featured Product in the same line that you had. For featured collected, I tried to guess the best place.
However, it didn't work.

 

Screenshot 2021-04-29 at 09.29.19.png

 

{{ product.variants.first.weight | weight_with_unit }}

g33kgirl
Shopify Partner
390 109 142

That is really strange. Can you share your website url?

If you found my answer helpful, please LIKE and ACCEPT.
buymeacoffee.com/g33kgirl
If you're not comfortable with code, please modify code files at your own risk.
grubio
Tourist
24 0 1

Lovejamon.com

hola123

g33kgirl
Shopify Partner
390 109 142

This is an accepted solution.

@grubio, I just checked your website. You were adding it to featured product and not collection. Add this code to Snippets -> product-card-list.liquid:

 

 Find this div ---> <div class="product-card__price-wrapper">
        {% render 'product-price-listing', product: product %}
        {% render 'product-price', variant: product.selected_or_first_available_variant, product: product, wrapper_class: 'price--listing price--variants' %}
        <a href="{{ product.url }}" class="rte product-card__view-details" data-product-card-link>
          {{ 'products.product.view_details' | t }}
        </a>
      </div> <---- add weight after this div
      {{ product.variants.first.weight | weight_with_unit }}

 

 

 

 

If you found my answer helpful, please LIKE and ACCEPT.
buymeacoffee.com/g33kgirl
If you're not comfortable with code, please modify code files at your own risk.
grubio
Tourist
24 0 1

That was the issue and solution.

Thanks a lot!