learnshopify.dev/Workspace
code reading

Read the thank-you block. Trace what runs where.

import '@shopify/ui-extensions/preact';
import {render} from 'preact';

export default function extension() {
  render(<BrewGuide />, document.body);
}

function BrewGuide() {
  const confirmation = shopify.orderConfirmation.value;
  if (!confirmation) {
    return null;
  }

  if (confirmation.isFirstOrder) {
    return (
      <s-banner heading="Welcome to Northwind" tone="success">
        <s-stack gap="base">
          <s-text>
            Order #{confirmation.number} is confirmed. Your beans
            ship within 48 hours of roasting.
          </s-text>
          <s-unordered-list>
            <s-list-item>Rest the bag five days after the roast date.</s-list-item>
            <s-list-item>Grind right before you brew.</s-list-item>
            <s-list-item>Start at a 1:16 coffee-to-water ratio.</s-list-item>
          </s-unordered-list>
        </s-stack>
      </s-banner>
    );
  }

  return (
    <s-banner heading="Thanks for coming back">
      <s-text>
        Order #{confirmation.number} is confirmed. Most members
        reorder every three weeks. Subscriptions get 10% off.
      </s-text>
    </s-banner>
  );
}
1. A buyer lands on the thank-you page. Where does this code execute?
2. What renders before the confirmation data resolves?
3. A returning customer completes order #1207. What do they see?
4. Why is the UI built only from s- components, not plain HTML?
5. How does this block end up on the thank-you page?
0 / 1 task solved