Skip to main content

Actions

Appmaker Platform provides a set of predefined actions that you can use in your app.

OPEN_COLLECTION

Opens a collection page.

ParamTypeDescription
collectionIdstringThe id of the collection to open
collectionHandlestringThe handle of the collection to open
filtersobjectThe filters to apply to the collection
sortobjectThe sort to apply to the collection
titlestringThe title of the collection page

collectionId or collectionHandle is mandatory.

Example:

{
action: 'OPEN_COLLECTION',
collectionId: 'gid://shopify/Collection/1234567890',
title: 'My Collection'
}

OPEN_PRODUCT

Opens a single product page.

ParamTypeDescription
productIdstringThe id of the product to open
productHandlestringThe handle of the product to open

Example:

{
action: 'OPEN_PRODUCT',
params : {
productHandle: 'my-product'
}
}

OPEN_CART

Opens the cart page.

Example:

{
action: 'OPEN_CART',
}

START_CHECKOUT

Opens the checkout page.

Example:

{
action: 'START_CHECKOUT',
}

Opens the search page.

Example:

{
action: 'OPEN_SEARCH',
}

SHOW_MESSAGE

Shows a message to the user.

ParamTypeDescription
titlestringThe message to show

Example:

{
action: 'SHOW_MESSAGE',
params:{
title: 'Hello World',
}
}

OPEN_URL

Opens a URL in the browser.

ParamTypeDescription
urlstringThe URL to open

Example:

{
action: 'OPEN_URL',
params:{
url: 'https://www.shopify.com',
}
}

OPEN_INAPP_PAGE

Opens a page in the app.

ParamTypeDescription
pageIdstringThe id of the page to open
titlestringThe title of the page to open
replacePagebooleanWhether to replace the current page or not

Example:

{
action: 'OPEN_INAPP_PAGE',
pageId: 'home',
params:{
title: 'My Page',
replacePage: true
}
}

OPEN_HOME

Opens the home page.

ParamTypeDescription
replacePagebooleanWhether to replace the current page or not

Example:

{
action: 'OPEN_HOME',
params:{
replacePage: true
}
}

APPLY_COUPON

Applies a coupon to the cart.

ParamTypeDescription
couponstringThe coupon code to apply
goBackAfterApplybooleanWhether to go back to the previous page after applying the coupon

Example:

{
action: 'APPLY_COUPON',
params:{
coupon: 'MY_COUPON',
goBackAfterApply: true
}
}

REMOVE_COUPON

Removes a coupon from the cart.

ParamTypeDescription
couponstringThe coupon code to remove

Example:

{
action: 'REMOVE_COUPON',
params:{
coupon: 'MY_COUPON',
}
}

CLEAR_CART

Clears the cart.

Example:

{
action: 'CLEAR_CART',
}

ADD_TO_CART_V2

Adds a product to the cart.

ParamTypeDescription
productobjectThe product to add to the cart
variantobjectThe variant of the product to add to the cart
quantitynumberThe quantity of the product to add to the cart
customAttributesobjectThe custom attributes of the product to add to the cart

Example:

{
action: 'ADD_TO_CART_V2',
params: {
product: {node: {id: 'gid://shopify/Product/1234567890'}},
variant: {node: {id: 'gid://shopify/ProductVariant/1234567890'}},
quantity: 1,
customAttributes: {key:'appmaker', value:'true'}
}
}

For analytics to work, you must send whole product and variant object

Example:

Details
const customAttributes = [
{
"key": "_appmaker",
"value": "true"
}
]
const variant = {
"id": "gid://shopify/ProductVariant/40026424869026",
"sku": "",
"image": {
"url": "https://cdn.shopify.com/s/files/1/0571/2193/1426/products/518s6Q_2BEqxL._AC_UX522_250x.jpg?v=1622444565"
},
"product": {
"id": "gid://shopify/Product/6796049809570",
"onlineStoreUrl": null,
"vendor": "Yasistores",
"handle": "fgdj",
"productType": "T shirts",
"tags": [],
"product_sku": null
},
"compareAtPrice": {
"amount": "30.0",
"currencyCode": "INR"
},
"price": {
"amount": "24.0",
"currencyCode": "INR"
},
"title": "Default Title"
}
const product = {
"id": "gid://shopify/Product/6796049809570",
"title": "birthday t shirt is a product having longest product name",
"tags": [],
"handle": "fgdj",
"totalInventory": 90,
"description": "gfhljhgl dfghkghjkf gfhkgh k",
"descriptionHtml": "gfhljhgl dfghkghjkf gfhkgh k",
"onlineStoreUrl": null,
"productType": "T shirts",
"vendor": "Yasistores",
"availableForSale": true,
"priceRange": {
"maxVariantPrice": {
"amount": "24.0",
"currencyCode": "INR"
},
"minVariantPrice": {
"amount": "24.0",
"currencyCode": "INR"
}
},
"compareAtPriceRange": {
"maxVariantPrice": {
"amount": "30.0",
"currencyCode": "INR"
},
"minVariantPrice": {
"amount": "30.0",
"currencyCode": "INR"
}
},
"options": [
{
"id": "gid://shopify/ProductOption/8774438289570",
"name": "Title",
"values": [
"Default Title"
]
}
],
"variants": {
"pageInfo": {
"hasNextPage": false,
"hasPreviousPage": false
},
"edges": [
{
"node": {
"availableForSale": true,
"quantityAvailable": 90,
"sku": "",
"id": "gid://shopify/ProductVariant/40026424869026",
"title": "Default Title",
"selectedOptions": [
{
"name": "Title",
"value": "Default Title"
}
],
"image": {
"src": "https://cdn.shopify.com/s/files/1/0571/2193/1426/products/518s6Q_2BEqxL._AC_UX522.jpg?v=1622444565",
"url": "https://cdn.shopify.com/s/files/1/0571/2193/1426/products/518s6Q_2BEqxL._AC_UX522_500x500.jpg?v=1622444565"
},
"price": {
"amount": "24.0",
"currencyCode": "INR"
},
"compareAtPrice": {
"currencyCode": "INR",
"amount": "30.0"
}
}
}
]
},
"images": {
"pageInfo": {
"hasNextPage": false,
"hasPreviousPage": false
},
"edges": [
{
"node": {
"altText": null,
"src": "https://cdn.shopify.com/s/files/1/0571/2193/1426/products/518s6Q_2BEqxL._AC_UX522.jpg?v=1622444565",
"height": 1039,
"width": 522,
"url": "https://cdn.shopify.com/s/files/1/0571/2193/1426/products/518s6Q_2BEqxL._AC_UX522_500x500.jpg?v=1622444565"
}
}
]
},
"reviews_rating": {
"value": "{\"scale_min\":\"1.0\",\"scale_max\":\"5.0\",\"value\":\"5.0\"}"
},
"reviews_rating_count": {
"value": "1"
},
"spr_reviews": {
"value": "<style scoped>.spr-container {\n padding: 24px;\n border-color: #ECECEC;}\n .spr-review, .spr-form {\n border-color: #ECECEC;\n }\n</style>\n\n<div class=\"spr-container\">\n <div class=\"spr-header\">\n <h2 class=\"spr-header-title\">Customer Reviews</h2><div class=\"spr-summary rte\">\n\n <span class=\"spr-starrating spr-summary-starrating\" aria-label=\"5.0 of 5 stars\" role=\"img\">\n <i class=\"spr-icon spr-icon-star\" aria-hidden=\"true\"></i><i class=\"spr-icon spr-icon-star\" aria-hidden=\"true\"></i><i class=\"spr-icon spr-icon-star\" aria-hidden=\"true\"></i><i class=\"spr-icon spr-icon-star\" aria-hidden=\"true\"></i><i class=\"spr-icon spr-icon-star\" aria-hidden=\"true\"></i>\n </span>\n <span class=\"spr-summary-caption\"><span class='spr-summary-actions-togglereviews'>Based on 1 review</span>\n </span><span class=\"spr-summary-actions\">\n <a href='#' class='spr-summary-actions-newreview' onclick='SPR.toggleForm(6796049809570);return false'>Write a review</a>\n </span>\n </div>\n </div>\n\n <div class=\"spr-content\">\n <div class='spr-form' id='form_6796049809570' style='display: none'></div>\n <div class='spr-reviews' id='reviews_6796049809570' ></div>\n </div>\n\n</div>\n<script type=\"application/ld+json\">\n {\n \"@context\": \"http://schema.org/\",\n \"@type\": \"AggregateRating\",\n \"reviewCount\": \"1\",\n \"ratingValue\": \"5.0\",\n \"itemReviewed\": {\n \"@type\" : \"Product\",\n \"name\" : \"birthday t shirt is a product having longest product name\",\n \"offers\": {\n \"@type\": \"AggregateOffer\",\n \"lowPrice\": \"24.0\",\n \"highPrice\": \"24.0\",\n \"priceCurrency\": \"INR\"\n }\n }\n }\n</script>"
},
"custom_show_product_banner": null
}

Then the add to cart action will look like below

{
action: 'ADD_TO_CART_V2',
params: {
product: product,
variant: variant,
quantity: 1,
customAttributes: customAttributes
}
}

UPDATE_CART_V2

Updates a product in the cart.

ParamTypeDescription
lineItemIdstringThe line item id of the product to update in the cart
productobjectThe product to update in the cart
variantobjectThe variant of the product to update in the cart
quantitynumberThe quantity of the product to update in the cart
updateCartPageStateRequiredbooleanWhether to update the cart page state or not

Example:

{
action: 'UPDATE_CART_V2',
params: {
lineItemId: 'gid://shopify/LineItem/1234567890',
product: {node: {id: 'gid://shopify/Product/1234567890'}},
variant: {node: {id: 'gid://shopify/ProductVariant/1234567890'}},
quantity: 1,
updateCartPageStateRequired: true
}
}

COPY_TO_CLIPBOARD

Copies a text to the clipboard.

ParamTypeDescription
textstringThe text to copy

Example:

{
action: 'COPY_TO_CLIPBOARD',
text: 'abcd',
title: 'copied successfully'
}

LOGOUT

Logs out the user.

Example:

{
action: 'LOGOUT',
}

GO_BACK

Goes back to the previous page.

Example:

{
action: 'GO_BACK',
}

GO_TO_HOME

Goes to the home page.

Example:

{
action: 'GO_TO_HOME',
}

UPDATE_CART_CUSTOM_ATTRIBUTES

Add custom attributes to the cart.

ParamTypeDescription
cartCustomAttributesArrayThe custom attributes to update in the cart

Example:

{
action: 'UPDATE_CART_CUSTOM_ATTRIBUTES',
params: {
cartCustomAttributes: [
{ key: 'gift_message', value: 'Happy Birthday!' },
{ key: 'delivery_instructions', value: 'Leave at the front door.' },
],
},
}