-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds optional channel prop to ShopPayButton #1447
Conversation
84a05bd
to
65497b1
Compare
65497b1
to
a69cd54
Compare
307c553
to
8d6a4a9
Compare
8d6a4a9
to
a371b3a
Compare
a371b3a
to
6750dc1
Compare
6750dc1
to
e20cda8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think (but need a gut check) that the changeset should be a patch. (Weird, I know)
I also think we should be modifying the reexported package from @shopify/hydrogen to just set channel
for you as hydrogen
. That way anyone that updates gets a non breaking change that automatically fixes the problem, and it keeps the DX cleaner.
I'd leave it unset in @shopify/hydrogen-react since folks can use that in a number of ways.
.changeset/small-zoos-grab.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be a patch I think... because of our kinda weird versioning strategy
I like this idea, good thinking! I'll make this change Monday morning 🙌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks good. Please update changeset to patch
@@ -36,11 +37,17 @@ type ShopPayVariantAndQuantities = { | |||
}>; | |||
}; | |||
|
|||
type ShopPayChannelAttribution = { | |||
/** A string that adds channel attribution to the order. Can be either `headless` or `hydrogen` */ | |||
channel?: 'headless' | 'hydrogen'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the channel limited to just headless
or hydrogen
because that is the only possible values that <shop-pay-button>
accepts ... or are the values something that scopes to hydrogen-react
and hydrogen
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, valid values for cart permalink attribution are:
buy_button
online_store
headless
hydrogen
headless-storefronts
- and
hydrogen-5
On the backend, hydrogen
and headless
are mapped to the attributed clients (hydrogen-5
and headless-storefronts
). The limitations aren't with shop-pay-button
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=_=
Okay. Let's stay with headless
and hydrogen
and not get everyone confused with which one they should using.
b4c3054
to
f29d27a
Compare
WHY are these changes introduced?
This adds an optional
channel
prop to theShopPayButton
which will be used to add attribution to an order.WHAT is this pull request doing?
This change leverages a change made in Shop JS that allows
channel
to be forwarded to the checkout for order attribution. Now, when developers add eitherheadless
orhydrogen
to theirShopPayButton
props, they will be able to ensure orders are attributed to the correct channel.HOW to test your changes?
It is recommended to test this change using a store of your own using a free product.
headless
orhydrogen
as the prop on yourShopPayButton
a. Use the channel that aligns with the channel you've added to your storefront.
ShopPayButton
should direct you to your checkout without any errors.Orders
page in admin and check the order attribution for your test order. It should reflect the correct channel.Checklist