Shopify Connector
Documentation
Version: 2
Documentation

Table ProductVariants


Parameters

Parameter Label Required Options Description Help
There are no parameters

Supported Operations

Below section contains supported CRUD operations. Each operation is executed by some EndPoint behind the scene.
Method Supported Reference EndPoint
SELECT get_product_variants
INSERT post_product_variant
UPDATE put_product_variant
UPSERT
DELETE delete_product_variant
LOOKUP get_product_variants

Examples

SSIS

Use Shopify Connector in API Source component to read data or in API Destination component to read/write data:

Read from ProductVariants table using API Source

Shopify
ProductVariants
SSIS API Source - Read from table or endpoint

Read/write to ProductVariants table using API Destination

Shopify
ProductVariants
Select
SSIS API Destination - Access table operation

ODBC application

Use these SQL queries in your ODBC application data source:

Get list of all product variants

SELECT * FROM ProductVariants

Get all product variants by a specific product ID

SELECT * FROM ProductVariants Where ProductId='1111111111111'

Get all product variants by multiple specific product IDs

SELECT * FROM ProductVariants WITH(ids='1111111111111,2222222222222,3333333333333')

Create a new product variant

This example shows how to create a new product variant.

INSERT INTO ProductVariants (ProductId, Option1, Option2,SKU,Price,CompareAtPrice,Position,Weight,WeightUnit,ImageId)
Values(7348335771748, 'Chocolate', 'Medium', 'ICE-CHO-MED', 195.5, 200.5, 3, 20.5, 'lb', 31900013854820)

Update product variant price, image, weight

This example shows how to update product variant price, image, weight and other attributes.

Update ProductVariants 
SET  
	,Option1='Chocolate' 
	,Option2='Large'
	,SKU='ICE-CHO-SML'
	,Price=90.45
	,CompareAtPrice=100.45
	,Position=2
	,Weight=10.5
	,WeightUnit='lb'
	,ImageId=31900013854820  --use available images from Products table
Where Id=42564507992164

Delete an existing product variant

This example shows how to delete an existing product variant by Variant Id.

DELETE FROM ProductVariants 
WHERE Id=31900013854820

SQL Server

Use these SQL queries in SQL Server after you create a data source in Data Gateway:

Get list of all product variants

DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM ProductVariants';

EXEC (@MyQuery) AT [LINKED_SERVER_TO_SHOPIFY_IN_DATA_GATEWAY];

Get all product variants by a specific product ID

DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM ProductVariants Where ProductId=''1111111111111''';

EXEC (@MyQuery) AT [LINKED_SERVER_TO_SHOPIFY_IN_DATA_GATEWAY];

Get all product variants by multiple specific product IDs

DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM ProductVariants WITH(ids=''1111111111111,2222222222222,3333333333333'')';

EXEC (@MyQuery) AT [LINKED_SERVER_TO_SHOPIFY_IN_DATA_GATEWAY];

Create a new product variant

This example shows how to create a new product variant.

DECLARE @MyQuery NVARCHAR(MAX) = 'INSERT INTO ProductVariants (ProductId, Option1, Option2,SKU,Price,CompareAtPrice,Position,Weight,WeightUnit,ImageId)
Values(7348335771748, ''Chocolate'', ''Medium'', ''ICE-CHO-MED'', 195.5, 200.5, 3, 20.5, ''lb'', 31900013854820)';

EXEC (@MyQuery) AT [LINKED_SERVER_TO_SHOPIFY_IN_DATA_GATEWAY];

Update product variant price, image, weight

This example shows how to update product variant price, image, weight and other attributes.

DECLARE @MyQuery NVARCHAR(MAX) = 'Update ProductVariants 
SET  
	,Option1=''Chocolate'' 
	,Option2=''Large''
	,SKU=''ICE-CHO-SML''
	,Price=90.45
	,CompareAtPrice=100.45
	,Position=2
	,Weight=10.5
	,WeightUnit=''lb''
	,ImageId=31900013854820  --use available images from Products table
Where Id=42564507992164';

EXEC (@MyQuery) AT [LINKED_SERVER_TO_SHOPIFY_IN_DATA_GATEWAY];

Delete an existing product variant

This example shows how to delete an existing product variant by Variant Id.

DECLARE @MyQuery NVARCHAR(MAX) = 'DELETE FROM ProductVariants 
WHERE Id=31900013854820';

EXEC (@MyQuery) AT [LINKED_SERVER_TO_SHOPIFY_IN_DATA_GATEWAY];