Applying PartsPal Vehicle Selector, fitment check and part info to certain products pages.

If you are selling other products besides auto parts on your store, you may want to only displaying the vehicle selector, fitment check and part info on product pages that are auto parts specific. Firstly, add in the code snippets from this tutorial as normal. Adding Vehicle YMM to Shopify using PartsPal Code Snippets


To do so, you could have to add a modification to the code in "product-template.liquid"


1. Replace the vehicle selector from

{% include 'product-vehicle-selector' %}

to

{% for c in product.collections %}
    {% if c.handle == "auto-car-parts" %}
    <h1>Choose your vehicle</h1>
    {% include 'product-vehicle-selector' %}
    {% endif %}
{% endfor %}


2. Replace the fitment checker from

{% include 'product-fitment-check' %}

to

{% for c in product.collections %}
    {% if c.handle == "auto-car-parts" %}
    {% include 'product-fitment-check' %}
    {% endif %}
{% endfor %}


3. Replace the part info from

{% include 'product-part-info' %}

to

{% for c in product.collections %}
     {% if c.handle == "auto-car-parts" %}
     {% include 'product-part-info' %}
     {% endif %}
 {% endfor %}

Whats happening in the code?


The code is search for collections that are tagged with auto-car-parts, and if it is, then inserts the vehicle selector, fitment check and part info to the product page.

21 views

Navigation

Solutions

Applications

Links

Integrations