Dynamic galleries for products work almost the same as for categories but have a much bigger list of the system attributes to pass data to the bot. Let’s add actual product galleries to the bot that we are building to see how it works.
“Show products” button that we added to the CATEGORY dynamic gallery is now connected to the PRODUCTS block. We use $_selected_category_id in block settings to display products from the selected category, and then we add another “Show details” button to this dynamic gallery to display product details.
The bot is still only 6 blocks, but now we have complete inventory from your shop in dynamic galleries!
Let’s see how it works in the Messenger.
Notice system attributes that are used in the TEXT block to display product details for the specific product selected by chatbot user. This block displays only some of them, and here is the complete list for your reference:
- $_selected_product_id – numeric ID from your online shop
- $_selected_product_slug – URL-friendly product name (“slug” in WooCommerce)
- $_selected_product_title – the title of selected product
- $_selected_product_description – description of selected product
- $_selected_product_price – the price of the selected product
- $_selected_product_url – URL of the selected product page in your online shop
- $_selected_product_image – URL of product image
- $_selected_product_inv_qty – the quantity of the selected product in shop inventory
- $_selected_product_var_types – list of variation types for the selected product
- $_selected_product_var_ids – list of variation IDs for selected product. Contains single variation ID if there are no product variations. Use it to add single-variation products to shopping cart in Shopify integrations.