Creating the Edit Transactable Page

Last edit: 

Contributors: 

This guide will help you create an edit page for a Transactable.

This guide is part of a series that follows a scenario to demonstrate how to manage Transactables. You can find previous and next parts of the series in the Requirements and Next steps sections.

Requirements

So that you can follow the steps in this tutorial, you should understand the concept of Transactables. You'll also need to follow the series of tutorials about Transactables until the previous tutorial.

Steps

Creating the edit Transactable page is a two-step process:

  1. Create page
  2. Create GraphQL query

Step 1: Create page

marketplace_builder/views/pages/client/projects/edit.liquid


---
slug: client/projects/edit
---
{% query_graph 'current_user', result_name: 'g' %}
{% query_graph 'get_project', result_name: 'graph_project', slug: context.params.slugs, creator_id: g.current_user.id %}
{% if graph_project %}
  <h1>Edit {{ project.name }}</h1>
  {% include_form 'project', id: graph_project.project.id %}
{% else %}
  <p>Unfortunately we could not find this project.</p>
{% endif %}

This code re-uses the current_user GraphQL query created in the previous tutorial.

Step 2: Create GraphQL query

The code you wrote in step 2 requires you to create a new graphql query that requires two arguments: creator_id and slug

marketplace_builder/graph_queries/get_project.graphql

query client_projects($creator_id: ID!, $slug: String!) {
  project: transactable(creator_id: $creator_id, slug: $slug) {
    id
    name
    slug
  }
}

Next steps

Congratulations! You have created the edit page for a Transactable. Now you can learn about removing a Transactable:

Questions?

We are always happy to help with any questions you may have. Check out our Help page, or contact us.