-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add the purchase option extensions template #142
Open
JulienHe
wants to merge
5
commits into
main
Choose a base branch
from
jhe-add-extensions-points
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,8 @@ | ||
# Admin purchase options extension | ||
|
||
Purchase options extensions allow developers to integrate custom functionality into the Shopify Admin interface, | ||
enabling merchants to create and edit purchase options directly on product and product variant pages. These extensions | ||
provide interactive elements that enhance the merchant's ability to manage purchase options efficiently. | ||
|
||
Learn more about Admin action extensions in Shopify’s [developer | ||
documentation](https://shopify.dev/docs/apps/admin/admin-actions-and-blocks). |
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,4 @@ | ||
{ | ||
"name": "{{ name }}", | ||
"welcome": "Welcome to the {% raw %}{{TARGET}}{% endraw %} extension!" | ||
} |
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,4 @@ | ||
{ | ||
"name": "{{ name }}", | ||
"welcome": "Bienvenue dans l'extension {% raw %}{{TARGET}}{% endraw %}!" | ||
} |
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,27 @@ | ||
{%- if flavor contains "react" -%} | ||
{ | ||
"name": "{{ handle }}", | ||
"private": true, | ||
"version": "1.0.0", | ||
"license": "UNLICENSED", | ||
"dependencies": { | ||
"react": "^18.0.0", | ||
"@shopify/ui-extensions": "unstable", | ||
"@shopify/ui-extensions-react": "unstable" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^18.0.0", | ||
"react-reconciler": "0.29.0" | ||
} | ||
} | ||
{%- else -%} | ||
{ | ||
"name": "{{ handle }}", | ||
"private": true, | ||
"version": "1.0.0", | ||
"license": "UNLICENSED", | ||
"dependencies": { | ||
"@shopify/ui-extensions": "unstable" | ||
} | ||
} | ||
{%- endif -%} |
27 changes: 27 additions & 0 deletions
27
admin-purchase-options-action/shopify.extension.toml.liquid
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,27 @@ | ||
api_version = "unstable" | ||
|
||
[[extensions]] | ||
# Change the merchant-facing name of the extension in locales/en.default.json | ||
name = "t:name" | ||
handle = "{{ handle }}" | ||
type = "ui_extension" | ||
{% if uid %}uid = "{{ uid }}"{% endif %} | ||
|
||
# Both targets need to be specified for the extensions to work | ||
[[extensions.targeting]] | ||
module = "./src/ProductExtension.{{ srcFileExtension }}" | ||
# The target used here must match the target used in the module file (./src/PurchaseOptionsActionExtension.{{ srcFileExtension }}) | ||
target = "admin.product-purchase-option.action.render" | ||
|
||
[[extensions.targeting]] | ||
module = "./src/ProductVariantExtension.{{ srcFileExtension }}" | ||
# The target used here must match the target used in the module file (./src/PurchaseOptionsActionExtension.{{ srcFileExtension }}) | ||
target = "admin.product-variant-purchase-option.action.render" | ||
|
||
# Valid extension targets: | ||
|
||
# Product index and detail pages | ||
# - admin.product-purchase-option.action.render | ||
|
||
# Product variant detail pages | ||
# - admin.product-variant-purchase-option.action.render |
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,28 @@ | ||
{%- if flavor contains "react" -%} | ||
import {reactExtension} from '@shopify/ui-extensions-react/admin'; | ||
import PurchaseOptionsActionExtension from './PurchaseOptionsActionExtension'; | ||
|
||
export default reactExtension('admin.product-purchase-option.action.render', () => ( | ||
<PurchaseOptionsActionExtension extension="admin.product-purchase-option.action.render" /> | ||
)); | ||
|
||
{%- else -%} | ||
import {extension} from '@shopify/ui-extensions/admin'; | ||
import PurchaseOptionsActionExtension from './PurchaseOptionsActionExtension'; | ||
|
||
export default extension( | ||
'admin.product-purchase-option.action.render', | ||
(root, {i18n, close, data}) => { | ||
PurchaseOptionsActionExtension( | ||
'admin.product-purchase-option.action.render', | ||
root, | ||
{ | ||
i18n, | ||
close, | ||
data, | ||
}, | ||
); | ||
}, | ||
); | ||
|
||
{%- endif -%} |
28 changes: 28 additions & 0 deletions
28
admin-purchase-options-action/src/ProductVariantExtension.liquid
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,28 @@ | ||
{%- if flavor contains "react" -%} | ||
import {reactExtension} from '@shopify/ui-extensions-react/admin'; | ||
import PurchaseOptionsActionExtension from './PurchaseOptionsActionExtension'; | ||
|
||
export default reactExtension('admin.product-variant-purchase-option.action.render', () => ( | ||
<PurchaseOptionsActionExtension extension="admin.product-variant-purchase-option.action.render" /> | ||
)); | ||
|
||
{%- else -%} | ||
import {extension} from '@shopify/ui-extensions/admin'; | ||
import PurchaseOptionsActionExtension from './PurchaseOptionsActionExtension'; | ||
|
||
export default extension( | ||
'admin.product-variant-purchase-option.action.render', | ||
(root, {i18n, close, data}) => { | ||
PurchaseOptionsActionExtension( | ||
'admin.product-variant-purchase-option.action.render', | ||
root, | ||
{ | ||
i18n, | ||
close, | ||
data, | ||
}, | ||
); | ||
}, | ||
); | ||
|
||
{%- endif -%} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
These should be pointing to the latest stable calver (10-24) not to unstable
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.
Thanks~ Will change.