Skip to content

How to pass "buyerIp" property? #814

Closed Answered by frandiox
felpsio asked this question in Help
Discussion options

You must be logged in to vote

Hi! You can pass the buyerIp when creating the storefront client in your server.js/server.ts file:

      const {storefront} = createStorefrontClient({
        cache,
        waitUntil,
        // ...
        storefrontHeaders: {buyerIp: '...'},
      });

You would normally get that IP from the Request object. If you are deploying to Oxygen, you can get this by using the getStorefrontHeaders function:

import {
  createRequestHandler,
  getStorefrontHeaders,
} from '@shopify/remix-oxygen';

// ...

      const {storefront} = createStorefrontClient({
        cache,
        waitUntil,
        // ...
        storefrontHeaders: getStorefrontHeaders(request),
      });

We'll update our docs to r…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by felpsio
Comment options

You must be logged in to vote
1 reply
@frandiox
Comment options

# for free to join this conversation on GitHub. Already have an account? # to comment
Category
Help
Labels
None yet
2 participants