Showing Giftships Options Only On Certain Products

Follow
 

 

Showing the gift options only on certain products can be quite easily accomplished with a small snippet of liquid and CSS in your theme. For example, if you have the product type of all of your gifts set to "Gift Product", you can add the following to your theme.liquid file right before the closing </body> tag:
{% if template contains 'product' %}

{% comment %} 

Change 'Gift Product' below to the product type of your Gift products

{% endcomment %}

{% if product.type != 'Gift Product' %}

<style>

#gsAppContainer {

display: none !important;

}

/* This hides all of Giftships options on the product page, but you can refine this to hide only certain parts */

</style>

<script type="text/javascript">
var GsLoaded = function(){

var _removeBox = function(){
setTimeout(function(){
var giftship_box = document.getElementById('gsAppContainer');
if(typeof(giftship_box) != 'undefined' && giftship_box != null){
giftship_box.parentNode.removeChild(giftship_box);
} else {
_removeBox();
}
}, 100);
}

_removeBox();


}
/* IMPORTANT : This is necessary if you have any options set to required in Giftship, otherwise, customers will not be able to add products to the cart! */
/* This removes all of Giftships options, but you can refine this to remove only certain options *
</script>

{% endif %}

{% endif %}
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.