Checkout extension exporting api not working

Solved

Checkout extension exporting api not working

Schmidtc63
Shopify Partner
98 14 27

Here is the export statement:

 

export default extension(
	"purchase.checkout.shipping-option-list.render-after",
	(root, {lines, applyCartLinesChange, query, i18n},api}) => {

but api is always null. 

 

I can do (root,api) and it works fine but then I lose all my other options -- lines, query, etc.

 

 

Accepted Solution (1)

daxanema
Shopify Partner
2 1 0

This is an accepted solution.

I figured it out. You don't need to export all the Checkout components separately - you can just do this:

 

export default extension('purchase.checkout.contact.render-after', (root, api ) => {

 

and then you can access the components via the api object like so:

 

let bI = api.buyerIdentity;
let loc = api.localization;
let sA = api.shippingAddress;
// and so on

 

 

 

View solution in original post

Replies 3 (3)

daxanema
Shopify Partner
2 1 0

I have the same issue

daxanema
Shopify Partner
2 1 0

This is an accepted solution.

I figured it out. You don't need to export all the Checkout components separately - you can just do this:

 

export default extension('purchase.checkout.contact.render-after', (root, api ) => {

 

and then you can access the components via the api object like so:

 

let bI = api.buyerIdentity;
let loc = api.localization;
let sA = api.shippingAddress;
// and so on

 

 

 

Schmidtc63
Shopify Partner
98 14 27

Yup. Thank you. 

 

"export default extensio"n takes two arguments, the second being the complete api or else an object of of api objects: {shop, metafields, shippingAddress}, for example.