@@ -12,28 +12,29 @@ The _accept-terms_ plugin is only loaded for the checkout contact information st
1212
1313To enable a plugin add this code to your _ Google Analytics Additional Scripts_ section in Shopify's Admin / Online Store / Preferences.
1414
15- ```
16- (function() {
15+ ``` javascript
16+ fetch (' //cdn.jsdelivr.net/gh/nerdsofalltrades/shopify-plugins@0.1.1/dist/shopify-plugin-loader.min.js' ).then (function (
17+ result
18+ ) {
19+ result .text ().then (function (script ) {
1720 var plugin = document .createElement (' script' );
18- plugin.src = '//cdn.jsdelivr.net/gh/nerdsofalltrades/shopify-plugins@0.1.0/dist/shopify-plugin-loader.min.js' ;
21+ plugin .innerHTML = script ;
1922 document .body .appendChild (plugin);
2023
21- plugin.onload = function () {
22- var ctx = window.ShopifyPlugins;
23-
24- // Load plugins here
24+ // Load plugins here
25+ var ctx = window .ShopifyPlugins ;
2526
26- // Load the accept-terms plugin only in checkout
27- // contact information step
28- ctx.checkout.contactInformation.load('accept-terms');
27+ // Load the accept-terms plugin only in checkout
28+ // contact information step
29+ ctx .checkout .contactInformation .load (' accept-terms' );
2930
30- // Load the progress-bar plugin for all steps
31- // in checkout
32- ctx.checkout.all.load('progress-bar');
31+ // Load the progress-bar plugin for all steps
32+ // in checkout
33+ ctx .checkout .all .load (' progress-bar' );
3334
34- // Load other plugins here ...
35- }
36- })( );
35+ // Load other plugins...
36+ });
37+ } );
3738```
3839
3940## Plugins
@@ -45,26 +46,26 @@ Checkbox in Shopify's contact information checkout step.
4546
4647![ Accept terms plugin in action] ( examples/accept-terms/accept-terms.png )
4748
48- Add this code to your ` plugin.onload ` function to enable it.
49+ Add this code to enable it.
4950
50- ```
51+ ``` javascript
5152ctx .checkout .contactInformation .load (' accept-terms' );
5253```
5354
5455Without options standard english texts are displayed and the url of your terms
5556is expected to be found at ` /pages/terms ` . To change that just pass options
5657and set it up as you like.
5758
58- ```
59+ ``` javascript
5960ctx .checkout .contactInformation .load (' accept-terms' , {
6061 // The checkbox label
61- label: " I have read and I agree to the" ,
62+ label: ' I have read and I agree to the' ,
6263 // The label of the terms link
63- termsName: " terms" ,
64+ termsName: ' terms' ,
6465 // The url to your terms
65- termsURL: " /pages/terms" ,
66+ termsURL: ' /pages/terms' ,
6667 // Message displayed when customer tries to go on without agreeing
67- errorMessage: " Please agree to our terms before your purchase"
68+ errorMessage: ' Please agree to our terms before your purchase'
6869});
6970```
7071
@@ -77,15 +78,15 @@ configuration is needed.
7778
7879![ Progress bar plugin in action] ( examples/progress-bar/progress-bar.png )
7980
80- Add this code to your ` plugin.onload ` function to enable it.
81+ Add this code to enable it.
8182
82- ```
83+ ``` javascript
8384ctx .checkout .all .load (' progress-bar' );
8485```
8586
8687## Development
8788
88- ```
89+ ``` shell
8990$ npm install
9091$ npm run dev
9192```
0 commit comments