When it comes to selling products on online platforms like Venddor IO, the flexibility to offer variations is crucial. Such variations can be attributes like color, size, or additional accessories. In Venddor IO, these attributes are referred to as "options."
To understand the various options associated with a product, you can retrieve a list of options specific to a product. The request requires you to target the /api/options/?product_id=:id endpoint. For instance, if you wish to see options related to a product with ID 12:
GET /api/options/?product_id=12
Upon a successful request, a 200 OK response will be returned, containing a JSON representation of the product's options.
The response structure includes various attributes detailing the option. For example:
option_id: A unique identifier for the option.product_id: The ID of the product the option is related to.option_type: Specifies the type of option.inventory: Indicates if the option affects inventory tracking.option_name: The display name of the option, like "Size" or "Color".variants: Contains the different variations available under the option, such as Small, Medium, and Large for Size.Within each variant, you'll find:
variant_id: The unique identifier for that variant.modifier: Numeric value showing any price adjustments based on the option.variant_name: The name of the variant.image_pair: Contains image-related information if an image is associated with that variant.For instance, for the option "Size," there might be variants like Small, Medium, and Large. For the option "Color," variants can be specific colors such as "Black/White/White" or "Dark Navy/White/White."
Beyond just listing product options, Venddor IO's API offers functionalities to:
Each of these actions has its respective API endpoint and parameters, providing a holistic and flexible approach to manage product variations, enhancing the overall shopping experience for customers.
In the world of e-commerce, it's paramount for products to be displayed with all their variations. Venddor IO makes this easy with its options management system. These options might refer to different sizes, colors, materials, or any other attribute that a product might possess.
To access the details of a particular product option in Venddor IO, a simple GET request to /api/options/<option_id> is needed. As an example:
GET /api/options/3
A successful request will fetch you the desired details of the option in a JSON format.
When you pull the details of an option, you're presented with a plethora of attributes. Here's a breakdown of these fields:
option_id: A distinctive ID that represents the option.product_id: The unique ID tying the option to a specific product.company_id: This ID links the option to a particular storefront in Venddor IO or a vendor, depending on the setup.option_type: Dictates the nature of the option, be it a select box, radiogroup, checkbox, and so on.inventory: Denotes if this option is considered for stock keeping.regexp: For Text or Text area option types, this field uses regular expressions to constrain user input.required: Designates if the option is mandatory for customers during purchase.multiupload: Allows customers to upload multiple files if the option type is File.allowed_extensions: If it's a File option, you can define the permitted file types.max_file_size: Sets a cap on the file size that can be uploaded.missing_variants_handling: Dictates the action when variants aren't defined for select box or radiogroup options.status: Indicates the option's state, whether active or disabled.position: Dictates the option's placement among other options in the admin panel.value: Reflects the chosen variant number or user-inputted text for Text or Text area options.option_name: The display name of the option.description: A brief tooltip description that appears alongside the option on the product page.inner_hint: Provides guidance to customers about the expected input for Text or Text area options.incorrect_message: If using regexp, this message is displayed when input doesn't match the regular expression.comment: Additional information displayed below the option on the storefront.variants: Lists out the variants of the option, available for options like Select box or Radiogroup.For options that offer multiple choices, such as sizes or colors, variants come into play. Here's what each variant field signifies:
variant_id: A unique identifier for the variant.option_id: Connects the variant to its parent option.position: The placement of the variant among others in the admin panel.modifier & modifier_type: Adjusts the product price based on the variant selection.weight_modifier & weight_modifier_type: Modifies the product's weight based on the chosen variant.point_modifier & point_modifier_type: Adjusts the reward points based on modules like the Reward Points module in Venddor IO.variant_name: The display name for the variant.image_pair: Details about the variant's associated image.The versatility of a product often hinges on its options. In the digital marketplace, it's pivotal to delineate these options in detail. Venddor IO provides a comprehensive system to manage, update, and remove product options with ease.
To add a fresh option for a product in Venddor IO, initiate a POST request to /api/options/.
You'll need to provide specific details in the request body, with certain fields being mandatory. Key fields include:
product_id*: Represents the unique ID of the product to which this option belongs.option_name*: Gives a name to the option.option_type: Defines the nature of the option, such as select box, radiogroup, etc. If left unspecified, it defaults to 'S' (select box).For example, consider the following JSON representation:
{
"product_id": "12",
"option_name": "Packaging",
"option_type": "R",
...
}
This defines an option named 'Packaging' for a product with ID '12'. The option type is 'Radiogroup'. On successful creation, Venddor IO will respond with the new option's ID:
{
"option_id": 27
}
Over time, you may need to modify an option's attributes or values. Use a PUT request to /api/options/<option_id>/ for this. For instance:
PUT /api/options/27
Provide the updated details in the request body. For instance:
{
"option_type": "S",
...
}
This example modifies the 'Packaging' option, changing its type to a Select box and updating its variants. Remember, when updating variants, it's crucial to specify all the existing and new variants to prevent any unintentional deletions.
There might be instances where a particular option is no longer relevant or needed. In such cases, you can remove it by sending a DELETE request to /api/options/<option_id>. E.g.:
DELETE /api/options/27
A successful deletion will return an HTTP/1.1 204 No Content response, while unsuccessful attempts might return HTTP/1.1 400 Bad Request or HTTP/1.1 404 Not Found if the option doesn't exist.
Venddor IO offers a flexible framework to manage product options efficiently. Whether you're adding new choices, updating existing ones, or clearing out obsolete options, Venddor IO's modules ensure a seamless experience.