Getting all products
Function: get_product_list()
& admin_get_product_list()
Purpose
This function retrieves a list of products available for customers and administrators. The get_product_list()
function is used to fetch products based on a customer’s access level, meaning some products may be restricted based on user type or permissions. On the other hand, admin_get_product_list()
provides access to all products, regardless of restrictions, allowing administrators full control over inventory and visibility. This helps businesses manage product accessibility, control pricing strategies, and ensure restricted products are only available to authorized users. Additionally, it supports filtering, sorting, and pagination to efficiently navigate large product catalogs.
Parameters
This function does not require any input parameters.
Use Case
The get_product_list()
is used to browse and purchase available products for a customer, ensuring they only see items they are eligible to buy. Businesses can apply restrictions based on customer groups, scheduled availability, and password protection, making it ideal for exclusive sales or membership-based access. The admin_get_product_list()
function allows administrators to manage all products, even those hidden from regular customers, ensuring smooth inventory tracking, bulk updates, and product lifecycle management. This separation helps maintain control over restricted products while allowing flexibility for different user types.
def get_product_list():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = True
webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())
try:
response = webcommander_sdk.product.list()
print(response)
except WCException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
def admin_get_product_list():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = True
webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())
try:
response = webcommander_sdk.admin_product.list()
print(response)
except WCException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
Response
This function returns a list of products along with details such as pricing, stock availability, variations, metadata, and access restrictions. For regular customers, the response includes only products they are allowed to purchase, while administrators receive full product listings, including restricted and password-protected items. Each product contains information such as base price, sale price, stock levels, categories, variations, and SEO metadata to support e-commerce functionality. The response also supports pagination, ensuring efficient retrieval of product lists for large inventories.
ProductListResponseDTO(
products=[
ProductDataDTO(
administrativeStatus=BOOLEAN,
advanced={
'advance_information': {
'global_trade_item_number': 'PRODUCT_GTIN',
'product_condition': 'NEW',
'loyality_points': 'LOYALTY_POINTS'
},
'webtool_disable_tracking': BOOLEAN,
'meta_tags': [
{'name': 'Meta', 'value': 'META_VALUE', 'id': META_ID}
],
'custom_information': {}
},
available=BOOLEAN,
availableFor='AVAILABLE_FOR',
availableFromDate='YYYY-MM-DDTHH:MM:SSZ',
availableStock=AVAILABLE_STOCK,
availableToDate='YYYY-MM-DDTHH:MM:SSZ',
availableOnDateRange=BOOLEAN,
availableOnWeekdays=ProductAvailableWeekdaysDataDTO(
enabled=BOOLEAN,
weekdays=[
WeekdaysDataDTO(day='DAY', startHour=0, startMinute=0, endHour=0, endMinute=0)
]
),
basePrice=BASE_PRICE,
costPrice=COST_PRICE,
customClass='CUSTOM_CLASS',
customProperties='',
heading='HEADER',
id=PRODUCT_ID,
imageAndVideo=ProductMediaDTO(
images=[
ImageDataDTO(
id=IMAGE_ID,
filename='IMAGE_FILENAME',
link='IMAGE_LINK',
thumbnail='IMAGE_THUMBNAIL'
)
],
videos=[
VideoDataDTO(
id=VIDEO_ID,
filename='VIDEO_FILENAME',
link='VIDEO_LINK',
thumbnail='VIDEO_THUMBNAIL'
)
],
specs=[
MediaDataDTO(
id=SPEC_ID,
filename='SPEC_FILENAME',
link='SPEC_LINK'
)
]
),
isOnSale=BOOLEAN,
name='PRODUCT_NAME',
parents=[
ParentDataDTO(id=PARENT_ID, name='PARENT_NAME', isInTrash=BOOLEAN, isParentInTrash=BOOLEAN, isDisposable=BOOLEAN),
ParentDataDTO(id=PARENT_ID, name='PARENT_NAME', isInTrash=BOOLEAN, isParentInTrash=BOOLEAN, isDisposable=BOOLEAN)
],
password='',
passwordProtected=BOOLEAN,
productPricingAndStock=ProductPricingAndStockDTO(
availableStock=AVAILABLE_STOCK,
enableCallForPrice=BOOLEAN,
enableMultipleOrder=BOOLEAN,
expectedToPay=BOOLEAN,
expectedToPayPrice=EXPECTED_TO_PAY_PRICE,
hidePrice=BOOLEAN,
lowLevelStock=LOW_LEVEL_STOCK,
maximumOrderQuantity=MAX_ORDER_QTY,
minimumOrderQuantity=MIN_ORDER_QTY,
multipleOrderQuantity=MULTIPLE_ORDER_QTY,
onSale=BOOLEAN,
onSalePrice=SALE_PRICE,
onSalePriceType='SALE_PRICE_TYPE',
restrictPriceFor='none',
restrictPriceForExceptCustomers=[],
restrictPurchaseFor='none',
restrictPurchaseForSelectedCustomers=[],
shippingProfile=ShippingProfileDataDTO(id=SHIPPING_ID, name='SHIPPING'),
taxProfile=TaxProfileDataDTO(id=TAX_ID, name='TAX_NAME'),
trackInventory=BOOLEAN
),
productLayout=CommonStructureDTO(id=LAYOUT_ID, name='LAYOUT_NAME'),
productSummary='PRODUCT_SUMMARY',
productDescription='PRODUCT_DESCRIPTION',
productPage={},
productType='PRODUCT_TYPE',
restrictPriceFor=None,
restrictPurchaseFor=None,
restrictForSelectedCustomers=[],
relatedProducts=[
RelatedOrSimilarProductDTO(id=RELATED_PRODUCT_ID, name='RELATED_PRODUCT_NAME', url='RELATED_PRODUCT_URL'),
RelatedOrSimilarProductDTO(id=RELATED_PRODUCT_ID, name='RELATED_PRODUCT_NAME', url='RELATED_PRODUCT_URL')
],
similarProducts=[
RelatedOrSimilarProductDTO(id=SIMILAR_PRODUCT_ID, name='SIMILAR_PRODUCT_NAME', url='SIMILAR_PRODUCT_URL'),
RelatedOrSimilarProductDTO(id=SIMILAR_PRODUCT_ID, name='SIMILAR_PRODUCT_NAME', url='SIMILAR_PRODUCT_URL')
],
selectedCustomers=[],
salePrice=SALE_PRICE,
seoConfigs=[],
sku='PRODUCT_SKU',
summary=None,
tags=[],
url=None,
videos=None
)
],
pagination=PaginationDTO(
records=TOTAL_RECORDS,
limit=PAGE_LIMIT,
offset=OFFSET,
nextPage='NEXT_PAGE_URL',
previousPage=None
)
)
Getting specific product info
Functions: get_product_info()
& get_admin_product_info()
Purpose
This functions retrieves detailed information about a specific product using its unique identifier. It provides essential data such as product name, price, description, stock availability, and other relevant metadata. Businesses can use this function to dynamically fetch product details for e-commerce platforms, inventory management systems, or customer queries. The get_admin_product_info()
function is specifically designed for administrative users, allowing them to access extended product data, including internal attributes, supplier details, and restricted settings. By leveraging this function, businesses can ensure accurate and up-to-date product information is displayed, improving customer experience and operational efficiency. Administrators can use the admin version to manage and monitor product-related configurations without directly modifying the database. This function is essential for streamlining product data retrieval across different user roles, ensuring data consistency, and reducing errors in pricing, descriptions, or stock levels.
Parameters
Parameter | Type | Description |
---|---|---|
id | String | The unique identifier of the product. |
Use Case
This both functions get_product_info()
& get_admin_product_info()
can be used when you need to fetch detailed product information for display, order processing, or inventory tracking. The admin version should be used for backend management purposes where additional product attributes are required.
def get_product_info():
webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())
try:
response = webcommander_sdk.product.info(id="PRODUCT_ID")
print(response)
except WCException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
def get_admin_product_info():
SDKConfig.PRINT_REQUEST_DATA = False
SDKConfig.PRINT_RAW_RESPONSE = False
webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())
try:
response = webcommander_sdk.admin_product.info(id="PRODUCT_ID")
print(response)
except WCException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
Response
A response object containing detailed product information such as product name, SKU, price, stock status, description, and images. The admin version provides additional fields, including supplier details, internal notes, and restricted attributes.
ProductResponseDTO(
status="STATUS",
product=ProductDataDTO(
administrativeStatus=True,
advanced=AdvancedDTO(
advance_information=AdvanceInformationDTO(
global_trade_item_number="GLOBAL_TRADE_ITEM_NUMBER",
product_condition="PRODUCT_CONDITION",
loyality_points="LOYALITY_POINTS"
),
webtool_disable_tracking="WEBTOOL_DISABLE_TRACKING",
meta_tags=[
MetaTagDTO(
name="META_NAME_1",
value="META_VALUE_1",
id="META_ID_1"
),
MetaTagDTO(
name="META_NAME_2",
value="META_VALUE_2",
id="META_ID_2"
)
],
custom_information="CUSTOM_INFORMATION"
),
available=True,
availableFor="AVAILABLE_FOR",
availableFromDate="AVAILABLE_FROM_DATE",
availableStock="AVAILABLE_STOCK",
availableToDate="AVAILABLE_TO_DATE",
availableOnDateRange=True,
availableOnWeekdays=ProductAvailableWeekdaysDataDTO(
enabled=True,
weekdays=[
WeekdaysDataDTO(
day="DAY_1",
startHour="START_HOUR_1",
startMinute="START_MINUTE_1",
endHour="END_HOUR_1",
endMinute="END_MINUTE_1"
),
WeekdaysDataDTO(
day="DAY_2",
startHour="START_HOUR_2",
startMinute="START_MINUTE_2",
endHour="END_HOUR_2",
endMinute="END_MINUTE_2"
),
WeekdaysDataDTO(
day="DAY_3",
startHour="START_HOUR_3",
startMinute="START_MINUTE_3",
endHour="END_HOUR_3",
endMinute="END_MINUTE_3"
)
]
),
basePrice="BASE_PRICE",
costPrice="COST_PRICE",
customClass="CUSTOM_CLASS",
customProperties="CUSTOM_PROPERTIES",
heading="HEADING",
id="PRODUCT_ID",
imageAndVideo=ProductMediaDTO(
images=[
ImageDataDTO(
id="IMAGE_ID",
filename="IMAGE_FILENAME",
link="IMAGE_LINK",
thumbnail="IMAGE_THUMBNAIL"
)
],
videos=[
VideoDataDTO(
id="VIDEO_ID",
filename="VIDEO_FILENAME",
link="VIDEO_LINK",
thumbnail="VIDEO_THUMBNAIL"
)
],
specs=[
MediaDataDTO(
id="MEDIA_ID",
filename="MEDIA_FILENAME",
link="MEDIA_LINK"
)
]
),
isOnSale=True,
name="PRODUCT_NAME",
parents=[
ParentDataDTO(
id="PARENT_ID_1",
name="PARENT_NAME_1",
isInTrash=False,
isParentInTrash=False,
isDisposable=False
),
ParentDataDTO(
id="PARENT_ID_2",
name="PARENT_NAME_2",
isInTrash=False,
isParentInTrash=False,
isDisposable=False
)
],
password="PASSWORD",
passwordProtected=False,
productPricingAndStock=ProductPricingAndStockDTO(
availableStock="AVAILABLE_STOCK",
enableCallForPrice=True,
enableMultipleOrder=True,
expectedToPay=False,
expectedToPayPrice="EXPECTED_TO_PAY_PRICE",
hidePrice=False,
lowLevelStock="LOW_LEVEL_STOCK",
maximumOrderQuantity="MAXIMUM_ORDER_QUANTITY",
minimumOrderQuantity="MINIMUM_ORDER_QUANTITY",
multipleOrderQuantity="MULTIPLE_ORDER_QUANTITY",
onSale=True,
onSalePrice="ON_SALE_PRICE",
onSalePriceType="ON_SALE_PRICE_TYPE",
restrictPriceFor="RESTRICT_PRICE_FOR",
restrictPriceForExceptCustomers=["RESTRICT_CUSTOMER_1", "RESTRICT_CUSTOMER_2"],
restrictPurchaseFor="RESTRICT_PURCHASE_FOR",
restrictPurchaseForSelectedCustomers=["SELECTED_CUSTOMER_1", "SELECTED_CUSTOMER_2"],
shippingProfile=ShippingProfileDataDTO(
id="SHIPPING_PROFILE_ID",
name="SHIPPING_PROFILE_NAME"
),
taxProfile=TaxProfileDataDTO(
id="TAX_PROFILE_ID",
name="TAX_PROFILE_NAME"
),
trackInventory=False
),
productLayout=CommonStructureDTO(
id="LAYOUT_ID",
name="LAYOUT_NAME"
),
productSummary="PRODUCT_SUMMARY",
productDescription="PRODUCT_DESCRIPTION",
productPage={},
productType="PRODUCT_TYPE",
restrictPriceFor="RESTRICT_PRICE_FOR",
restrictPurchaseFor="RESTRICT_PURCHASE_FOR",
restrictForSelectedCustomers=["SELECTED_CUSTOMER_1", "SELECTED_CUSTOMER_2"],
relatedProducts=[
RelatedOrSimilarProductDTO(
id="RELATED_PRODUCT_ID_1",
name="RELATED_PRODUCT_NAME_1",
url="RELATED_PRODUCT_URL_1"
),
RelatedOrSimilarProductDTO(
id="RELATED_PRODUCT_ID_2",
name="RELATED_PRODUCT_NAME_2",
url="RELATED_PRODUCT_URL_2"
),
RelatedOrSimilarProductDTO(
id="RELATED_PRODUCT_ID_3",
name="RELATED_PRODUCT_NAME_3",
url="RELATED_PRODUCT_URL_3"
)
],
similarProducts=[
RelatedOrSimilarProductDTO(
id="SIMILAR_PRODUCT_ID_1",
name="SIMILAR_PRODUCT_NAME_1",
url="SIMILAR_PRODUCT_URL_1"
),
RelatedOrSimilarProductDTO(
id="SIMILAR_PRODUCT_ID_2",
name="SIMILAR_PRODUCT_NAME_2",
url="SIMILAR_PRODUCT_URL_2"
),
RelatedOrSimilarProductDTO(
id="SIMILAR_PRODUCT_ID_3",
name="SIMILAR_PRODUCT_NAME_3",
url="SIMILAR_PRODUCT_URL_3"
)
],
selectedCustomers=["SELECTED_CUSTOMER_ID_1"],
salePrice="SALE_PRICE",
seoConfigs=[],
sku="SKU",
summary="SUMMARY",
tags=["TAG1", "TAG2"],
url="PRODUCT_URL",
videos="PRODUCT_VIDEOS"
)
)
Getting products count
Function: get_product_count()
& admin_get_product_count()
Purpose
Retrieves the total number of products available. For get_product_count()
, it returns the count for customers, groups, or anonymous users based on their access, whereas admin_get_product_count()
provides the full count for all products accessible by the admin.
Parameters
This function does not require any input parameters.
Use Case
The get_product_count()
function is used to get an idea of how many products are available to customers in the store, ensuring they see only items they can purchase. Administrators use admin_get_product_count()
for inventory management, tracking total product numbers, including hidden or restricted items. This distinction is useful for managing special promotions, private sales, or exclusive memberships where not all products should be publicly accessible
def get_product_count():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = True
webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())
try:
response = webcommander_sdk.product.count()
print(response)
except WCException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
def admin_get_product_count():
SDKConfig.PRINT_REQUEST_DATA = True
SDKConfig.PRINT_RAW_RESPONSE = True
webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())
try:
response = webcommander_sdk.admin_product.count()
print(response)
except WCException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
Response
The response returns the number of products available. For get_product_count()
, this number represents only the products the current customer can access. In contrast, admin_get_product_count()
provides the total number of products in the system, including restricted items. This helps businesses understand inventory size from both a customer and administrative perspective.
CountResponseDTO(count=TOTAL_PRODUCT_COUNT)
Getting product settings
Function: get_product_settings()
Purpose
This function get_product_settings()
retrieves global product settings that define how products behave within the system. It provides essential configurations such as pricing rules, stock management settings, tax policies, display preferences, and other operational parameters. Businesses can use this function to dynamically adjust product behavior, ensuring consistency in pricing, stock control, and visibility settings across their platform. It helps developers, administrators, and system integrators access predefined product rules without manually checking configurations in the database. By leveraging this function, businesses can streamline product management, reduce errors, and ensure compliance with pricing and tax regulations. This is particularly useful for multi-channel e-commerce platforms, inventory systems, and custom storefronts that rely on system-wide product configurations.
Parameters
No input parameters are required for this function.
Use Case
This function get_product_settings()
when you need to retrieve system-wide product settings for pricing, inventory control, tax policies, and display configurations. It is particularly useful for ensuring that all products adhere to a consistent set of rules across different parts of the system.
def get_product_settings():
webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())
try:
response = webcommander_sdk.product.settings()
print(response)
except WCException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
Response
A response object containing global product settings, including pricing configurations, stock control rules, tax settings, and display preferences. These settings define how products function within the system and affect pricing, availability, and presentation.
ProductSettingsDataDTO(
labelForCallForPrice="Call for Price",
labelForExpectToPay="Expect to Pay",
labelForBasePrice="Today's Price",
addToCart="true",
variationOptionView="flat"
)