Saltar al contenido principal

Storefront Slots

Storefront slots are containers available in the storefront pages where you can render your UI components. These slots allow you to customize the shopping experience across different pages.

Available Slots

These are the slots that are available in the storefront:

SlotPage
before_main_contenthome, product, category, search
before_quick_buy_add_to_carthome, category, search
after_product_grid_item_namehome, category, search
product_grid_item_image_top_lefthome, product, category, search
product_grid_item_image_top_righthome, product, category, search
product_grid_item_image_bottom_lefthome, product, category, search
product_grid_item_image_bottom_righthome, product, category, search
before_start_checkout_buttonhome, product, category, search
after_product_detail_nameproduct
before_price_pdpproduct
before_product_detail_add_to_cartproduct
before_add_to_cart_pdpproduct
after_product_detail_add_to_cartproduct
after_add_to_cart_pdpproduct
after_product_descriptionproduct
before_line_itemscart
after_cart_summarycart
after_go_to_checkoutcart
before_footerhome, product, category, search

Slot Visual Reference

Home, Category, and Search Pages

  • before_main_content

Before Main Content Slot

  • before_start_checkout_button

Before Start Checkout Button Slot

  • before_footer

Before Footer Slot

Product Grid Slots

Product grid slots are special slots that allow you to render components on product cards within product grids. These slots include:

  • product_grid_item_image_top_left
  • product_grid_item_image_top_right
  • product_grid_item_image_bottom_left
  • product_grid_item_image_bottom_right
  • after_product_grid_item_name

Product Grid Slots

Rendering Components in Product Grids

To render components in product grids, return an array of components where the root element for each product includes the key prop set to that product's ID. This allows your app to render components across multiple items in the grid.

The example below renders a button on every product card in the grid:

nube.render("product_grid_item_image_bottom_right", ({ location }) => {
return location.page.products.map(product => (
<Box key={product.id}>
<Button onClick={() => console.log(product)}>
Click Me!
</Button>
</Box>
));
});

Product Page Slots

  • after_product_detail_name
  • before_product_add_to_cart
  • after_product_add_to_cart

Product Page Slots Overview

  • before_price_pdp

Before Price PDP Slot

  • after_price_pdp

After Price PDP Slot

  • before_add_to_cart_pdp

Before Add to Cart PDP Slot

  • after_add_to_cart_pdp

After Add to Cart PDP Slot

  • after_product_description

After Product Description Slot

Cart Page Slots

  • before_line_items

Before Line Items Slot

  • after_cart_summary

After Cart Summary Slot

  • after_go_to_checkout

After Go to Checkout Slot

Examples

Adding Content to Product Page

import type { NubeSDK } from "@tiendanube/nube-sdk-types";
import { Box, Text } from "@tiendanube/nube-sdk-jsx";

export function App(nube: NubeSDK) {
nube.render("after_product_detail_name", [
<Box key="product-badge">
<Text>Free Shipping Available!</Text>
</Box>,
]);
}

Adding Content Before Add to Cart

import type { NubeSDK } from "@tiendanube/nube-sdk-types";
import { Box, Text } from "@tiendanube/nube-sdk-jsx";

export function App(nube: NubeSDK) {
nube.render("before_add_to_cart_pdp", [
<Box key="size-guide">
<Text>View Size Guide</Text>
</Box>,
]);
}

Adding Content to Cart Page

import type { NubeSDK } from "@tiendanube/nube-sdk-types";
import { Box, Text } from "@tiendanube/nube-sdk-jsx";

export function App(nube: NubeSDK) {
nube.render("after_cart_summary", [
<Box key="cart-promo">
<Text>Add $50 more for free shipping!</Text>
</Box>,
]);
}

Dynamic Product Grid Rendering

import type { NubeSDK } from "@tiendanube/nube-sdk-types";
import { Box, Text } from "@tiendanube/nube-sdk-jsx";

export function App(nube: NubeSDK) {
nube.render("after_product_grid_item_name", ({ location }) => {
return location.page.products.map(product => (
<Box key={product.id}>
<Text>{product.variants.length} variants available</Text>
</Box>
));
});
}

Best Practices

  • Always use the product's ID as the key prop when rendering in product grid slots
  • Test your components with the Patagonia theme to ensure compatibility
  • Consider the visual impact of your components on the storefront design
  • Use responsive design principles for components that appear on different screen sizes
  • Clear slots when they're no longer needed using nube.clearSlot()