i have a checkout ui extension rendering on thankyou page, i want to print some order id there but order id not showing,
code:
import React, { useState, useEffect } from 'react'; // Added useState for potential future use, and useEffect
import {
reactExtension,
BlockStack,
Text,
Heading,
useApi,
useExtensionApi,
Link // Optional: for adding links
} from '@shopify/ui-extensions-react/checkout';
// This is the extension point for rendering a block on the thank you page.
// It will appear in the "Additional details" section by default,
// but can be moved by the merchant in the Checkout Editor.
export default reactExtension('purchase.thank-you.block.render', () => <ThankYouExtension />);
function ThankYouExtension() {
// The useApi hook provides access to various checkout and order details
// when the extension is running on the thank you page.
const order = useOrder();
const orderData = order?.id || 'Order ID not available';
console.log("Order datsa: ", order);
return (
<BlockStack spacing="loose">
<Text>
We appreciate your business and hope you enjoy your products!{orderData}
</Text>
</BlockStack>
);
}
need guide.