Plugins
Templates

Shopify Custom Apps Plugin

Link to plugin page: https://zeroqode.com/plugin/shopify-custom-apps-1603968755549x340068118913656960

Introduction

Manage your Shopify Store directly from your Bubble app, like store products, inventory , customers etc. Shopify’s suite of APIs enables you to make Shopify work the way your clients demand. That way, merchants can tailor their experience however they need.

Prerequisites

You must have a Shopify partners account in order to interact with plugin. If you don’t have a Shopify partners account, you can easily create one here.

Note: This plugin is designed to work with Custom Shopify Apps

How to setup

I. Getting the Plugin keys

First, follow these steps to create a Shopify app:

  1. Log in to your Shopify partners account.

  2. In the upper left corner click on ‘Apps’:

3. Click the ‘Create app’ button in the window that will have opened:

4. You will be redirected to the create app page. Choose ‘Custom app’ option. Fill in all the required fields and click the ‘Create app’ button again:

5. You will be redirected to the page with API key and API secret key:

6. Copy the API and APP Secret keys

II. Setting up the Plugin with the keys

Now you need to set these keys in Plugin Settings in your Bubble app.

  1. Fill in these fields with the values you got from the app settings above API_KEY and API_SECRET_KEY.

2. Enter here the URL of your Bubble page where you want the app to be redirected once it’s been authorized with Shopify in APP_URI

3. Enter here the name of your Shopify store that will be used with your Bubble app - SHOP

III. Connecting the app to your store

  1. Return to the app details page and click the ‘Generate link’ button to generate an installation link for the Shopify store that is going to use your app.

2. You’ll be redirected to another page where you will be prompted to enter your merchant’s myshopify.com domain:

3. Enter the domain of your Shopify store and click the ‘Generate link’ button.

Then confirm generating the link:

4. Once the link is generated, you can use it to install the custom app. Read more about installing custom apps here: https://help.shopify.com/en/manual/apps/working-with-apps#install-an-app:

Plugin Element Proprieties

The plugin contains ShopifyAuth element that should be used on the page in order to set up the Shopify authentication process.

Proprieties fields:

  • Access token: should be set to the Shopify access_token obtained during the authentication workflow earlier. Usually it will be a value stored for the current user in the app database

  • Access denied url: url of the page where user has to be redirected in case the app has been denied access by Shopify

Element Actions

  1. Shopify Login - this action is used to start the Shopify login workflow.

Proprieties:

Checkboxes for all the available application scopes. Check all the scopes you need your application to have.

For example:

Element Events

  • Redirected after Shopify auth: This event is triggered once you are redirected back to the Bubble page after having been authorized by Shopify. This event should be used in the authentication process.

  • Redirect URL for login is ready: This event is triggered once the “Redirect URL for login” is generated by the plugin

Element States

  • Auth Code: authentication code obtained from Shopify during authentication

  • Hostname: hostname of the Shopify store. Composed from the store name returned by Shopify during authentication. Store it to the app database for the current user to use it later in all your API calls.

  • Redirect URL for login: the URL where you have to redirect your users to authorize with Shopify once the “Redirect URL for login is ready” event is triggered

Plugin Actions

  1. Shopify: Auth

Action properties:

Auth Code: authentication code obtained from Shopify during authentication. Set it equal to the value from the Auth Code exposed state of the ShopifyAuth plugin element.

Plugin States

Returned values:

error: in case of error, will contain the error message response_status: the status of the response received from the server access_token: access token to be used for all your subsequent requests to the Shopify server expires_in: the number of seconds until the access token expires scope: the list of access scopes that were granted to the application and are associated with the access token associated_user: information about the user who completed the OAuth authorization flow associated_user_scope: the list of access scopes that were granted to the app and are available for this access token, given the user’s permissions

Plugin Action Calls

For every API Call you have to indicate:

hostname: hostname of the Shopify store. Use the plugin element exposed state: ShopifyAuth’s Hostname

X-Shopify-Access-Token: Shopify access token. Use the access token you got from Shopify during authentication process

Besides these, for most of the API Calls you’ll have to fill in other properties. Refer to each property documentation for more details.

List of Calls

PRODUCTS

This call is an Action call type and a JSON data type. It is a GET request which is used to get a count of all products in the store.

The action comes with one URL parameter:

  • hostname: Shopify store URL

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

2. Products: Get all Retrieves a list of products

This call is an Action call type and a JSON data type. It is a GET request which is used to get a list of all products in the store.

The action comes with one URL parameter:

  • hostname: Shopify store URL

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

3. Products: Get one Retrieves a single product

This call is an Action call type and a JSON data type. It is a GET request which is used to get one product in the store.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • product_id: id of the product you want to get

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

4. Products: Create one Creates a new product

This call is an Action call type and a JSON data type. It is a POST request which is used to create a new product in the store.

The action comes with one URL parameter:

  • hostname: Shopify store URL,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • title: product title (required)

  • description: product description (required)

  • vendor: product vendor (required)

  • product_type: product type (required)

  • image_url: image URL (optional)

  • tags: a string of comma-separated tags that are used for filtering and search (optional)

  • options: product options in the following format: {"name": "Size", "values": ["Small","Medium"]},{"name": "Color", "values": ["Red","Blue"]} (required)

  • published: whether the product should be published, available values: true, false (required)

  • variants: variants for the product in the following format: {"option1": "Small","option2": "Red","price":29},{"option1": "Medium","option2": "Blue","price":35},{"option1": "Medium","option2": "Red","price":29} (required)

  • seo_title: product title for SEO purposes (optional)

  • seo_description: product description for SEO purposes (optional)

5. Products: Update one Updates a product

This call is an Action call type and a JSON data type. It is a PUT request which is used to update a certain product in the store.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • product_id: id of the product you want to update,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • product_id: id of the product to update (required)

  • new_title: new or old product title (required)

  • new_tags: new or old product tags (required)

  • new_published: new or old product published status (required)

  • new_description: new or old product description (required)

This call is an Action call type and a JSON data type. It is a PUT request which is used to update a certain product’s SEO fields.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • product_id: id of the product you want to update,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • product_id: id of the product to update meta (required)

  • new_seo_title: new or old product title for SEO (required)

  • new_seo_description: new or old product description for SEO (required)

7. Products: Delete one Deletes a product

This call is an Action call type and a JSON data type. It is a DELETE request which is used to delete a certain product from the store.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • product_id: id of the product to delete

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

CUSTOMERS

8. Customers: Get count Retrieves a count of customers

This call is an Action call type and a JSON data type. It is a GET request which is used to get the customers count for the store.

The action comes with one URL parameter:

  • hostname: Shopify store URL

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

9. Customers: Get all Retrieves a list of customers

This call is an Action call type and a JSON data type. It is a GET request which is used to get a list of all customers for the store.

The action comes with one URL parameter:

  • hostname: Shopify store URL

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

10. Customers: Get one Retrieves a single customer

This call is an Action call type and a JSON data type. It is a GET request which is used to get a certain store customer information.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • customer_id: id of the customer to get

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

11. Customers: Search customer Searches for customers that match a supplied query

This call is an Action call type and a JSON data type. It is a GET request which is used to get customers that satisfy the search criteria.

The action comes with three URL parameters:

  • hostname: Shopify store URL

  • query: text to search for in the store’s customer data (required)

  • limit: maximum number of results to show (required)

as well as one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

12. Customers: Get customer orders Retrieves all orders belonging to a customer

This call is an Action call type and a JSON data type. It is a GET request which is used to get orders for a certain customer.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • customer_id: id of the customer to get orders for

as well as one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

13. Customers: Create one Creates a customer

This call is an Action call type and a JSON data type. It is a POST request which is used to create a new customer.

The action comes with one URL parameter:

  • hostname: Shopify store URL,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • first_name: customer first name (required)

  • last_name: customer last name (required)

  • email: customer email (required)

  • phone: customer phone number (required)

  • address_city: customer address city (required)

  • address_province: customer address province (required)

  • address_phone: customer address phone (optional)

  • address_zip: customer address zip code (required)

  • address_firstname: customer address first name (optional)

  • address_lastname: customer address last name (optional)

  • address_country: the two-letter country code corresponding to the customer's country (required)

  • address_street: customer address - street address (required)

  • email_is_verified: whether the customer email is already verified, accepted values: true, false

  • send_email_welcome: whether to send a welcome email to the customer, accepted values: true, false

  • send_email_invite: whether to send an email invite to the customer, accepted values: true, false

  • tags: tags that the store owner has attached to the customer, formatted as a string of comma-separated values (optional)

14. Customers: Create account activation URL Creates an account activation URL for a customer

This call is an Action call type and a JSON data type. It is a POST request which is used to create an account activation link for a customer.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • customer_id: id of the customer for whom the account activation link will be created

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

15. Customers: Send customized invite Sends an account invite to a customer

This call is an Action call type and a JSON data type. It is a POST request which is used to send customized invite to a customer.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • customer_id: id of the customer to send the invite to,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • customer_email: customer email (required)

  • your_email: sender email (required)

  • hidden_copy_email: hidden copy email (required)

  • email_subject: email subject (required)

  • email_message: email message (required)

16. Customers: Update customer information Updates a customer

This call is an Action call type and a JSON data type. It is a PUT request which is used to update information for a certain customer.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • customer_id: id of the customer to update,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • customer_id: id of the customer to update

  • changed_firstname: new or old customer first name (required)

  • changed_last_name: new or old customer last name (required)

  • changed_email: new or old customer email (required)

  • changed_phone: new or old customer phone (required)

  • changed_addr_street: new or old customer street address (required)

  • changed_addr_city: new or old customer address city (required)

  • changed_addr_province: new or old customer address province (required)

  • changed_addr_phone: new or old customer address phone (required; if not set, previous phone will be overwritten and set to 'null')

  • changed_addr_zip: new or old customer address zip (required)

  • changed_addr_firstname: new or old customer address first name (required)

  • changed_addr_lastname: new or old customer address last name (required)

  • changed_addr_country: new or old customer address country, 2 letter code (required)

  • new_note_about_customer: new or previous note from the customer (required; if not set, previous notes will be overwritten and set to 'null')

  • changed_tags: new or previous tags for the customer (required; if not set, previous tags will be overwritten and set to 'null')

17. Customers: Update marketing campaign settings Updates a customer marketing opt-in state

This call is an Action call type and a JSON data type. It is a PUT request which is used to update marketing campaign settings for a customer.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • customer_id: id of the customer to update marketing campaign settings,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • customer_id: customer id (required)

  • accepts_marketing: whether the customer has consented to receive marketing material via email; accepted values: true, false (required)

  • accepts_marketing_updated_at_time: the date and time (ISO 8601 format) when the customer consented or objected to receiving marketing material by email (required)

  • marketing_opt_in_level: the marketing subscription opt-in level; accepted values: single_opt_in, confirmed_opt_in, unknown

18. Customers: Delete one Deletes a customer

This call is an Action call type and a JSON data type. It is a DELETE request which is used to delete a customer from the store.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • customer_id: id of the customer to delete

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

INVENTORY

19. Inventory: Get items Retrieves a list of inventory items

This call is an Action call type and a JSON data type. It is a GET request which is used to get a list of inventory items.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • comma_separated_ids: comma-separated list of inventory items IDs to get (required)

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

20. Inventory: Get item Retrieves a single inventory item by ID

This call is an Action call type and a JSON data type. It is a GET request which is used to get an inventory item.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • inventory_item_id: inventory item id to get

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

21. Inventory: Update item Updates an existing inventory item

This call is an Action call type and a JSON data type. It is a PUT request which is used to update an inventory item.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • inventory_item_id: inventory item id to update,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • inventory_item_id: inventory item ID (required)

  • new_sku: new or previous SKU for the item (if not set, the value will be set to 'null')

  • new_cost: new or previous cost (required)

  • requires_shipping: whether the item requires shipping, acceptable values: true, false (required)

  • is_tracked: whether the inventory item is tracked, acceptable values: true, false (required)

22. Inventory: Get inventory levels Retrieves a list of inventory levels

This call is an Action call type and a JSON data type. It is a GET request which is used to get a list of inventory levels.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • location_ids: a comma-separated list of location IDs

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

23. Inventory: Get inventory levels (with query) Retrieves a list of inventory levels for specified items and locations

This call is an Action call type and a JSON data type. It is a GET request which is used to get a list of inventory levels for specified items and locations.

The action comes with three URL parameters:

  • hostname: Shopify store URL

  • inventory_item_ids: a comma-separated list of inventory item IDs

  • location_ids: a comma-separated list of location IDs

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

24. Inventory: Get locations count Retrieves a count of locations

This call is an Action call type and a JSON data type. It is a GET request which is used to get overall locations count.

The action comes with one URL parameter:

  • hostname: Shopify store URL

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

25. Inventory: Get locations Retrieves a list of locations

This call is an Action call type and a JSON data type. It is a GET request which is used to get all locations for a store.

The action comes with one URL parameter:

  • hostname: Shopify store URL

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

26. Inventory: Get one location Retrieves a single location by its ID

This call is an Action call type and a JSON data type. It is a GET request which is used to get a specific location for a store.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • location_id: ID of the location to get

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

27. Inventory: Get inventory levels for location Retrieves a list of inventory levels for a location

This call is an Action call type and a JSON data type. It is a GET request which is used to get a list of inventory levels for a specific location.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • location_id: ID of the location for which to get inventory levels

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

28. Inventory: Adjust inventory level Adjusts the inventory level of an inventory item at a location

This call is an Action call type and a JSON data type. It is a POST request which is used to adjust the inventory level of an inventory item at a location.

The action comes with one URL parameter:

  • hostname: Shopify store URL,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • location_id: location ID (required)

  • inventory_item_id: inventory item ID (required)

  • quantity_adjustment: positive or negative number (to increase or decrease inventory count for the specified item) (required)

29. Inventory: Connect item to location Connects an inventory item to a location

This call is an Action call type and a JSON data type. It is a POST request which is used to connect an inventory level to a location.

The action comes with one URL parameter:

  • hostname: Shopify store URL,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and two body parameters:

  • location_id: location ID (required)

  • inventory_item_id: inventory item ID (required)

This call is an Action call type and a JSON data type. It is a POST request which is used to set the inventory level for an inventory item at a location.

The action comes with one URL parameter:

  • hostname: Shopify store URL,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • location_id: location ID (required)

  • inventory_item_id: inventory item ID (required)

  • available_quantity: available quantity (required)

31. Inventory: Delete item from location Deletes an inventory level from a location

This call is an Action call type and a JSON data type. It is a DELETE request which is used to delete an inventory level from a location.

The action comes with three URL parameters:

  • hostname: Shopify store URL

  • inventory_item_id: inventory item ID (required)

  • location_id: location ID (required)

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

ORDERS

32. Orders: Get orders Retrieves a list of orders

This call is an Action call type and a JSON data type. It is a GET request which is used to get a list of orders for the store.

The action comes with several URL parameters:

  • hostname: Shopify store URL

  • status: status by which to filter orders; accepted values: open, closed, cancelled, any

  • financial_status: financial status by which to filter orders; accepted values: authorized, pending, paid, partially_paid, refunded, voided, partially_refunded, unpaid, any

  • fulfillment_status: fulfillment status by which to filter orders; accepted values: shipped, unshipped, partial, unfulfilled, any

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

33. Orders: Get one order Retrieves a specific order

This call is an Action call type and a JSON data type. It is a GET request which is used to get a specific order.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • order_id: ID of the order to get

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

34. Orders: Get orders count Retrieves an order count

This call is an Action call type and a JSON data type. It is a GET request which is used to get the total order count.

The action comes with one URL parameter:

  • hostname: Shopify store URL

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

35. Orders: Close one order Closes an order

This call is an Action call type and a JSON data type. It is a POST request which is used to close a specific order.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • order_id: ID of the order to close

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

36. Orders: Reopen closed order Re-opens a closed order

This call is an Action call type and a JSON data type. It is a POST request which is used to reopen a closed order.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • order_id: ID of the order to reopen

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

37. Orders: Cancel order Cancels an order

This call is an Action call type and a JSON data type. It is a POST request which is used to cancel a specific order.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • order_id: ID of the order to cancel,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • cancel_note: cancel note (required)

  • cancel_reason: the reason for the order cancellation; accepted values: customer, inventory, fraud, declined, and other (required)

  • should_email_customer: whether to send an email to the customer notifying them of the cancellation; accepted values: true, false (required)

38. Orders: Cancel and refund order Cancels and refunds an order

This call is an Action call type and a JSON data type. It is a POST request which is used to cancel and refund a specific order.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • order_id: ID of the order to cancel and refund,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • cancel_note: cancel note (required)

  • cancel_amount: cancel amount (required)

  • cancel_currency: cancel currency (required)

  • should_email_customer: whether to send an email to the customer notifying them of the cancellation; accepted values: true, false (required)

  • cancel_reason: the reason for the order cancellation; accepted values: customer, inventory, fraud, declined, and other (required)

This call is an Action call type and a JSON data type. It is a POST request which is used to create an order for a given customer id.

The action comes with one URL parameter:

  • hostname: Shopify store URL,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • variant_id: product variant ID (required)

  • quantity: item variant quantity (required)

  • fulfillment_status: fulfillment status; accepted values: fulfilled, partial, null, restocked

  • financial_status: the status of payments associated with the order; valid values: pending, authorized, partially_paid, paid, partially_refunded, refunded, voided

  • send_receipt: whether to send an order confirmation to the customer; accepted values: true, false

  • send_fulfillment_receipt: whether to send a shipping confirmation to the customer; accepted values: true, false

  • customer_id: customer ID (required)

40. Orders: Create order - multiple products (customer id) Creates an order (for the given customer id, multiple product variants)

This call is an Action call type and a JSON data type. It is a POST request which is used to create an order with multiple products for a given customer id.

The action comes with one URL parameter:

  • hostname: Shopify store URL,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • line_items: line items in the following format: {"variant_id":36295414513827,"quantity":1},{"variant_id":36273368400035,"quantity":2} (required)

  • fulfillment_status: fulfillment status; accepted values: fulfilled, partial, null, restocked

  • financial_status: the status of payments associated with the order; valid values: pending, authorized, partially_paid, paid, partially_refunded, refunded, voided

  • send_receipt: whether to send an order confirmation to the customer; accepted values: true, false

  • send_fulfillment_receipt: whether to send a shipping confirmation to the customer; accepted values: true, false

  • customer_id: customer ID (required)

41. Orders: Create order (customer email) Creates an order (for the given customer email, one product variant)

This call is an Action call type and a JSON data type. It is a POST request which is used to create an order for a given customer email.

The action comes with one URL parameter:

  • hostname: Shopify store URL,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • variant_id: product variant ID (required)

  • quantity: item variant quantity (required)

  • fulfillment_status: fulfillment status; accepted values: fulfilled, partial, null, restocked

  • financial_status: the status of payments associated with the order; valid values: pending, authorized, partially_paid, paid, partially_refunded, refunded, voided

  • send_receipt: whether to send an order confirmation to the customer; accepted values: true, false

  • send_fulfillment_receipt: whether to send a shipping confirmation to the customer; accepted values: true, false

  • customer_email: customer email (required)

42. Orders: Create order - multiple products (customer email) Creates an order (for the given customer email, multiple product variants)

This call is an Action call type and a JSON data type. It is a POST request which is used to create an order with multiple products for a given customer email.

The action comes with one URL parameter:

  • hostname: Shopify store URL,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • line_items: line items in the following format: {"variant_id":36295414513827,"quantity":1},{"variant_id":36273368400035,"quantity":2} (required)

  • fulfillment_status: fulfillment status; accepted values: fulfilled, partial, null, restocked

  • financial_status: the status of payments associated with the order; valid values: pending, authorized, partially_paid, paid, partially_refunded, refunded, voided

  • send_receipt: whether to send an order confirmation to the customer; accepted values: true, false

  • send_fulfillment_receipt: whether to send a shipping confirmation to the customer; accepted values: true, false

  • customer_email: customer email (required)

43. Orders: Create order (customer addresses) Creates an order (with shipping/billing addresses, one product variant)

This call is an Action call type and a JSON data type. It is a POST request which is used to create an order with shipping and billing addresses.

The action comes with one URL parameter:

  • hostname: Shopify store URL,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • variant_id: product variant ID (required)

  • quantity: item variant quantity (required)

  • fulfillment_status: fulfillment status; accepted values: fulfilled, partial, null, restocked

  • financial_status: the status of payments associated with the order; valid values: pending, authorized, partially_paid, paid, partially_refunded, refunded, voided

  • send_receipt: whether to send an order confirmation to the customer; accepted values: true, false

  • send_fulfillment_receipt: whether to send a shipping confirmation to the customer; accepted values: true, false

  • customer_first_name: customer first name (required)

  • customer_last_name: customer last name (required)

  • customer_email: customer email (required)

  • billing_address_first_name: customer billing address first name (required)

  • billing_address_last_name: customer billing address last name (required)

  • billing_address_street_address: customer billing address street address (required)

  • billing_address_city: customer billing address city (required)

  • billing_address_province: customer billing address province (required)

  • billing_address_country: customer billing address country (required)

  • billing_address_zip: customer billing address zip code (required)

  • shipping_address_first_name: customer shipping address first name (required)

  • shipping_address_last_name: customer shipping address last name (required)

  • shipping_address_street_address: customer shipping address street address (required)

  • shipping_address_city: customer shipping address city (required)

  • shipping_address_province: customer shipping address province (required)

  • shipping_address_country: customer shipping address country (required)

  • shipping_address_zip: customer shipping address zip code (required)

44. Orders: Create order - multiple products (customer addresses) Creates an order (with shipping/billing addresses, multiple product variants)

This call is an Action call type and a JSON data type. It is a POST request which is used to create an order for multiple products with shipping and billing addresses.

The action comes with one URL parameter:

  • hostname: Shopify store URL,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • line_items: line items in the following format: {"variant_id":36295414513827,"quantity":1},{"variant_id":36273368400035,"quantity":2} (required)

  • fulfillment_status: fulfillment status; accepted values: fulfilled, partial, null, restocked

  • financial_status: the status of payments associated with the order; valid values: pending, authorized, partially_paid, paid, partially_refunded, refunded, voided

  • send_receipt: whether to send an order confirmation to the customer; accepted values: true, false

  • send_fulfillment_receipt: whether to send a shipping confirmation to the customer; accepted values: true, false

  • customer_first_name: customer first name (required)

  • customer_last_name: customer last name (required)

  • customer_email: customer email (required)

  • billing_address_first_name: customer billing address first name (required)

  • billing_address_last_name: customer billing address last name (required)

  • billing_address_street_address: customer billing address street address (required)

  • billing_address_city: customer billing address city (required)

  • billing_address_province: customer billing address province (required)

  • billing_address_country: customer billing address country (required)

  • billing_address_zip: customer billing address zip code (required)

  • shipping_address_first_name: customer shipping address first name (required)

  • shipping_address_last_name: customer shipping address last name (required)

  • shipping_address_street_address: customer shipping address street address (required)

  • shipping_address_city: customer shipping address city (required)

  • shipping_address_province: customer shipping address province (required)

  • shipping_address_country: customer shipping address country (required)

  • shipping_address_zip: customer shipping address zip code (required)

45. Orders: Create order (with discount) Creates an order (with discount, one product variant)

This call is an Action call type and a JSON data type. It is a POST request which is used to create an order with a discount.

The action comes with one URL parameter:

  • hostname: Shopify store URL,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • variant_id: product variant ID (required)

  • quantity: item variant quantity (required)

  • fulfillment_status: fulfillment status; accepted values: fulfilled, partial, null, restocked

  • financial_status: the status of payments associated with the order; valid values: pending, authorized, partially_paid, paid, partially_refunded, refunded, voided

  • send_receipt: whether to send an order confirmation to the customer; accepted values: true, false

  • send_fulfillment_receipt: whether to send a shipping confirmation to the customer; accepted values: true, false

  • customer_id: customer ID (required)

  • discount_code: string representing the code of the discount

  • discount_amount: the amount that's deducted from the order total

  • discount_type: the type of discount. Default value: fixed_amount. Valid values: fixed_amount, percentage

46. Orders: Create order - multiple products (with discount) Creates an order (with discount, multiple product variants)

This call is an Action call type and a JSON data type. It is a POST request which is used to create an order of multiple products with a discount.

The action comes with one URL parameter:

  • hostname: Shopify store URL,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • line_items: order items in the following format: {"variant_id":36273367970000,"quantity":1},{"variant_id":36273368400000,"quantity":2} (required)

  • fulfillment_status: fulfillment status; accepted values: fulfilled, partial, null, restocked

  • financial_status: the status of payments associated with the order; valid values: pending, authorized, partially_paid, paid, partially_refunded, refunded, voided

  • send_receipt: whether to send an order confirmation to the customer; accepted values: true, false

  • send_fulfillment_receipt: whether to send a shipping confirmation to the customer; accepted values: true, false

  • customer_id: customer ID (required)

  • discount_code: string representing the code of the discount

  • discount_amount: the amount that's deducted from the order total

  • discount_type: the type of discount. Default value: fixed_amount. Valid values: fixed_amount, percentage

47. Orders: Create order (with discount and addresses) Creates an order (with discount and shipping/billing addresses, one product variant)

This call is an Action call type and a JSON data type. It is a POST request which is used to create an order with a discount and with indicated shipping and billing addresses.

The action comes with one URL parameter:

  • hostname: Shopify store URL,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • variant_id: product variant ID (required)

  • quantity: item variant quantity (required)

  • fulfillment_status: fulfillment status; accepted values: fulfilled, partial, null, restocked

  • financial_status: the status of payments associated with the order; valid values: pending, authorized, partially_paid, paid, partially_refunded, refunded, voided

  • send_receipt: whether to send an order confirmation to the customer; accepted values: true, false

  • send_fulfillment_receipt: whether to send a shipping confirmation to the customer; accepted values: true, false

  • customer_id: customer ID (required)

  • billing_address_first_name: customer billing address first name (required)

  • billing_address_last_name: customer billing address last name (required)

  • billing_address_street_address: customer billing address street address (required)

  • billing_address_city: customer billing address city (required)

  • billing_address_province: customer billing address province (required)

  • billing_address_country: customer billing address country (required)

  • billing_address_zip: customer billing address zip code (required)

  • shipping_address_first_name: customer shipping address first name (required)

  • shipping_address_last_name: customer shipping address last name (required)

  • shipping_address_street_address: customer shipping address street address (required)

  • shipping_address_city: customer shipping address city (required)

  • shipping_address_province: customer shipping address province (required)

  • shipping_address_country: customer shipping address country (required)

  • shipping_address_zip: customer shipping address zip code (required)

  • discount_code: string representing the code of the discount

  • discount_amount: the amount that's deducted from the order total

  • discount_type: the type of discount. Default value: fixed_amount. Valid values: fixed_amount, percentage

48. Orders: Create order - multiple products (with discount and addresses) Creates an order (with discount and shipping/billing addresses, multiple product variants)

This call is an Action call type and a JSON data type. It is a POST request which is used to create an order for multiple products with a discount and with indicated shipping and billing addresses.

The action comes with one URL parameter:

  • hostname: Shopify store URL,

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • line_items: order items in the following format: {"variant_id":36273367970000,"quantity":1},{"variant_id":36273368400000,"quantity":2} (required)

  • fulfillment_status: fulfillment status; accepted values: fulfilled, partial, null, restocked

  • financial_status: the status of payments associated with the order; valid values: pending, authorized, partially_paid, paid, partially_refunded, refunded, voided

  • send_receipt: whether to send an order confirmation to the customer; accepted values: true, false

  • send_fulfillment_receipt: whether to send a shipping confirmation to the customer; accepted values: true, false

  • customer_id: customer ID (required)

  • billing_address_first_name: customer billing address first name (required)

  • billing_address_last_name: customer billing address last name (required)

  • billing_address_street_address: customer billing address street address (required)

  • billing_address_city: customer billing address city (required)

  • billing_address_province: customer billing address province (required)

  • billing_address_country: customer billing address country (required)

  • billing_address_zip: customer billing address zip code (required)

  • shipping_address_first_name: customer shipping address first name (required)

  • shipping_address_last_name: customer shipping address last name (required)

  • shipping_address_street_address: customer shipping address street address (required)

  • shipping_address_city: customer shipping address city (required)

  • shipping_address_province: customer shipping address province (required)

  • shipping_address_country: customer shipping address country (required)

  • shipping_address_zip: customer shipping address zip code (required)

  • discount_code: string representing the code of the discount

  • discount_amount: the amount that's deducted from the order total

  • discount_type: the type of discount. Default value: fixed_amount. Valid values: fixed_amount, percentage

49. Orders: Update order (add note) Updates an order (by adding a customer note)

This call is an Action call type and a JSON data type. It is a PUT request which is used to update an order by adding a customer note to it.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • order_id: ID of the order to update

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and two body parameters:

  • order_id: ID of the order to update (required)

  • note: note from the customer (required)

50. Orders: Update order (change email) Updates an order (by changing the email)

This call is an Action call type and a JSON data type. It is a PUT request which is used to update an order by changing the email associated with it.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • order_id: ID of the order to update

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and two body parameters:

  • order_id: ID of the order to update (required)

  • email: email linked to the order (required)

51. Orders: Update order (remove customer) Updates an order (by removing the customer)

This call is an Action call type and a JSON data type. It is a PUT request which is used to update an order by removing the customer associated with it.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • order_id: ID of the order to update

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and one body parameter:

  • order_id: ID of the order to update (required)

52. Orders: Update order (change shipping address) Updates an order (by changing the shipping address)

This call is an Action call type and a JSON data type. It is a PUT request which is used to update an order by changing the shipping address associated with it.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • order_id: ID of the order to update

one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

and several body parameters:

  • order_id: ID of the order to update (required)

  • shipping_address_firstname: customer shipping address first name (required)

  • shipping_address_lastname: customer shipping address last name (required)

  • address1: customer shipping address street address (required)

  • city: customer shipping address city (required)

  • province: customer shipping address province (required)

  • country: customer shipping address country (required)

  • zip: customer shipping address zip code (required)

53. Orders: Delete order Deletes an order

This call is an Action call type and a JSON data type. It is a DELETE request which is used to delete an order.

The action comes with two URL parameters:

  • hostname: Shopify store URL

  • order_id: ID of the order to delete

and one header parameter:

  • X-Shopify-Access-Token: Shopify access token obtained during authentication

Workflow example

Authentication Process

  1. Place the ShopifyAuth element on the page and set its properties:

  • Access token: set this property to the value of the access token for the current user. We advise you to store it in the database for the current user. It will not be populated when the page is first loaded, but will be populated and used later

  • Access denied url: set this property to the url of the page where you want your users to be redirected in case the access to the Shopify store has been denied

2. Create the login workflow. (You can connect it to a Bubble button or any other element if applicable. On our demo page we connected it to the ‘Shopify Login’ button). In this workflow, run the plugin element’s ‘Shopify Login’ action, setting checkboxes for all the scopes needed for the app.

3. Create the workflow for redirecting users to Shopify for authentication. This workflow should be triggered once the “Redirect URL for login is ready” event is triggered by the plugin ShopifyAuth element. In ‘Step 1’ of this workflow use ‘Open an external website’ navigation action, and specify ShopifyAuth’s Redirect URL for login as the ‘Destination’:

4. Create a new workflow, triggered when ShopifyAuth’s Redirected after Shopify auth event occurs. In this workflow, on the first step, run the Shopify: Auth plugin action, setting the properties the following way:

  • Auth Code: This ShopifyAuth’s Auth Code

  • Only when: This ShopifyAuth’s Auth Code is not empty

On the second step, make changes to the Current User, saving to the database 1. the access token кeceived on the previous step, and 2. the ShopifyAuth element Hostname state.

Now you have the access token and the hostname that should be used for all the API Calls.

Authentication Process (AT WORK)

  1. Once you click the ‘Shopify Login’ button (or another element you associated the login workflow with) in the Bubble app, you will be prompted to login into your Shopify account and redirected to the Shopify permissions page. Click the ‘Install app’ button to give your app the permissions indicated on this page (they depend on the scopes you have chosen for the Shopify Login action).

2. In case of successful authentication, you will be redirected to the page you set up in the Plugin Settings as APP_URI.

Logout Process

  1. Add to your page a button that will trigger the Logout workflow. (Or set it to be triggered in another way, if applicable. On our demo page it is the ‘Shopify Logout’ button).

  2. Add the following workflow triggered by the above button:

  • step 1: Log the user out

  • step 2: Go to page <Indicate here the page name where you want the user to be redirected on logout. If it is the current page, indicate here the name of the current page. Do not omit this step.>

Changelongs

Update 8/11/20 -

  • Added 'Redirect URL for login' state and 'Redirect URL for login is ready' event for better authentication flow

Demo to preview the settings: