Shopify Code Help

  • Started
  • Last post
  • 6 Responses
  • pockets

    Hey Guys,

    Im looking to show products with the tag KENTUCKY and hide products tagged with INHOUSE if the customer is tagged with KENTUCKY. Ive followed a few tutorials but when it comes to hiding and showing multiple products based on multiple tags i get a bit lost. Heres my code:…

    Any input on this would be appreciated, I know my code has a error somewhere because i can turn on a set of products and turn off a set of products based on one customer tag..

    thank you

  • pockets0

    I know my code has a error somewhere because i can't*

  • Miguex1

    I dont know code, but...
    shopify has an excellent customer service, I ran into some issues and was able to sort it out over the phone.

    • I think it's 24hs and free with a pro accountMiguex
    • ill probably have to look into this, thanks Migpockets
  • pockets1


    "as much as I would love to help, we don't support customer coding through support unfortunately. Even the theme is third party and 3rd party themes are quite different code wise than the themes built in house by shopify. Best course of action I would take is post on the forums, and worst case scenario, hire an expert. I have used in the past, they were very reasonable price wise and did a great job."


    • aw yeah makes sense.
      maybe some qbn coder will show up and help
  • Mattjanz3n1

    It might be late and I'm reading wrong. I am also no coder but do look at Shopify code on the daily. It seems the only way for a product to prod_inhouse = true would be to have no tags at all.. seems weird. Also, can you do a double if statement, shouldnt it be elseif or close out each if before opening another?…

    {% if product.tags contains 'KENTUCKY' or 'INHOUSE' %}
    {% assign prod_kentucky = true %}
    {% assign prod_inhouse = false %}
    {% else %}
    {% assign prod_kentucky = false %}
    {% assign prod_inhouse = true %}

    {% if customer_kentucky or prod_kentucky == false %}
    {% if customer_kentucky or prod_inhouse == false %}
    {% include 'index_product-items' with collection.handle %}
    {% endif %}
    {% endif %}

  • pockets0

    {% if customer and customer.tags contains 'KENTUCKY' %}
    {% assign customer_kentucky = true %}
    {% else %}
    {% assign customer_kentucky = false %}
    {% endif %}

    {% for product in collection.products %}
    {% include 'bold-product' with product, hide_action: 'skip' %}
    <div class="product-item-wrapper {% cycle 'first', '', '', 'last' %} col-sm-3 col-xs-6 ">
    {% if customer %}

    {% if product.tags contains 'KENTUCKY' %}
    {% if customer_kentucky %}
    {% include 'index_product-items' with collection.handle %}
    {% endif %}
    {% endif %}

    {% if product.tags contains 'INHOUSE' %}
    {% if customer_kentucky == false %}
    {% include 'index_product-items' with collection.handle %}
    {% endif %}
    {% endif %}

    {% if product.tags contains 'dropship' %}
    {% if customer_kentucky == true %}
    {% include 'index_product-items' with collection.handle %}
    {% endif %}
    {% endif %}

    {% else %}

    {% comment %}handle case where no customer exists {% endcomment %}

    {% endif %}

    {% endfor %}

    • works, only took 9 hrspockets
    • but now the products that are hidden cause my layout to get all sorts of fuckedpockets
  • pockets0

    now i need to figure our how to get the products to fill right on the layout..

    • you mark up closing <div> correctly i your product loop?BabySnakes
    • im going to be messing with it today.. past couple of days have made my brain turn into apple saucepockets