Generate a simple product catalog PDF, with Mechanic.

Mechanic is a development and ecommerce automation platform for Shopify. :)

Generate a simple product catalog PDF

This task is a simple demonstration of pulling product titles and images into a PDF, resulting in a simple catalog of the products available in your store. Use it as a starting point for building something more complex.

Runs Occurs when a user manually triggers the task.

15-day free trial – unlimited tasks

Documentation

This task is a simple demonstration of pulling product titles and images into a PDF, resulting in a simple catalog of the products available in your store. Use it as a starting point for building something more complex.

Run this task manually to generate the PDF.

Developer details

Mechanic is designed to benefit everybody: merchants, customers, developers, agencies, Shopifolks, everybody.

That’s why we make it easy to configure automation without code, why we make it easy to tweak the underlying code once tasks are installed, and why we publish it all here for everyone to learn from.

(By the way, have you seen our documentation? Have you joined the Slack community?)

Open source
View on GitHub to contribute to this task
Subscriptions
mechanic/user/trigger
Tasks use subscriptions to sign up for specific kinds of events. Learn more
Code
{% capture html %}
  <h1>Product catalog</h1>
  <ul>
  {% for product in shop.products %}
    {% assign image = product | img_url: "300x300", crop: "center" %}
    <li>
      <b>{{ product.title }}</b>
      <br>
      {% if image %}
        <img src="{{ image }}"/>
      {% else %}
        (no image)
      {% endif %}
    </li>
  {% endfor %}
{% endcapture %}

{% action "files" %}
  {
    "catalog.pdf": {
      "pdf": {
        "html": {{ html | json }}
      }
    }
  }
{% endaction %}
Task code is written in Mechanic Liquid, an extension of open-source Liquid enhanced for automation. Learn more