Showing posts with label Shopify API. Show all posts
Showing posts with label Shopify API. Show all posts

Monday 18 December 2023

How to create Shopify Checkout extensions good articles

The following links are good for how to create Shopify extension and for Send and get information from your APP databases
  • https://www.shopify.com/in/partners/blog/checkout-ui-extensions
  • https://community.shopify.com/c/extensions/issue-calling-shopify-app-api-from-checkout-ui-extension/td-p/2267439
  • https://www.youtube.com/watch?v=wNdvxLzWUQg
  • https://community.shopify.com/c/extensions/ui-checkout-send-options-extensions-request-to-server-network/m-p/2226100
  • https://community.shopify.com/c/extensions/how-do-i-fetch-product-details-from-a-checkout-ui-extension/td-p/1671855
  • https://www.youtube.com/watch?v=FDLoz__VKVk
  • https://community.shopify.com/c/extensions/cors-issue-with-checkout-ui-extension-fetch-api-app-proxy/m-p/2025206

Tuesday 24 September 2019

How to create pagination in shopify rest api using php

Shopify new API next page issue | page_info => invalid value

Shopify API version 2019-07 you do indeed need to use cursor-based pagination.

First make a normal API call, include the header response.

Then in the header response API, you will see the "link" parameter with rel next or previous.

Extract the page_info and then make another call with page_info.
The first API call is something like this:

https://.....@abc.myshopify.com/admin/api/2019-10/products.json?limit=2&published_status=published
To get header response from API response :
function getheaderarray($apiresponse){
       
        $data = explode("\n",$apiresponse);
        $headers['status'] = $data[0];
        array_shift($data);
        foreach($data as $part){
            $middle = explode(":",$part,2);
            if ( !isset($middle[1]) ) { $middle[1] = null; }
            $headers[trim($middle[0])] = trim($middle[1]);
        }
       
        return $headers;
  }  
Then the second API call is something like this:
https://.....@abc.myshopify.com/admin/api/2019-10/products.json?limit=2&page_info=abcdsf21asdf3afdfdfd1safd51s3f1x32ref4asdj
When you make the second call, do not add any filers as the filters will be applied from the first call.
FYI: if your testing in a browser due to the way the link is in angle brackets, it will be hidden, so just view source code in your developer environment.