For discussing the development and usage of Checkout UI extensions, post-purchase extensions, web pixels, Customer Accounts UI extensions, and POS UI extensions
Ideally I would like to fetch the amount the customer has paid for shipping, and apply it as a discount to the post-purchase product offer if the customer accepts the offer and the total price exceeded the free shipping threshold.
As far as I can tell, it's not available. My workaround was to fetch it via the admin API, but I'm not sure if that's possible without knowing the order ID which doesn't seem to be available.
Is there a way to achieve this? 🙂
Have you tried using the `useShippingAddress` hook?
Can be found here: https://shopify.dev/docs/api/checkout-ui-extensions/2023-10/apis/addresses
I'm not sure your solution caters to my issue? 🙂
I found a workaround using the shopify web pixel checkout_started event. This event gives you a checkout token which also aligns with an ID that you receive in the post-purchase event. This can then be used to cross-match more information that the checkout_started web pixel event gives you. You just have to store some data from the checkout_started event to the user in your database, and then fetch that data from the post-purchase extension side of the app. It would probably require some intermittent polling of the database to retrieve it as there will be two seperate operations running at once, but it should work ok.
I haven't actually done it yet though but it seems reasonable enough.