Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ShopPayButton now accepts storeDomain prop (#645)
* extract shopify default context * update ShopPayButton to also accept a storeDomain prop Co-authored-by: Juan P. Prieto <juanpablo.prieto@shopify.com> * fix shop pay button in demo store * add changeset * bust turbo cache * Revert "bust turbo cache" This reverts commit 6023e83. * Update docs * fix test and generate doc * fix name * remove turbo cache * revert tubro cache --------- Co-authored-by: Juan P. Prieto <juanpablo.prieto@shopify.com> Co-authored-by: Helen Lin <helen.lin@shopify.com>
- Loading branch information
1 parent
db9d44d
commit c78f441
Showing
12 changed files
with
228 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@shopify/hydrogen-react': patch | ||
--- | ||
|
||
`ShopPayButton` component now can receive a `storeDomain`. The component now does not require `ShopifyProvider`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import {ShopPayButton} from '@shopify/hydrogen-react'; | ||
|
||
export function AddVariantQuantity1({variantId}) { | ||
return <ShopPayButton variantIds={[variantId]} />; | ||
export function AddVariantQuantity1({variantId, storeDomain}) { | ||
return <ShopPayButton variantIds={[variantId]} storeDomain={storeDomain} />; | ||
} | ||
|
||
export function AddVariantQuantityMultiple({variantId, quantity}) { | ||
export function AddVariantQuantityMultiple({variantId, quantity, storeDomain}) { | ||
return ( | ||
<ShopPayButton variantIdsAndQuantities={[{id: variantId, quantity}]} /> | ||
<ShopPayButton | ||
variantIdsAndQuantities={[{id: variantId, quantity}]} | ||
storeDomain={storeDomain} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,28 @@ | ||
import {ShopPayButton} from '@shopify/hydrogen-react'; | ||
|
||
export function AddVariantQuantity1({variantId}: {variantId: string}) { | ||
return <ShopPayButton variantIds={[variantId]} />; | ||
export function AddVariantQuantity1({ | ||
variantId, | ||
storeDomain, | ||
}: { | ||
variantId: string; | ||
storeDomain: string; | ||
}) { | ||
return <ShopPayButton variantIds={[variantId]} storeDomain={storeDomain} />; | ||
} | ||
|
||
export function AddVariantQuantityMultiple({ | ||
variantId, | ||
quantity, | ||
storeDomain, | ||
}: { | ||
variantId: string; | ||
quantity: number; | ||
storeDomain: string; | ||
}) { | ||
return ( | ||
<ShopPayButton variantIdsAndQuantities={[{id: variantId, quantity}]} /> | ||
<ShopPayButton | ||
variantIdsAndQuantities={[{id: variantId, quantity}]} | ||
storeDomain={storeDomain} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {ShopifyProvider, ShopPayButton} from '@shopify/hydrogen-react'; | ||
|
||
export default function App() { | ||
return ( | ||
<ShopifyProvider | ||
storeDomain="my-store" | ||
storefrontToken="abc123" | ||
storefrontApiVersion="2023-01" | ||
countryIsoCode="CA" | ||
languageIsoCode="EN" | ||
> | ||
<AddVariantQuantity1 variantId="gid://shopify/ProductVariant/1" /> | ||
</ShopifyProvider> | ||
); | ||
} | ||
|
||
export function AddVariantQuantity1({variantId}) { | ||
return <ShopPayButton variantIds={[variantId]} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {ShopifyProvider, ShopPayButton} from '@shopify/hydrogen-react'; | ||
|
||
export default function App() { | ||
return ( | ||
<ShopifyProvider | ||
storeDomain="my-store" | ||
storefrontToken="abc123" | ||
storefrontApiVersion="2023-01" | ||
countryIsoCode="CA" | ||
languageIsoCode="EN" | ||
> | ||
<AddVariantQuantity1 variantId="gid://shopify/ProductVariant/1" /> | ||
</ShopifyProvider> | ||
); | ||
} | ||
|
||
export function AddVariantQuantity1({variantId}: {variantId: string}) { | ||
return <ShopPayButton variantIds={[variantId]} />; | ||
} |
Oops, something went wrong.