Shopify themes, liquid, logos, and UX
How can I add custom line items to certain templates in my store? I am only able to add custom line items to ALL products, and not specific templates for certain products. I can't add more than 100 variants per product page, and as I am a jeweler, I need more than this, as I have many ring sizes and metal options. I will be soon offering necklaces and earrings, and I will not need this on those templates. How can I fix this?
This is the code I currently have on all products.
<p class="line-item-property__field">
<label for="ring-size">Ring Size </label>
<label for="ring-size">(please read sizing instructions below before adding to cart.) </label>
<input required class="required" id="ring-size" type="text" name="properties[Ring Size ]">
</p>
Hi @bbtrudell welcome to the Shopify Community,
You can create multiple templates for products and add line item property in one of them and after that assign that template to the required product where you want to show line item property.
Please let me know if you need further help.
Thanks
@bbtrudell
Identify the product type or template for which you want to include custom line items. Shopify uses the product.type property to distinguish between different types of products.
{% if product.type == 'ring' %}
<p class="line-item-property__field">
<label for="ring-size">Ring Size </label>
<label for="ring-size">(please read sizing instructions below before adding to cart.) </label>
<input required class="required" id="ring-size" type="text" name="properties[Ring Size]">
</p>
{% endif %}
Replace 'ring' with the actual product type or template name you want to target.
Thank you! That is really helpful. What if I wanted to put it on a certain product template I've created?
@bbtrudell
If you want to put it on certain template, first create a new product template name as product.ring and you need to add code as below.
{% if product.template_suffix == 'ring' %}
<p class="line-item-property__field">
<label for="ring-size">Ring Size </label>
<label for="ring-size">(please read sizing instructions below before adding to cart.) </label>
<input required class="required" id="ring-size" type="text" name="properties[Ring Size]">
</p>
{% endif %}
I have multiple templates already, and I want to put this special line item code on them only. Using your code did nothing. This is the page I am currently wanting to add line items to:
{
"sections": {
"main": {
"type": "main-product",
"blocks": {
"price": {
"type": "price",
"settings": {
}
},
"separator": {
"type": "separator",
"settings": {
}
},
"variant_picker": {
"type": "variant_picker",
"settings": {
"variant_labels": true,
"picker_type": "dropdown",
"product_dynamic_variants_enable": true,
"color_swatches": false
}
},
"buy_buttons": {
"type": "buy_buttons",
"settings": {
"show_dynamic_checkout": true,
"surface_pickup_enable": false,
"show_gift_card_recipient": true
}
},
"description": {
"type": "description",
"settings": {
"is_tab": true
}
},
"dd86a877-cf16-4d04-b5d4-f7f1bcbdc0a7": {
"type": "tab",
"settings": {
"title": "Shipping INFORMATION",
"content": "<p>Kindly be aware that this product is made-to-order and necessitates a production period of 2-3 weeks. Please understand that all made-to-order items are customized and therefore cannot be returned.<\/p>",
"page": ""
}
},
"tab_AzBiFF": {
"type": "tab",
"settings": {
"title": "Sizing Information",
"content": "<p>This ring is available in sizes ranging from 4 to 9. If you require a different size, kindly choose a custom design option <a href=\"\/pages\/custom-order-form\" target=\"_blank\" title=\"Custom Order Form\">here.<\/a><\/p>",
"page": ""
}
},
"54e12ba8-6ec0-4824-be95-749cb322bac7": {
"type": "tab",
"settings": {
"title": "CARE AND CLEANING",
"content": "<p><\/p><h3>WHEN SHOULD I NOT WEAR MY JEWELRY?<\/h3><p>Most of these rules apply to engagement rings that are worn daily. When in doubt, just remove! It's always better to err on the side of caution with gemstones and precious metals. We know how special these pieces are (and how much you have invested in them!) and we want you to be able to wear your jewelry as long as possible. <\/p><p>So, without further ado, here are a few suggestions:<\/p><p>Don'ts:<\/p><ul><li>During outdoor activities such as gardening, recreational sports, yard work, washing your car, or any strenuous activity that may or may not break a sweat!<\/li><\/ul><p><\/p><ul><li>In any chlorinated (or chemically treated) water. And ocean water. I know, I know, no sparklies at the beach!<\/li><\/ul><p><\/p><ul><li>During the much dreaded house work! Don't wear it while vacuuming, doing the laundry, washing dishes, etc. And definitely not while scrubbing toilets!<\/li><\/ul><p><\/p><ul><li>Never, ever wear your jewelry while exercising or weight lifting. No kickboxing, jiu jitsu, arm wrestling. Nope. None of that.<\/li><\/ul><p><\/p><ul><li>Never use any chemicals on your hands when wearing your jewelry. Some chemicals can damage precious metals and gemstones.<\/li><\/ul><p><\/p><p>Dos: <\/p><ul><li>Feel free to wash your hands with your jewelry on! Removing your rings while washing your hands can increase the risk of your ring falling into the drain, and that is certainly not something we want to happen! Nor do we want you to forget your ring in a public restroom, if you've removed it to wash your hands. Mild soap will not damage your ring(s), but we do suggest removing them while washing dishes.<\/li><\/ul><p><\/p><ul><li>Ensure that your ring is the right size. We certainly wouldn't want you to wash your hands and have it accidentally slip off and fall down the drain!<\/li><\/ul><p><\/p><ul><li>Give your rings a gentle tap while holding them close to your ear. If you detect any subtle rocking noises, don't hesitate to send us an email! We offer a complimentary prong inspection and will tighten them if needed.<\/li><\/ul><p><\/p><ul><li>Insure your jewelry ASAP! Should the worst happen, we want you to be covered. <\/li><\/ul><p><\/p><ul><li>Store your jewelry in a safe place (even while sleeping!) that is protected from the elements. A soft pouch or jewelry box is recommended. And remember, do not store different types of jewelry together without proper protection, as they can scratch each other.<\/li><\/ul><p><\/p><ul><li>Clean your jewelry! See our tips below on the best practice for maintaining your piece(s). <\/li><\/ul><p><\/p><h3>CLEANING<\/h3><p>Most gemstone jewelry must be cleaned a little more often than traditional diamond jewelry. We recommend cleaning your gemstone jewelry every few weeks if you're really ambitious, but once a month will suffice, usually. It truly depends on your lifestyle and how often your piece is worn.<\/p><ul><li>Do not use any kind of chemicals to clean your jewelry, whatsoever! The best thing for your jewelry is some good ol' mild dish soap with a soft\/extra soft toothbrush. Never use hard\/firm bristled toothbrushes, as they can possibly scratch your gold\/stones. Use warm water (not too hot!) to wash away grime and oils. <\/li><\/ul><p><\/p><ul><li>Don't forget the underside of the stone! Dry with a soft cloth, or use your blow dryer on the cool setting to achieve a spotless shine! <\/li><\/ul><p><\/p><ul><li>Polish with a gemstone\/jewelry polishing cloth to achieve an even better luster. <\/li><\/ul><p><\/p><ul><li>Never, ever, place your gemstone jewelry in an ultrasonic cleaner, or use a steamer to clean the piece. Some stones, like emeralds, have natural inclusions or have oil treatments and should never be cleaned this way, as they can break, or have their treatment removed altogether if used in conjunction with a harsh chemical cleaner.<\/li><\/ul><h3>MAINTENANCE<\/h3><p>We offer professional cleaning, polishing, and resizing for all of your pieces you have purchased from us. Please <a href=\"\/pages\/contact\" title=\"CONTACT US\">contact us<\/a> to inquire further.<\/p><p>To be covered under our warranty, please send us your piece for annual (or bi-annual, even better!) maintenance. We check all prongs, polish, and clean your jewelry for you under our warranty. Please reach out to us to schedule. For more warranty information, click <a href=\"https:\/\/lavendercreekgems.com\/pages\/warranty\">here.<\/a> <\/p>",
"page": ""
}
},
"tab_xWiwfF": {
"type": "tab",
"settings": {
"title": "About Our Jewelry",
"content": "<p>Our videos are captured using natural window lighting to ensure the most accurate color representation. Please be aware that variations in monitor or phone color settings may impact the perceived colors.<\/p><p><\/p>",
"page": ""
}
},
"contact": {
"type": "contact",
"settings": {
"title": "Ask a question",
"phone": false
}
},
"share": {
"type": "share",
"settings": {
}
},
"4189cd74-4044-4eb5-8dab-6f1809d3a3d0": {
"type": "complementary_products",
"settings": {
"product_complementary_heading": "Pairs well with",
"complementary_count": 4,
"per_slide": 2,
"control_type": "dots",
"image_style": "default"
}
},
"f8a6b5ad-79b0-45d5-9827-5f2c26e4e0a2": {
"type": "shopify:\/\/apps\/judge-me-reviews\/blocks\/review_widget\/61ccd3b1-a9f2-4160-9fe9-4fec8413e5d8",
"settings": {
}
}
},
"block_order": [
"price",
"separator",
"variant_picker",
"buy_buttons",
"description",
"dd86a877-cf16-4d04-b5d4-f7f1bcbdc0a7",
"tab_AzBiFF",
"54e12ba8-6ec0-4824-be95-749cb322bac7",
"tab_xWiwfF",
"contact",
"share",
"4189cd74-4044-4eb5-8dab-6f1809d3a3d0",
"f8a6b5ad-79b0-45d5-9827-5f2c26e4e0a2"
],
"settings": {
"sku_enable": false,
"image_position": "left",
"image_size": "medium",
"product_zoom_enable": true,
"thumbnail_position": "beside",
"thumbnail_height": "fixed",
"thumbnail_arrows": true,
"mobile_layout": "partial",
"enable_video_looping": true,
"product_video_style": "muted"
}
},
"sub": {
"type": "product-full-width",
"disabled": true,
"settings": {
"max_width": true
}
},
"product-recommendations": {
"type": "product-recommendations",
"settings": {
"product_recommendations_heading": "You may also like",
"related_count": 3,
"products_per_row": 2
}
},
"recently-viewed": {
"type": "recently-viewed",
"settings": {
"recent_count": 5
}
},
"collection-return": {
"type": "collection-return",
"settings": {
}
},
"1700940297984aa69c": {
"type": "apps",
"settings": {
"full_width": false,
"space_around": true
}
}
},
"order": [
"main",
"sub",
"product-recommendations",
"recently-viewed",
"collection-return",
"1700940297984aa69c"
]
}
I have more than 100 variants for certain rings on my website, so I am trying to figure out a way to add this option.
@bbtrudell
If you have more than a 100 of variants and the pricing changes based on variant selection, you need to add a third party app for product customization or we can do custom code for the changes of the pricing.
But If the pricing does not change, you can add a line-item attribute and I can assist you with that.
Thank You
The price only changes for the metal quality, and there are 7 different metal options. It's the ring sizes that cause it to go over the 100 variant limit. Ring size does not change the price, only the metal selection. I need a dropdown menu for ring size on certain pages. It is not the same for all templates, and I want to be able to adjust for each template.
In today’s interview, we sat down with @BSS-TekLabs to discuss practical strategies for...
By JasonH Nov 13, 2024The year-end shopping spree is around the corner! Is your online store ready for the ...
By JasonH Nov 10, 2024We recently spoke with Zopi developers @Zopi about how dropshipping businesses can enha...
By JasonH Oct 23, 2024