Shopify API Dart plugin
Official WooSignal Shopify package
Build apps for Shopify easier with our new package. Free to get started, see the simple examples below.
Getting Started
In your flutter project add the dependency:
dependencies:
...
woosignal_shopify_api: ^2.2.4
Usage example
Import woosignal_shopify_api.dart
import 'package:shopify_woosignal/woosignal_shopify_api.dart';
Example using WooSignal API for Shopify
import 'woosignal_shopify_api/woosignal_shopify_api.dart';
...
// EXAMPLE GET PRODUCT
_getProducts() async {
// Step 1 - Initialize WooSignal
await WooSignalShopify.instance.init(appKey: "your app key");
// Step 2 - Call an API
ShopifyProductResponse? shopifyProductResponse = await WooSignalShopify.instance.getProducts();
print(shopifyProductResponse?.products?[0].name); // prints a product name
});
}
Available API Requests
Shopify API Client Documentation
Below is a comprehensive list of available methods grouped by their functionality.
Cart Operations
cartCheck(List<Map<String, dynamic>> cartLines)
Validates if items in the cart are in stock.
- Parameters: List of cart items
- Returns: List of validated cart items
- Method: POST
Product Operations
getProducts({int? first, String? after, String? status})
Fetches products with pagination support.
- Parameters:
first
: Number of products to fetchafter
: Cursor for paginationstatus
: Product status (active, archived, draft)
- Returns:
ShopifyProductResponse
- Method: POST
getProductsRestApi({...})
Fetches products using REST API with extensive filtering options.
- Parameters:
limit
: Maximum number of productsproductType
: Filter by product typecollectionId
: Filter by collection- Various date filters and other parameters
- Returns: List of
Product
- Method: POST
getProduct({required String productId, String? fields})
Fetches a single product by ID.
- Parameters:
productId
: Product identifierfields
: Specific fields to retrieve
- Returns:
Product
- Method: POST
getProductCount({...})
Gets the total count of products with filtering options.
- Parameters: Various filters including product type, collection ID, date ranges
- Returns:
CountResponse
- Method: POST
productSearch({String? query, int first = 100, String? after})
Searches for products.
- Parameters:
query
: Search termfirst
: Number of resultsafter
: Pagination cursor
- Returns:
ShopifyProductSearch
- Method: POST
Collection Operations
getCollectionsByIds({required List<String> ids})
Fetches collections by their IDs.
- Parameters: List of collection IDs
- Returns:
CollectionItem
- Method: POST
getProductsByCollectionId({String? id, int? first, String? after})
Retrieves products within a specific collection.
- Parameters:
id
: Collection IDfirst
: Number of productsafter
: Pagination cursor
- Returns:
ProductsByCollectionIdResponse
- Method: POST
Customer Authentication
authCustomerLogin({required String? email, required String? password, bool? loginUser})
Authenticates a customer.
- Parameters:
email
: Customer emailpassword
: Customer passwordloginUser
: Whether to automatically log in
- Returns:
AuthCustomer
- Method: POST
authCustomerRegister({...})
Registers a new customer.
- Parameters:
email
: Customer emailpassword
: Customer passwordfirstName
: Customer first namelastName
: Customer last nameacceptsMarketing
: Marketing preferences
- Returns:
AuthCustomer
- Method: POST
authCustomerForgotPassword({required String email})
Initiates password reset process.
- Parameters: Customer email
- Returns: Boolean indicating success
- Method: POST
Customer Management
authCustomer({String? accessToken})
Retrieves customer details.
- Parameters: Customer access token
- Returns:
AuthCustomerInfo
- Method: GET
authCustomerUpdate({String? customerAccessToken, String? firstName, String? lastName})
Updates customer information.
- Parameters: Access token and updated fields
- Returns:
AuthCustomerUpdateResponse
- Method: PUT
authCustomerUpdateAddress({...})
Updates customer shipping address.
- Parameters: Address details including street, city, country, etc.
- Returns:
AuthCustomerAddressUpdated
- Method: PUT
Order Management
createOrder(ShopifyOrder shopifyOrder)
Creates a new order.
- Parameters: Order details
- Returns:
OrderCreatedResponse
- Method: POST
getOrder({required String orderId})
Retrieves order details.
- Parameters: Order ID
- Returns:
OrderResponse
- Method: GET
authCustomerOrders({String? customerAccessToken, int? perPage, String? after})
Fetches customer's order history.
- Parameters:
customerAccessToken
: Customer access tokenperPage
: Results per pageafter
: Pagination cursor
- Returns:
AuthCustomerOrder
- Method: GET
Shop Information
getShop({String? fields})
Retrieves shop details.
- Parameters: Specific fields to retrieve
- Returns:
ShopResponse
- Method: POST
getPolicies({String? fields})
Fetches shop policies.
- Parameters: Specific fields to retrieve
- Returns:
PoliciesResponse
- Method: POST
checkAppStatus()
Verifies if the app can process orders.
- Returns: Boolean
- Method: POST
Shipping
fetchShippingZones()
Retrieves available shipping zones.
- Returns:
ShopifyShippingZone
- Method: GET
getShippingZones({String? fields})
Fetches detailed shipping zone information.
- Parameters: Specific fields to retrieve
- Returns:
ShippingZonesResponse
- Method: POST
getProvinces({required String id, String? fields})
Retrieves provinces/states for a country.
- Parameters:
id
: Country IDfields
: Specific fields to retrieve
- Returns:
ProvincesResponse
- Method: POST
Discounts
getDiscountCodeByLookup({String? code})
Validates a discount code.
- Parameters: Discount code
- Returns:
DiscountCode
- Method: GET
getPriceRuleById({String? priceRuleId})
Retrieves price rule details.
- Parameters: Price rule ID
- Returns:
PriceRuleResponse
- Method: POST
Disclaimer: This plugin is not affiliated with or supported by Shopify. All logos and trademarks are the property of their respective owners.
Libraries
- enums/tax_values
- models/app_tax
- models/discount_code
- models/product
- models/product_image
- models/response/app_shopify_collection
- models/response/auth/auth_customer_address_updated
- models/response/auth/auth_customer_info
- models/response/auth/auth_customer_order
- models/response/auth/auth_customer_updated_response
- models/response/auth/auth_user
- models/response/auth/customer_access_token_response
- models/response/collection_item_response
- models/response/count_response
- models/response/countries_response
- models/response/order_created_response
- models/response/order_response
- models/response/page_info
- models/response/policies_response
- models/response/price_rule_response
- models/response/product_image_count_response
- models/response/product_image_response
- models/response/product_images_response
- models/response/product_search
- models/response/product_variants_response
- models/response/products_by_collection_id_response
- models/response/products_response
- models/response/provinces_response
- models/response/shipping_zones_response
- models/response/shop_response
- models/response/shopify_category
- models/response/shopify_country_response
- models/response/shopify_error
- models/response/shopify_product_response
- models/response/shopify_product_search_response
- models/response/smart_collection_response
- models/response/woosignal_app
- models/shopify_cart_product
- models/shopify_order
- models/shopify_shipping_method
- models/shopify_shipping_zone
- networking/api_provider
- woosignal_shopify_api