Integration with Shopify
Let’s create a small ecommerce with several goods for sale using Shopify.
#
1. Customizing Shopify#
1.1 Creating a Shopify accountGo to shopify.dev and click Sign up.
Enter your registration information and click Create Shopify ID.
The next step is to enter additional information and click View your dashboard.
After that, we will get to the Shopify Partners dashboard.
#
1.2 Creating a Shopify storeNext, you need to create a Shopify store. Click the Add store button.
Choose Development store.
Enter the data to create a store and click Save.
#
1.3 Getting Storefront API access tokenGo to the Stores tab and select our store.
Then press Log in.
This will bring us to the management page of our store. Select the Apps tab in the left pane.
Click Develop apps for your store.
Click Allow custom app development.
Press Allow custom app development again.
Click Create an app.
Enter the name of the application and click Create app.
After creating the application, you need to configure the scopes. Click Configure Storefront API scopes.
For our example, these settings are necessary:
unauthenticated_write_checkouts
unauthenticated_read_checkouts
unauthenticated_read_product_listings
Then go to the API credentials tab and click Install app.
Confirm our action.
We got the Storefront API access token, which we will need later on.
#
1.4 Adding items to the storeIn the store, select the Products tab and then click Add product.
Enter Title, Description, add Media, configure Pricing and Inventory. In Product status select Active.
After adding a few products will look something like this:
#
2 Creating a project in QuarklyCreate an empty project in Quarkly.
#
2.1 ReduxStore component (module)Create a component called ReduxStore. This will be a module with redux storage. Read more about redux: https://redux.js.org/introduction/getting-started
Copy the code below and paste it into our component. Change
- STOREFRONT_ACCESS_TOKEN to Storefront API access token, which we obtained in step 1.3
- DOMAIN - the domain of our Shopify store (ends in .myshopify.com)
#
2.2 App componentCreate a component called App. It will contain the provider for the redux store.
Copy the code below and paste it into our component.
#
2.3 Product componentCreate a component called Product. This will be a product card.
Copy the code below and paste it into our component.
#
2.4 Component ProductsCreate a component called Products. This will be a list of products.
Copy the code below and paste it into our component.
#
2.5 Cart componentCreate a component called Cart. This will be the cart.
Copy the code below and paste it into our component.
#
2.6 CartItem componentCreate a component called CartItem. This is the component for displaying the item in the cart.
Copy the code below and paste it into our component.
#
2.7 CartBadge componentCreate a component called CartBadge. This is a component for displaying the number of items in the cart.
Copy the code below and paste it into our component.
#
2.8 Adding a MobileSidePanel component from the catalogAdd a MobileSidePanel component from the catalog.
#
2.9 Creating the Index PageCopy the code below and paste it into our page.