1

I'm still learning shopify app development,

I've followed THIS tutorial and created a simple app settings page by checking shopify docs.

Now my App page looks something like below

enter image description here

Now, I want to save this data and use this data to make some changes to cart total at the time of checkout. So, At the moment my concern is, How do I store the data?

Once I stored the data, How can I create custom fields at the checkout page if these 2 fields are filled?

My code is exactly same as they explained in above tutorial, and my current Index class looks something like below.

import { EmptyState, Page, Layout, FormLayout, Card, TextField } from "@shopify/polaris";

function Index() {
    return (
        <Page
        title="App Settings"
        subtitle="All App related settings will go here"
        primaryAction={{content: 'Save'}}>
            <Layout>
                <Layout.AnnotatedSection
                title="API Settings"
                description="Get API Key and API secret.">
                <Card title="API Key and API secret" sectioned>
                <FormLayout>
                    <TextField label="API Key" onChange={() => {}} />
                    <TextField label="API Secret" onChange={() => {}} />
                </FormLayout>
                </Card>
                </Layout.AnnotatedSection>
            </Layout>
        </Page>
    )
};

export default Index;

And my project structure is as below.

enter image description here

I'm trying to figure out this since last 2 days, But I did not find any helpful resources which I can refer at this stage of learning.

Please provide helpful resources/tutorials/links/code if you can.

Hanzla Habib
  • 3,457
  • 25
  • 25
rakcode
  • 2,256
  • 4
  • 19
  • 44

1 Answers1

0

To show the Shipping's rates at cart page. What you need to do is integrate Google Map at your cart page something like this site

  • After integrating the Map you need to get the location name region/country wise.
  • Then you need to call this Shopify Shipping Zone API and get the available shipping rate which you'd configured in the Shopify shipping settings.
  • In the API's response match the region/country according to the entered location from cart page and show the Shipping's rates.

Reference (not exactly the same but just as an example)

  • API Key and API secrets are not the once which we get while creating the app, Its unique keys which we get from other API vendor. I understood that i should have Shpify Plus account in order to customize checkout page so I'm planning to add those custom fields on cart page. so, Along with cart details I need to add few parameters, 1. locatoion (Lat & long), 2. Landmark. using those Lat & Long, Im planning to calculate the shipping charge, I should be able to update the shipping charge from here. – rakcode Sep 28 '20 at 19:35
  • Those API key & Secrets are used to calculate the shipping charge. so from admin side of the app, i'll set these Creds and use that in store front. this is my basic idea. – rakcode Sep 28 '20 at 19:36
  • Understood. BTW did you try this https://community.shopify.com/c/Shopify-Design/Cart-Add-a-shipping-rates-calculator-to-your-cart/td-p/616554 – Jahanzaib Muneer Sep 29 '20 at 09:08
  • I'm completely new to Shopify, I just took video tutorial and working on something different than video tutorial. I know NodeJS and angular and littlebit of React, so I think this is liqued you refered. – rakcode Sep 29 '20 at 12:54
  • I have edited the answer for you. Take a look again. Hope this info will be helpful for you. – Jahanzaib Muneer Sep 30 '20 at 09:43
  • Hello mate, I just had a ook at your answer, according to your answer, We should create shipping zones and charges from the backend, Once they select locaton, the charge from that API will be applied. right! But my shipping rates are completely random. we can set static shipping charges. We will be getting estimated shipping charges from external API. – rakcode Sep 30 '20 at 10:07
  • No issue you can also do this just simply use the external API and the rates. BTW if the external API is not private can you share the info of that API? – Jahanzaib Muneer Sep 30 '20 at 10:22
  • Please provide your contact details. I'm still talking to the vendor, I can share it with you once i get it. – rakcode Sep 30 '20 at 10:33
  • Sure jahanzaibmuneerr@gmail.com you can contact me here. – Jahanzaib Muneer Sep 30 '20 at 10:45