PHP code example of incapption / shopify2googleshopping

1. Go to this page and download the library: Download incapption/shopify2googleshopping library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

incapption / shopify2googleshopping example snippets




use Incapption\Shopify2GoogleShopping\Shopify2GoogleShopping;

class SomeClass
{
    public function doSomething()
    {
        $handler = new Shopify2GoogleShopping();
        
        // set your shopify admin api credentials
        $handler->setShopifyCredentials(
                    $_ENV['SHOPIFY_PRIVATE_API_KEY'], 
                    $_ENV['SHOPIFY_PRIVATE_API_PASSWORD'], 
                    $_ENV['SHOPIFY_PRIVATE_API_ACCESS_TOKEN'], 
                    "mydemoshop.myshopify.com"
                 );

        // optional: $handler->setTemplate('mypath/custom_template.liquid');

        $handler->setProjectTitle('My Custom Shopify Shop');
        $handler->setProjectDescription('This is a short description of my shop');
        $handler->setProjectLink('https://myshop.shopify.com');

        file_put_contents('mypath/product_feed.xml', $handler->generate());
    }
}