Magento 2 Advanced Product Options Manual¶
Introduction¶
Magento 2 Advanced Product Options extension significantly extends the functionality of native customizable options.
Requirements and Installation¶
Advanced Product Options supports Open source (Community), Commerce (Enterprise) editions and Commerce cloud. The current version of the Magento installed on your website can be found in the lower right corner of any backend page.
Advanced Product Options has 3 separate ways of installation:
1) Copy the code (ready-to-paste package);
2) Use MageWorx Repository;
3) Use local Composer.
Configuration¶
Before using the extension, we recommend to configure it to enable/disable the appropriate features. Go to STORES ⟶ Configuration ⟶ MageWorx ⟶ Advanced Product Options. There are several sub-sections, which group the settings.
General¶
- Enable Option Value Collection Cache - this setting enables the cache for options' values to increase the performance on the product pages. This setting might cause compatibility problems with some themes.
Option Features¶
-
Product Price Display Mode - this setting allows you to choose how the product price is shown on the product page.
--- Disabled - this mode disables any product price updates if product Qty is changed, i.e. this is how default Magento 2 works (the option prices are still added to the product price).
--- Per Item - this mode display the price per 1 item, including the product tier prices and custom options. I.e. this product price is dynamically changed to the appropriate tier price, when the product Qty is changed on the product page. The custom options are added as well using the correct tier prices.
--- Final Price - this mode displays the final product price, i.e the "Price per item" is multiplied by the specified product Qty. -
Add Total Product Price Field - this setting allows you to add additional final product price just above the Add-to-cart button. It might be helpful if you have a large list of configurations/options and you need to duplicate the product price above the add-to-cart button or if you need to display a price per 1 item in the top of the page and the total product price below the options.
-
Enable Custom Options Weight - this setting enables the weight functionality for custom options. If it is enabled, you will be able to specify a weight for each value of the options of the Select input type. The option's value weight will be added to the product's weight if this value is chosen.
-
Enable Custom Options Absolute Weight - this setting enables the absolute weight functionality for custom options. If enabled, the option value's weight will replace the product's weight, when this value is chosen.
Note
The absolute weight can be enabled on a product or template level only, i.e. you cannot enable this feature for a certain option only.
-
Enable Custom Options Cost - this setting enables the cost functionality for custom options. If it is enabled, you will be able to specify a cost for each value of the options of the Select input type.
-
Enable Custom Options Absolute Cost - this setting enables the absolute cost functionality for custom options. If enabled, the option value's cost will replace the product's cost, when this value is chosen.
Note
The absolute cost can be enabled on a product or template level only, i.e. you cannot enable this feature for a certain option only.
- Enable Custom Options Absolute Price - this setting enables the absolute price functionality for custom options. If enabled, the option value's price will replace the product's price, when this value is chosen.
Note
The absolute price can be enabled on a product or template level only, i.e. you cannot enable this feature for a certain option only.
-
Enable Absolute Price By Default - this setting makes the "Absolute price" toggle enabled by default, when you add new products with options or creating new option templates.
-
Enable One Time Custom Options - this setting enables the one-time functionality for custom options. The options, marked as one-time, will be added only once despite on a added product quantity. I.e. if a product price is $100 and an option price is $50, if a customer adds 5 quantities of this product with this option selected, the total price will be $550 = $100 * 5 + $50.
-
Enable Custom Options Quantity Input - this setting allows you to enable the Qty field for custom options of the Select input type on the front-end. If enabled, your customers will be able to specify a quantity of selected option they need to order.
Note
The added quantities for the options affect the final product price if the options have the price, i.e. the formula is as follows: (product_price + option_price * option_Qty_input) * product_Qty. If the chosen option is one-time, the formula will be as follows: product_price * product_Qty + option_price * option_Qty_input.
-
Default Option Qty Field Label - this setting defines the default label for the Qty input field on the front-end. You can change it to adjust the title of the field or translate to different languages. This setting has the store-view scope so you can specify it for each store view (language) if necessary.
-
Enable Option's Value Description - this setting allows you to enable the description for the option's values. If enabled, you will be able to specify the description for each value of the options of the Select input type. The description of the option's value will be displayed below the option once the appropriate value is chosen.
-
Enable Option Description - this setting enables the description for the options. The descriptions can be displayed either as a plain text below the option's title or as a tooltip, which appears on mouse hover over the option's title.
-
Enable WYSIWYG Editor For Descriptions - this setting enables the WYSIWYG functionality to enter the descriptions.
-
Selection Limit From-To Message Template - this setting allows you to add a note if an option has the "From" and "To" selection limits. This note will be shown below the option on the front-end to inform your customers about the min/max numbers for selection.
-
Selection Limit From Message Template - this setting allows you to add a note if an option has only "From" selection limit. This note will be shown below the option on the front-end to inform your customers about the min/max numbers for selection.
-
Selection Limit To Message Template - this setting allows you to add a note if an option has only "To" selection limit. This note will be shown below the option on the front-end to inform your customers about the min/max numbers for selection.
-
Option Gallery Thumbnail Image Height - this setting defines the height of the images, which appear below the option.
-
Option Gallery Thumbnail Image Width - this setting defines the width of the images, which appear below the option. Leave it empty (or 0) if you want the square size (the width will be equal to the height value).
-
Option Value Tooltip Image Size - this setting defines the size of the option's value image, which appeares in the tooltip with the value's desription.
-
Enable Shareable Link - this setting enables/disables the functionality.
-
Shareable Link Title - this setting allows you to change the title of the link visible for your customers.
-
Shareable Link Description - this setting allows you to specify the text, which appears in the tooltip.
-
Shareable Link Success Message - this setting allows you to change the text, which appears when the link is copied to the clipboard.
-
Enable Load Linked Product - if enabled, the linked product will be loaded upon the value selection on the front-end. The value should be linked to existing product to enable this feature. Note: this feature supports the Swatch options only.
Option SKU Policy¶
These settings determine the SKU Policy behavior.
-
Enable SKU Policy - this setting enables/disables the SKU policy for custom options.
-
Default SKU Policy - this setting defines the default SKU policy for custom options. See more details here about available SKU Policy mods.
-
Apply SKU Policy To - this setting defines if the appropriate SKU Policy mode should be applied in the cart and in the placed order OR just after order is placed.
-
Split Independents - this setting displays the same products as separate items in the cart if they were linked as the options to different parent products and both parents products are added to the cart.
Example
Let's assume we have the product A with custom option, linked to the product C and Independent SKU Policy.
The product B with the option, linked to the product C, and Independent SKU Policy. The products A and B are the parent products. If a customer adds the product A with the option and the product B with the option to the cart, in default Magento 2 you will see 3 items in the cart: Product A with Qty 1, Product B with Qty 1 and Product C with Qty 2.
This setting allows you to split the product C as different items and display each splitted item below the parent product. I.e. you will see the products in the following order:
Product A
Product C
Product B
Product C
Option Swatches¶
-
Swatch Height and Swatch Width - these settings define the size of the image/color swatches shown on the front-end.
-
Text Swatch Max Width - this setting defines the width of the text appeared in the swatch (button) option if no image is uploaded. This value is set in pixels.
-
Show Title Under Swatch - this setting displays the swatch option' value title below the swatch thumbnail on the front-end.
-
Show Price Under Swatch - this setting displays the swatch option' value price below the swatch thumbnail on the front-end.
Option Dependency¶
- Enable Title Identifier - this setting adds new input field for each value of the options. It allows you to specify unique values for each value so to easily separate the option values while configuring the dependencies.
Option Visibility¶
-
Enable 'Disable' Option Value - this setting adds the posibility to disable certain option values. Such values won't be available on the product. It might be helpful if you need to disable specific option values.
-
Enable Visibility Customer Group - this setting enables the functionality to select the customer groups the options should be available for. You can select the customer groups for each option.
-
Enable Visibility Store View - this setting enables the functionality to select the store views the options should be available for. You can select the store views for each option.
Option Advanced Pricing¶
- Enable Special Price - this setting enables the "Special price" functionality for custom options.
Note
The special price should be less than the option value price. Otherwise, the special price won't be shown on the front-end.
- Option Special Price Display Template - this field sets the template, how the option price will be shown on the front-end if option special price is available.
Note
Possible variables:
- {special_price} - it outputs a special price of an option value,
- {special_price_excl_tax} - it outputs a special price of an option value excluding tax,
- {price} - it outputs a main price of an option value,
- {price_excl_tax} - it outputs a main price of an option value excluding tax,
- {special_price_comment} - it outputs a comment, added for an option value special price.
For "Including and Excluding Tax" price display mode (Sales -> Tax -> Price Display Settings -> Display Product Prices In Catalog -> "Including and Excluding Tax"), we recommend to use template "+{special_price} (Excl. tax: {special_price_excl_tax}) (Regular Price: {price}. {special_price_comment})". The {special_price} variable will show a special price, including tax in this case.
-
Enable Tier Price - this setting enables the "Tier price" functionality for custom options.
-
Display Tier Price Table - this setting displays the tier prices table below the option on the front-end.
Option Inventory¶
-
Enable Option Inventory Functionality - this setting enables/disables the entire options stock functionality on the front-end and in the back-end.
-
Display Option Inventory on Front-end - this setting allows displaying the available quantity near the options on the front-end.
-
Display Out-Of-Stock Message - this setting allows displaying the "Out of stock" message near the out of stock options on the front-end.
-
Display Out-Of-Stock Message on Options Level - this setting displays the 'out of stock' message near an options if all option's values are out of stock. I.e. the customers will see a message that all values of a certain option are out of stock near an option's title.
-
Out-Of-Stock Options - this setting allows you to either hide or disable out of stock option values on the front-end. If this setting is set to "Disable", the out of stock value will be shown but unavailable for select on the front-end.
-
Show Required 'Out of stock' Options' - this setting will keep the required out of stock options visible if the setting above is set to "Hide".
Option Link¶
- Link Assigned Product's Attributes to Option via SKU - this setting defines what product attributes will be linked to the option, i.e. the selected values will be synced with linked products. These parameters will be disabled for editing on the option level once the option is linked to the product.
Option Import/Export¶
- Ignore Missing Images - this setting defines if the import process can be processed with missing images or not. I.e. if you migrate the options or option templates from Magento 1 to Magento 2 or Magento 2 to Magento 2, you need to copy the folder with images first (if you use images for options). If this setting is set to "No", the system won't allow you to proceed with the import unless the images folder is copied. If this setting is set to "Yes", the extension will import the file and add the errors to the system log with paths to the missing images.
Option Types¶
The extension supports the following options types:
Select¶
-
Radio-button
Example: -
Check-box
Example: -
Drop-down
Example: -
Swatch (image / color / text aka buttons)
Example (image swatch): Example (color swatch): Example (text swatch aka "buttons"): -
Multiple-select (including multiple-swatch & multiple-buttons)
Example:
Text¶
-
Text field
Example: -
Text area
Example:
File¶
- File upload
Example:
Date¶
-
Date
Example: -
Date & Time
Example: -
Time
Example:
Custom Option Templates¶
Advanced Product Options extension allows you to group the options and apply these groups of options (option templates) to any number of products. It saves lots of time if you need to add similar options to a large number of products. Updating the options in the templates will update all options on the assigned products as well.
Log into the Magento Admin panel and go to STORES ⟶ MageWorx Option Templates ⟶ Manage Option Templates.
Here, you can see the list of all the created templates and the number of products each template is assigned to.
To create a new product custom option template, click the Add New Option Template button.
The initial setup of the template consists of the 3 tabs.
Options Template Settings¶
Title. Internal name of a template. Will be visible in the "Manage Option Templates" and on the Product Edit page.
Assigned Products¶
Here, you can select the products that should use this template.
Note
Note that after the template is saved and the dropdown is set to Yes, only the selected products will be shown. This may be handy in order to edit the products that should be applied by this template.
Add Products by ID/SKU¶
You can also assign templates to products by entering their Product IDs or Product SKUs. Each individual ID/SKU should be comma-separated.
Note: no spaces allowed between multiple values.
The store owner can use both Assigned Products tab and this one simultaneously. Afther the template is saved, all the selected products will be visible in the Assigned Products grid.
Customizable Options¶
The customizable options is the main place for managing the template. You can manage the options of the certain template here.
Option Images¶
Custom option images implementation allows you to create a visual presentation of your products using the custom options. Thus, with this feature you can:
-
upload multiple images to a custom option’s value;
-
specify a color using the colors palette for color swatches;
-
display uploaded images below the custom options on the front-end;
-
use uploaded images as the thumbnails for image swatches;
-
replace a product’s image with a custom option’s one;
-
display option images in the tooltip;
-
overlay the option's images above the product's image.
The images setup is available only for the "Select" input type of the custom options.
To upload the images to an option's value click on "Images" icon for the appropriate value:
You can upload the unlimited number of images or specify a color:
Each image has the "Image Details" window:
- Text - it is actually the HTML alt tag for uploaded image.
- Role - it specifies the image display mode and behavior on the front-end.
- Base role is the default image. This is the image that will be shown as swatch if swatches are enabled;
- Tooltip is the image that is shown in the tooltip popup;
- Replace Main Gallery Image replaces the main product image;
- Overlay image puts the option image on the product image, creating the overlay effect.
For instance, we've uploaded 3 images and selected separate roles for them.
On the frontend, we observe the product with the swatches (Base image) and, on hover, we can observe the "Tooltip image".
The main product image is replaced with the "Replace Main Gallery Image".
Note
The option's description can be shown in the tooltip below the image for the options of Select type. For this, at least one image should be marked as "Tooltip" in the "Role" setting and the description is specified for the option's value:
- Hide from Option Gallery - this check-box allows you to hide the image from the option images gallery, which is shown below the option. It might be helpful if you have one image, which replaces the main product image, and you need to hide it from the option images gallery, when this option is chosen.
The Option Gallery Display Mode and Image Mode can be set in the "Option Settings" section on the option level:
The Option Gallery Display Mode:
-
Disabled - no images will be shown below the option once it is selected on the front-end.
-
Beside Option - this mode will display the uploaded images below the appropriate option value on the front-end, no matter if the option value is chosen or not.
-
Once Selected - this mode will display the uploaded images below the appropriate option value on the front-end, when the option is chosen only.
The Image Mode:
-
Disabled - the option images won't change the main product image.
-
Replace - if this mode is enabled, the option's value image, marked as Replace Main Gallery Image will replace the main product image, if the option's value is chosen on the front-end.
-
Overlay - the option images will overlay above the main product image. If you have multiple options with the Overlay mode, all such images will be overlayed in the order of the options display.
Use Cases
Click here to see the practical Use Cases of this functionality.
Image/Color Swatches¶
The Advanced Product Options extension allows you to create the image, color swatches and buttons. To add a swatch option, choose the Drop-down input type and enable "Is Swatch" check-box.
For the options you can upload images and specify the colors using the colors palette. Both images and colors can be set as the swatch thumbnail.
To upload the images or colors, click on the "Image" icon for the appropriate value:
Then uploade a new image (select a color) or click on existing image or color you want to display as the thumbnail for the current swatch value.
The new Magento 2 modal window with the image details will be opened. You should choose the "Base" role to display the image/color as the thumbnail on the front-end:
Once it is configured, the swatch option will be shown on the front-end:
If you add the colors instead of the images and choose the "Base" role for them, the swatch will be displayed as the color swatch:
If you need to change the size of the image/color thumbnails on the front-end, you can easily adjust it in the settings "Swatch Height" & "Swatch Width" (SYSTEM ⟶ Configuration ⟶ MageWorx ⟶ Advanced Product Options ⟶ Option Swatches).
By default, the title of the swatch values is not shown on the front-end untill the swatch value is selected. However, you can display the titles of all swatch values below the appropriate values by default. For this just enable the setting "Show Title Under Swatch" (SYSTEM ⟶ Configuration ⟶ MageWorx ⟶ Advanced Product Options ⟶ Option Swatches):
The setting "Show Price Under Swatch" enables the same behavior for swatch price.
Note
The swatch options will be shown as simple drop-downs during the manual order creation flow, i.e. when you create orders manually from the back-end.
Enable "Load Linked Products" functionality
Once the "Is Swatch" check-box is selected, the new setting "Load Linked Product" in the value's settings section appears. This setting allows you to enable the functionality to load the product page of the linked product upon the certain option's value selection.
Usage example:
Let's assume you have a mobile phone product, which comes in different colors. Thus you have the separate products in your catalog for each color: phone red, phone white. Now you need to switch to the appropriate product page when a customer selects the color. You create the swatch option "Color": "Red", "White" and add it to both these products. Then you should link the "red color" option's value to the "phone red" product using the SKU and the Options Link functionality and the "white color" option's value to the "phone white" product on each product.
Note: the "Load Linked Product" toggle should be enabled for the values, which should load the linked products upon the selection.
Once it's one, the system will pre-select (mark as default) the red color value on the phone red product and the white color on the phone white product. It's necessary to switch and select the options correctly when loading the linked products.
Dependent Custom Options¶
With Advanced Custom Options extension, you can create dependent custom options.
For this, on the child option click the Dependency button.
The dependency setup appears with the possibility to specify conditions.
The Dependency Type setting defines the conditions to display the current option value on the frontend. AND dependency sets the scenario, when the child option gets displayed IF all the parent options are selected. OR dependency sets the scenario, when the child option gets displayed IF any of parent options gets selected.
The Parent Options field allows choosing the option values that should be selected to display the current option value on the front-end. It supports the multiselect and the tree of options for the easy navigation though option features.
Sometimes, the value of the separate options or even the option names can be the same. To distinguish them, the special setting adds the possibility to add the suffix to the name.
If such a situation occurs, go to STORES ⟶ Configuration ⟶ MAGEWORX ⟶ Option Dependency.
Enabling Title Identifier setting allows specifying it in the Product Options configuration. The ID can be managed for both option and option value.
Once this ID is specified, you will see it near each option and option's value, when configuring the dependency.
Use Cases
Click here to see the practical Use Cases of this functionality.
Options Pricing¶
One-time options¶
Out of the box in Magento 2 if a customer selects an option with a price and add a product with quantity more than 1, the price of the selected option will be multiplied by the quantity of the added product.
Example
Product price is $50
Option's value price is $10
Product is added with quantity 5
The final product (including the selected option) price will be 300 *(5 * (50+$10))*.
However, sometimes you need to add the option, which won't be multiplied by the quantity of added product and will be added only once despite of the added quantity. The Advanced product options extension can cover this case.
First, you need to enable the setting 'Enable One Time Custom Options' (it can be enabled in SYSTEM ⟶ Configuration ⟶ MageWorx ⟶ Advanced Product Options ⟶ Options Features). This setting enables the one-time functionality for custom options *(you will see the 'One-time' toggle for each option). The options, marked as one-time, will be added only once despite on the added product quantity.
Example
Product price is $50
Option's value price is $10 (option is marked as one-time)
Product is added with quantity 5
The final product (including the selected option) price will be $260 (5 * $ 50+$10).
If the 'Qnty Input' functionality is enabled, the added quantities for the options affect the final product price if the options have the price. I.e. the formula is as follows: (product_price + option_price * option_Qty_input) * product_Qty.
If the chosen option is one-time, the formula will be as follows: (product_price * product_Qty + option_price * option_Qty_input).
Absolute prices¶
The custom options in the default Magento 2 adds the price to the main product price when selected. Our extension allows adding the options that will replace the main product price once selected.
First, you need to enable the setting 'Enable Custom Options Absolute Price' (it can be enabled in STORES ⟶ Configuration ⟶ MageWorx ⟶ Advanced Product Options ⟶ Options Features). This setting enables the absolute price functionality for custom options. (you will see the 'Absolute price' toggle for the product or options template).
Note
The absolute price can be enabled on a product or template level only, i.e. you cannot enable this feature for a certain option only. However, if you add multiple options on the product and enable the absolute price, the price of the first selected option will replace the main product price and all other options will add the extra prices to that price..
Price per character¶
The APO extension allows creating the text options with the price per each entered character (excluding the spaces). This price type is available for the 'Field' and 'Text area' option types only:
The specified price will be added for each entered character in the certain option on the front-end. The extension shows the price per character and the total price for entered characters on the front-end:
Price per measurement¶
The APO module is also equipped with the functionality to create and calculate the options based on the values, entered by the customers on the front-end. See more details in the Dynamic Options section.
Advanced Pricing¶
To observe the Advanced Pricing pop-up, click the Advanced Pricing button on the child option.
Note
This icon is available if either tier price or special price is available for the options (STORES ⟶ Configuration ⟶ MageWorx ⟶ Advanced Product Options ⟶ Advanced Pricing)
The extension provides the possibility to implement the special prices and the tier prices (aka customer group prices) in the custom option configuration. Setting up these price types encourages customers to purchase more.
Special Price¶
The option Special Price behaves the same as Magento 2 native product special price. It can be offered for a defined period of time. It is shown instead of the regular one. The regular price is provided as well in the note, showing the possible benefit.
Here, you can see the special price ($ 5.00) with the comment and the original price of this option ($ 10.00). You can change the special price output in the advance pricing configuration.
This is the backend setup of the special price:
For the Special Price, the store owner can select the desired Customer Group, From - To dates and enter the Comment visible on the frontend.
The Price can be set as:
- Fixed - if fixed price type is selected, the numbers represent the exact option's value special price.
- Percentage discount - this value allows you to set a percentage discount from a current option's value price.
Example
Case 1
Option's value price is $50
Option's value special price is 30%
The final option's value special price will be $15 (30% from $50).
Case 2
Product price is $150
Option's value price is 50%
Option's value special price is 30%
The final option's value special price will be $22.50 (first option's value price is calculated as (50% from $150 = $75) and then option's value special price is calculated as (30% from $75 = $22.50).
Note
The special price should be less then the original option price. Otherwise, it won't be shown on the front-end.
Customer Group Price (Tier Price)¶
The Customer Group Prices (Tier Prices) lets you set quantity discount on each order item purchased in bulk. These prices can be set up for a designated period of time for some particular customer group just as the Special Prices. You can enable the customer group price output in the advance pricing configuration.
Here, you can see the customer group prices grid with the new price and the discount percent.
Note
The discount percent is calculated from the special price (as here, $ 5.00) or from the original option's value price (if the special price is not set up).
This is the backend setup of the customer group prices:
The Customer Group Price / Tier Prices section provides the same grid as the special price with the same set of columns. The Qty provides the possibility to specify the quantity threshold as well. This number states the minimum value for the bulk purchase with the new price. There is a direct correlation between the quantity and the price for one item. In the screenshot above, according to the settings, the customers should see the $ 6.00 price if they add at least 3 products, $ 4.00 for 5 products and so on.
The Price can be set as:
- Fixed - if fixed price type is selected, the numbers represent the exact option's value tier price.
- Percentage discount - this value allows you to set a percentage discount from a current option's value price or from an option's value special price (if specified).
Example
Case 1
Option's value price is $50
Option's value tier price for Qty 5+ is 30%
The final option's value tier price per 1 item for quantities 5+ will be $15 (30% from $50).
Case 2
Product price is $150
Option's value price is 50%
Option's value tier price for Qty 5+ is 30%
The final option's value tier price per 1 item for quantities 5+ will be $22.50 (first option's value price is calculated as (50% from $150 = $75) and then option's value tier price is calculated as (30% from $75 = $22.50).
Note
The customer group price should be less then the option's value original price or option's value special price (if specified). Otherwise, such tier price won't be shown on the front-end.
Configuration¶
The configuration and the layout of these prices can be managed in the Option Advanced Pricing configuration. For this, go to STORES ⟶ Configuration ⟶ MAGEWORX ⟶ Advanced Product Options and open the Option Advanced Pricing tab.
Option Link¶
The Option Link functionality allows you to solve a quite frequent task, when you need to add some other products as the custom options of the main product. This can be done via bundle products creation, but it may be rather a time-consuming and tricky operation that doesn’t allow to change the custom option’s prices or some other features.
This can be solved by means of the Option Link functionality: the store owner should just add the products’ SKUs into the custom options SKU box and all the SKU’s characteristics will be automatically pulled into this option.
Example
This functionality perfectly suits for adding cross-selling items or building bundles. Let's assume you sell iMac. You also sell the mouse and keywords separately.
Goal: you want to offer your customers to add the mouse and/or the keyboard, when they purchase iMac.
Problem: if you add the mouse & keyboard as custom options, the stock of these items won't be linked to the main mouse & keyboard products and you will have to update the inventory of these products if someone purchases iMac + mouse + keyboard.
Solution: our extension allows you to create the mouse and keyboard as custom options for iMac and link these options to the mouse and keyboard products using our "Option Link" feature. Thus, the stock of these options and these linked products will be synced. You can also sync other product attributes like name, weight, cost and price.
For this, go to STORES ⟶ Configuration ⟶ MAGEWORX ⟶ Advanced Product Options and open the Option Link tab.
This settings specify what product’s attributes should be copied to the option’s ones when they are connected via SKU. If none is selected, nothing will be copied from the linked products to the option. When some settings are selected, they will be grayed out in the product option.
Suppose you need to associate the product option with some particular product like this one. The SKU of the product is 24-MG01.
If we put 24-MG01 in the SKU box of the product option, the name, value and the price will be automatically populated from this product after saving the main product.
SKU Policy¶
SKU Policy feature lets you determine how the SKU of the products with custom options will be formed in the order. This functionality also enables the behavior to split the main product and custom options as separate items in the cart if Options Link feature is enabled.
By default, Magento 2 append an option's value SKU to a main product SKU if the selected option's value has SKU.
Example
Product SKU: 24-MG01
Option's value SKU: red_sku
Using default Magento 2, the final product SKU will be "24-MG01-red_sku".
SKU Policy doesn't create extra products in your store. That’s why the "Independent" and "Grouped" SKU Policies only work, when an option's value is linked to a product that already exists in the catalog. Note that it is possible to link only the simple and virtual products.
We provide several methods to manage the SKU policy.
First of all, the SKU policy settings can be handled globally. For this, go to STORES ⟶ Configuration ⟶ MAGEWORX ⟶ Advanced Product Options and open the Option SKU Policy tab.
(More details about these settings can be found here)
The merchant should Enable SKU Policy to use this feature.
There are 5 types of SKU solutions. We will check all of them based on the product with several custom options. The original SKU of the product is dell-opti-ind
.
-
The standard. If any information is provided, it will be added to the initial SKU with the hyphen like SKU-optionname. Separate custom SKUs are added in the same way (SKU-optionname1-optionname2).
-
The disabled. This solution simply ignores the SKU and doesn't add it to the order. Only the main product SKU will be provided.
-
The replacement. This mode replaces the product’s SKU with the option’s one in the order. The original SKU won't be shown in this case. Only the last product option SKU will be shown.
-
The independent mode transforms custom options into separate items in the order and keeps the original product.
-
The grouped mode transforms custom options into separate items in the order and hides the original product.
It's possible to apply the SKU Policy to the order view or to the cart and order view. Thus, you get a full control of how you need to display custom options with SKUs in the order.
The SKU Policy can be specified for:
- all products - the SKU policy mode, specified in "Default SKU Policy" setting (STORES ⟶ Configuration ⟶ MAGEWORX ⟶ Advanced Product Options ⟶ Option SKU Policy) will be applied to all products by default, unless the policy is changed on a product or option level.
- each product - you can specify the SKU Policy on a product level. In this case, the policy, specified on a product level, has higher priority than the default policy mode. "Use Config" mode means to use the default policy mode.
- each option - you can specify the SKU Policy on an option level. In this case, the policy, specified for an option, has higher priority than the product and default policy modes. "Use Config" mode means to use the product policy mode.
Stock Management¶
Advanced Product Options extension allows you to specify the available stock quantity for each custom option's value.
To start using the inventory for custom options, the Manage Stock toggle should be enabled and the Quantity value is specified.
To change the way how the custom options inventory is shown and works for your clients on the frontend, go to STORES ⟶ Configuration ⟶ MAGEWORX ⟶ Option Inventory. See more details here
Сustom Option Inventory Report
Advanced Product Options extension has a detailed built-in stock report for custom options. There may be hundreds of such options with different inventories. The stock report allows you to view all custom options with their inventories from one user-friendly grid. To view this report go to STORES ⟶ Other Settings ⟶ Option Inventory Report
The grid allows you to sort the custom options. It may be useful to check the out-of stock or low-in-stock products.
The default Magento functionality to update several values from the grid in bulk is provided here as well. For this, mark the checkbox of the desired custom options and click the "Actions" Dropdown.
Click the "Edit" option:
This option allows you to update the "Quantity" and the "Manage stock" toggle in bulk. To apply the changes click the "Apply" button and the "Save Edits".
You can modify any particular custom option by clicking the Edit button.
Use Cases
Click here to see the practical Use Cases of this functionality.
Option Description¶
The extension allows you to specify the description for each option and each option's value. You can either set the global description (for all store views) or translate the descriptions for certain store views.
To enable the descriptions for options and option's values, go to STORES ⟶ Configuration ⟶ MageWorx ⟶ Advanced Product Options ⟶ Option Features and configure the appropriate settings:
-
Enable Option's Value Description - this setting allows you to enable the description for the option's values. If enabled, you will be able to specify the description for each value of the options of the Select input type. The description of the option's value will be displayed below the option once the appropriate value is chosen.
-
Enable Option Description - this setting enables the description for the options. The descriptions can be displayed either as a plain text below the option's title or as a tooltip, which appears on mouse hover over the option's title.
-
Enable WYSIWYG Editor For Descriptions - this setting enables the WYSIWYG functionality to enter the descriptions.
Once the descriptions are enabled for options and their values, the "Description" icon will appear for the option and the option's values:
Both icons open the Magento 2 modal window to specify either the description for the option or for the option's value.
By default, the description will be applied to all store views. If you need to change it or translte for certain store views, you need to disable the "Use Global Description" toggle and specify the different description for each store view:
The descriptions support HTML tags, i.e. you can style the text and add images.
Option description as tooltip:
Option description as text:
Option's value description:
Swatch option description + image:
Note
The option's description can be shown in the tooltip below the image for the options of Select type. For this, at least one image should be marked as "Tooltip" in the "Role" setting:
Options Visibility¶
The Advanced Product Options extension allow you to control the options visibility. In order to manage the visibility settings for a particular option, click on the "eye" icon:
The Visibility section for a custom option looks like:
-
Disabled - this toggle allows you to disable a certain option. It might be helpful if you need temporary disable the option without the necessity to remove it.
-
Customer Groups - this setting allows you to assign the certain option to the necessary customer groups. The customers of the customer groups, not selected in this setting, won't see the option on the front-end. Thus, you can easily build different product configurations for different customer groups.
-
Stores - this setting allows to you assign the options to all or specific store views. Thus, you can hide the options on specific store views.
You can manage the visibility either on the template or product level. The visibility set on the product level has higher priority.
Multi-stores Support¶
The extension allows you to translate the option & option's value title and description for each store views. To manage the titles and descriptions for each store view, click on the "Store view title" or "Desription" icon for the option or the option's value:
You can specify the title and the description of the option and the option's values for each store view.
Option Weight & Cost¶
The APO allows you to specify a cost and a weight for each option's value for the options of the Select type. To specify a cost or a weigh for an option's value, you should click on the "Settings" icon:
The settings management window looks like:
-
Cost - this field allows you to set a cost of a certain option's value. The specified cost will be added to the main product cost if this value is chosen. It might be helpful if you need to update the product cost if specific options are chosen.
-
Weight - this field allows you to set a weight of a certain option's value. The specified weight will be added to the main product weight if this value is chosen. It might be helpful if you need to update the product weight if specific options are chosen. The final weight will affect the shipping calculations as well.
-
Weight Type - this setting allows you to specify either a fixed or percentage weight. If the fixed is set, the option's value weight will be added to the product weight. If the percentage weight type is chosen, it means that the option's value weight will be calculated as the percent (specified in the "Weight" field) from the product weight.
Example
Let's assume the product has weight 100 lbs. The option's value weight is set as 30%. If a customer chooses this option's value, the final product weight will be 100 lbs + (30% from 100) = 130 lbs.
Sometimes you need to replace the product cost or weight by the option's cost or weight. In this case, you can enable the "Absolute Cost" and "Absolute Weight" toggles on the product or the option template level:
In this case, the option's value cost and weight will replace the main product weight once selected.
Note
If you have multiple options with "absolute" cost & weight on the product, the cost and weight of all selected options will be summarized and the final price will be set as the product cost & weight.
Option Styles (CSS)¶
The APO extension allows you to easily assign any CSS class to each option. It helps you to customize the layout of the options and adjust the styles to your business needs. To assign the CSS classes to a certain option, you should click on the "Setting"icon:
The modal window appears then:
You can add the CSS classes right to the "Div Class" field. You should add the names of the CSS classes. If you need to add more than 1 CSS class, just enter them separated by the space.
Qty Multiplier¶
This setting defines the number that will be deducted from the stock of the main product if specific option's value is chosen. The Qty multiplier will be multiplied by the product Qty, which is specified manually in the Qty field on the front-end. Leave "0" to disable this feature.
To specify a Qty multiplier for an option's value, you should click on the "Setting" icon for the necessary option's value:
The modal window will appear:
This feature perfectly suits if you sell your products by packs with a specific number of products in each pack.
Example
Let's assume you sell the pens and you need to add the option, which will allow your customers choose a pack with the pens they want to buy:
Option:
- 4 pens
- 8 pens
- 12 pens
If the customers choose the "8 pens" option, you need to deduct 8 items from the main product inventory to update the stock correctly. By default, Magento 2 doesn't allow this. However, with Qty Multiplier feature, you can achieve that. You should add the correct values to the "Qty Multiplier" fields for each option's value and the APO will update the main product stock with these values.
I.e. in our example, the main product stock will be deducted by 8 items.
The Qty Multiplier value is multiplied by the quantity of the main product, specified by the customers manually when adding the product to the cart.
The "Qty Multiplier" feature also checks the available quantity of the main product, when a product is added to the cart with such options. I.e. if the product has 100 items in stock and the option's Qty Multiplier is set to 150, the customers will see the error, when they try to add the product with such option to the cart.
Options by URL¶
The Advanced product options extension add the functionality for you and your customers to get shareable links for the final product configurations, i.e. with all selected options. Thus, you can launch the marketing campaigns (Adwords, emails etc) for the final product configurations.
This functionality can be enabled in the extension configuration: SYSTEM ⟶ Configuration ⟶ MageWorx ⟶ Advanced Product Options ⟶ Option Features:
- Enable Shareable Link - this setting enables/disables the functionality.
-
Shareable Link Title - this setting allows you to change the title of the link visible for your customers.
-
Shareable Link Description - this setting allows you to specify the text, which appears in the tooltip.
-
Shareable Link Success Message - this setting allows you to change the text, which appears when the link is copied to the clipboard.
Magento 1 links support
The APO M2 forms the URLs to the final configuration by adding the option and option's value IDs to the URLs. These URLs are fully compatible with the links, created in APO for Magento 1. Thus, you won't get 404 errors if you migrate from Magento 1.
Individual Product Options¶
You can also create and manage custom options for individual products. Our extension extends the existing product options as well. I.e. you do not need to re-create your existing options in order to use our features.
You can assign a certain product to the necessary option templates by selecting them in "MageWorx Option Templates" multi-select.
Hint
To choose several option templates just hold Cmd (on Mac) or Ctrl (on PC) and select the necessary templates.
Once you choose the option template and save the product, the options from the selected templates will be added to the current product.
Note
The options with all settings and configurations will be added from the chosen templates. Sorting orders are copied as well. Thus, you need to set the sort orders for template options taking into account the possible options on product level, in order to avoid the cases with duplicated sort orders for different options.
If you edit the template's options on the product level, the changes won't be added to the template itself. However, if you edit the options in the template, all the changes will be copied to the products, assigned to the template. Thus, if you change the template's options on a product level and then save the template, all the changes, made previously on the product level, will be overwritten with the template.
If you need to edit the template's options on a product level and change the template as well, it will be better to unassign the necessary template from the product. Please note that if you just unassign the products from the templates, all template's options will be removed from these products automatically. If you need to keep the template's options on a product after the template unassignment, you should use the "Keep Options on Unlink" toggle.
Note
Keep Options on Unlink toggle is used when it’s necessary to keep all the options of an assigned template after removing the connection between a product and this template. You should enable this toggle and unselect the necessary templates on a product level. Once the product is saved, the templates' options will be kept on the product, but without relation to the templates. Note that the "Keep Options on Unlink" toggle will be disabled after this again.
The Import Option allows to select some other product with the custom options and copy its options to the current product.
Hidden options¶
The extension allows you to create the options, which will be hidden on the front-end and unavailable for customer selection. Such options can be helpful if you need to have a separate option to build the correct dependency chains or to add some required surcharges.
To create the hidden option, you should create an option of the check-box type and activate the "Is Hidden" toggle. Once it's done, all option's values will be enabled as the default ones.
Note
Currently, the check-box options has the "Is Hidden" toggle.
Dynamic Options¶
The extension has the functionality to create the dynamic options to calculate the final price based on the values, entered by the customers on the front-end. This perferctly works if you need to give your customers the functionality to enter custom parameters (like widht, length, heigth) and calculate the price based on the price per 1 unit of measurement.
To enable this functionality go to STORES ⟶ Configuration ⟶ MAGEWORX ⟶ Dynamic Options and set the setting "Enable" to "Yes".
Once it's enabled, the new section "Mageworx Dynamic Options" will appear on the product edit view:
To create the dynamic options, you should add the options of the 'Text field' type in the 'Customizable options' section and save the product. All text options will appear in the 'Dynamic options' multi-select and you can select the options you need to be used to calculate the final price using the price per unit.
Note
Only options of the "Text field" type, added for the current product, will appear in the "Dynamic Options" multi-select.
For each selected option you can set the min & max allowed values, the step and the measurement unit.
Example
The step can help to restrict the entered values. I.e. if the step is set to 0.5, the customers won't be able to enter 0.4 or 0.6. Only values with the step 0.5 are allowed: 0.5, 1, 1.5 etc.
The 'measurement unit' defines the measurement unit of each option. This setting is not used in the calculations. It is just shown on the front-end near each option to inform your customers the measurement unit of the options.
The 'Price formula' displays how the final price is calculated, using the selected options.
The dynamic options on the front-end:
The min, max and step values are shown in the user-friendly tooltip.
The price for these options will be calculated as (width value) * (length value) * (price per unit). The calculated price will be added to the main product price then.
Note
This functionality can be added on the product level only.
Migration from Magento 1¶
Option templates migration¶
The extension supports the migration of the option templates from Magento 1 stores to Magento 2 sites.
Before importing the option templates to Magento 2 store, it is necessary to copy the folder with option images if it is applicable to your setup,
-
Go to the media/customoptions/ folder on your server and copy all the components.
-
Then, in Magento 2, paste the copied content to the pub/media/mageworx/customoptions/ folder.
Now, let’s step up to custom options templates migration.
In the admin panel of your Magento 1 store, go to Catalog ⟶ Advanced Custom Options ⟶ Templates. Here, select templates you’d like to migrate.
Then, choose ‘export’ and click submit. You’ve got a file containing data with your Magento 1 custom options templates.
Now, switch to your Magento 2 store import the option templates.
Before the migration you can define how to proceed with the missing images during the import process. This can be changed in STORES ⟶ Configuration ⟶ MAGEWORX ⟶ Advanced Product Options ⟶ Option Import Export.
If you do not use the images in the Magento 1 options, you can skip this setting.
You are offered to choose to either ignore the missing images, or not.
-
Yes - would mean you can import custom options templates even if the option images are missing on your Magento 2 server.
-
No - would mean the images should have been migrated and must not be ignored. In this case, you will see the following error if your CSV file contains the paths to the images, which are physically missing on Magento 2 server.
If you disable the setting "Option Import Export", but import the CSV file with the missing images, the paths to the missing images will be still added to Magento 2 system.log after successfull import for your review.
Now, go to SYSTEM ⟶ DATA TRANSFER ⟶ MageWorx Options Import/Export and upload the downloaded file in "Magento 1 Option Templates" row and press the ‘Validate & Import’ button.
The first step of the import process is the validation step, when the CSV file is being validated.
The second step is the step, when you need to link system-specific data and either ignore the settings or choose from the following options.
You can map the customer groups and the store views from your Magento 1 store to the values from your Magento 2 site.
If you keep the "Ignore" for specific rows, the options with these customer groups and the store views will be ignored during the import and won't be migrated to the Magento 2 store.
Once you defined the relations for Magento 1 and Magento 2 data, choose your CSV file and press the ‘Import Magento 1 option templates’ button again.
If the import process was successfull, you will see the confirmation message "The option templates have been imported."
If you import the option templates again, the option templates will be duplicated in your Magento 2 store. The duplicated templates will have the "-1" suffix.
Note
The option templates import does not migrate the relations between templates and products, i.e. you will have to select the products for each template again. If you need to migrate the relations, please check the Full APO Migration section.
Product options migration¶
The extension also allows you to migrate the product options without relations to the option templates. It can be useful if you do not use option templates in your Magento 1 store.
In the admin panel of your Magento 1 store, go to System ⟶ Import/Export ⟶ Export. Here, select the "Products" in the "Entity type" drop-down and CSV as the file format.
Click "Continue" button to download the exported file.
Now, go to your Magento 2 back-end: SYSTEM ⟶ DATA TRANSFER ⟶ MageWorx Options Import/Export and upload the downloaded file in " Magento 1 Product Options" section and press the ‘Validate & Import’ button.
Note
This option will migrate all custom options as product options to Magento 2, i.e. if you have added options to products directly and used the option templates on these products, all options will be migrated as product options and the relations to the templates will be lost. If you need to migrate the product options and templates' options with all relations, please check the Full APO Migration section.
At the next step, you should choose the migration mode and to map the customer groups and stores from Magento 1 products CSV file to the customer groups and stores in your Magento 2.
The mapping for customers groups and stores is described in the section above.
The migration mode allows you to choose how to proceed with the existing options in the store.
-
Keep existing customizable options and add options from the imported file - this mode will keep the existing options on the products in your Magento 2 store and will add the options from the file. I.e. if you have custom options on the products in your Magento 2 store and you will import a CSV file with options from Magento 1 for these products, the options from the CSV file will be added to the products, keeping the previiusly added options.
-
Remove customizable options only for the products, you are importing options for - this mode will remove all existing options for the products from the CSV file before importing the Magento 1 options, i.e. if you have the options on the products in your Magento 2, these options will be removed for the products found in the imported CSV file before adding new Magento 1 options.
-
Remove all customizable options in Magento 2 store - this mode will remove all existing options for all the products in Magento 2 before importing the options from the CSV file. This mode might be helpful if you need to remove all testing options in your store before importing the product options from Magento 1.
Once you choose the migration mode and map the customer groups and the stores, upload the CSV file to the appropriate field again and hit the "Validate & Import" button. This will import the product options to your Magento 2 store.
Full APO migration¶
The extension also allows you to do a complete migration of your options from Magento 1 to Magento 2 store. This process will copy all your products options, option templates (including the relations to the appropriate products), dependencies for all options, images and all other settings.
Note
We strongly recommend to backup your database before migrating the options.
The steps are as follows:
1) If there are images for the options in Magento 1 store, it is necessary to copy the folder with option images first:
-
Go to the media/customoptions/ folder on your server and copy all the components.
-
Then, in Magento 2, paste the copied content to the pub/media/mageworx/customoptions/ folder.
2) In the admin panel of your Magento 1 store, go to Catalog ⟶ Advanced Custom Options ⟶ Templates. Here, select templates you’d like to migrate. Then, choose ‘export’ and click submit. You’ve got a file containing data with your Magento 1 custom options templates.
3) In the admin panel of your Magento 1 store, go to System ⟶ Import/Export ⟶ Export. Here, select the "Products" in the "Entity type" drop-down and CSV as the file format. Click "Continue" button to download the exported file.
4) Now, go to your Magento 2 back-end: SYSTEM ⟶ DATA TRANSFER ⟶ MageWorx Options Import/Export and upload these two downloaded files in "Full APO migration" section and press the ‘Validate & Import’ button.
Note
In order to migrate all relations, dependencies and other features, it is important to upload the two files to proceed with the full APO migration.
5) At the next step, you should choose the migration mode and to map the customer groups and stores from Magento 1 products CSV file to the customer groups and stores in your Magento 2. The mapping feature is described in the Options templates migration section and the migration mode is described in the Product options migration section.
6) Once you choose the migration mode and map the customer groups and the stores, upload the CSV files to the appropriate field again and hit the "Validate & Import" button. This will import the product options & option templates to your Magento 2 store.
Import/Export Option Templates (M2 -> M2)¶
The extension allows you to export the option templates in your Magento 2 store and import them to another Magento 2 store. It might be helpful if you need to copy the option templates from your dev site to live store or to backup the templates in your live store.
1) To export the option templates go to your Magento 2 back-end: STORE ⟶ Option Templates and select templates you’d like to migrate. Then, choose ‘export’ in the mass-actions drop-down and click submit. You’ve got a JSON file containing data with your Magento 2 custom options templates.
Note
The export feature exports all templates data and the relations to the assigned products. The relations are stored using product SKUs.
2) If you need to import the option templates to another Magento 2 store and there are images for the options in your option templates, it is necessary to copy the folder with option images first:
-
Go to the media/customoptions/ folder on your server and copy all the components.
-
Then, in Magento 2, paste the copied content to the pub/media/mageworx/customoptions/ folder.
If you use the exported templates files as the backup and you import the templates to the same store, you can skip the copying images step.
3) Now, go to your Magento 2 back-end: SYSTEM ⟶ DATA TRANSFER ⟶ MageWorx Options Import/Export and upload the downloaded files in "Magento 2 Option Templates" row in the "Option templates import" section and press the ‘Validate & Import’ button.
4) At the next step, you should choose if you need to import the relations to the products and map the customer groups and stores from the JSON file to the customer groups and stores in your Magento 2. The mapping feature is described in the Options templates migration section.
If you choose "Yes" in this drop-down, the templates will be assigned to the products if they are found in the Magento 2 store you are importing to.
5) Once you map the customer groups and the stores, upload the JSON file to the appropriate field again and hit the "Validate & Import" button. This will import the option templates to your Magento 2 store.
Note
We recommend to edit the CSV file using the text editor programs and not using the MS Excel to avoid the errors with the wrong file format.
Import/Export Product Option (M2 -> M2)¶
The extension also allows you to export and import the CSV file with the products and the custom options. This functionality allows you to manage the product options in bulk (add / update / remove).
Note
Default Magento 2 also adds the native custom options to the products export/import flow. However, the custom options are added as the array in the CSV file and it is not possible to manage the options easily. Moreover, the features of our extension are not added to this default export/import process due to this reason. Our extension adds our own entity type to the export and import process to give you the opportunity to export and import the product's options in the readable format. The formats of the options and their values in the CSV file is quite similar to Magento 1 format, where all options and the values are added in the separate rows for better managemenet.
Export¶
To export the products with the options in readable way go to STORES ⟶ DATA TRANSFER ⟶ Export and select the Products + Advanced Product Options entity type. The further process is the same as the native Magento 2 export process. The exported file will have the name like 'catalog_product_with_apo_20200902_124146.csv', where the '20200902_124146' is the date and server time, when the file was generated.
Import¶
To import the products with the options in readable way go to STORES ⟶ DATA TRANSFER ⟶ Import and select the Products + Advanced Product Options entity type. The further settings for the import process are the same as for the native Magento 2 products import. You can also download the sample CSV file here:
Note 1
This import process imports the products as well. I.e. you can use this functionality to import the products and the options.
This import process imports the options with all our features, including the relations to the option templates. These relations are added via the column "custom_option_group_id" in the CSV file (the ID of the option template is added there).
If you need to import the product options with the relations to the option templates, see the steps below.
Let's assume you need to copy the product options and the option templates from the store A to the store B:
- export the option templates from the store A;
- export the product options from the store A;
- import the option templates first to the store B (more details about the option import templates can be found here);
- make sure the imported option templates on the store B and the templates, added in the exported products CSV file from the store A, have the same ID and title;
- import the 'products + options' CSV file to the store B.
Note 2
If the option templates in the 'products + options' CSV file do not match to the templates on the store (either by ID or by the template's title), such options won't be imported and the report will be added to the system.log file. This report will include the option template name and the list of SKUs so you will be able either to correct this in the CSV file or manually assign the templates to these products in the back-end.
Note 3
We recommend to edit the CSV file using the text editor programs and not using the MS Excel to avoid the errors with the wrong file format.
If you see the file size limit warning message, when trying to import the CSV file, and need to increase it - please check the solution here.
If you need to add new custom options using the CSV import, the best way to understand how the CSV file should be filled in is to add the example options in the back-end and export this product using our export feature. Thus, you will be able to add new options, following this example. If you need to upload the images to new options, you can upload all the images to the folder "/media/mageworx/optionfeatures/product/option/value/" and then add the names of the necessary images for each option's value in the column "custom_option_row_images_data" in the CSV file (following the example in the exported file).
Hyvä theme¶
The extension out of the box has the integrations with Hyvä theme:
Note
The free compatibility addon must be installed. See this link for more details.
REST API¶
Our APO module extends the standard Magento 2 requests using the "extension_attributes". The methods needs the admin authorization token.
Get product¶
Get info about product by product SKU.
The following attributes are added: "absolute_cost", "absolute_price", "absolute_weight", "hide_additional_product_price", "shareable_link", "sku_policy"
Request Format
GET V1/products/{sku}
Response JSON example
{
"id": 81,
"sku": "abs",
"name": "abs",
"attribute_set_id": 4,
"price": 123,
"status": 1,
"visibility": 4,
"type_id": "simple",
"created_at": "2021-11-30 18:20:13",
"updated_at": "2021-12-17 11:55:23",
"extension_attributes": {
"website_ids": [
1
],
"stock_item": {
"item_id": 111,
"product_id": 81,
"stock_id": 1,
"qty": 122,
"is_in_stock": true,
"is_qty_decimal": false,
"show_default_notification_message": false,
"use_config_min_qty": true,
"min_qty": 0,
"use_config_min_sale_qty": 1,
"min_sale_qty": 1,
"use_config_max_sale_qty": true,
"max_sale_qty": 10000,
"use_config_backorders": true,
"backorders": 0,
"use_config_notify_stock_qty": true,
"notify_stock_qty": 1,
"use_config_qty_increments": true,
"qty_increments": 0,
"use_config_enable_qty_inc": true,
"enable_qty_increments": false,
"use_config_manage_stock": true,
"manage_stock": true,
"low_stock_date": null,
"is_decimal_divided": false,
"stock_status_changed_auto": 0
},
"absolute_cost": false,
"absolute_price": false,
"absolute_weight": false,
"hide_additional_product_price": false,
"shareable_link": "use_config",
"sku_policy": "use_config"
},
"product_links": [],
"options": [
{
"product_sku": "abs",
"option_id": 1461,
"title": "test-new",
"type": "drop_down",
"sort_order": 1,
"is_require": true,
"max_characters": 0,
"image_size_x": 0,
"image_size_y": 0,
"values": [
{
"title": "1-new",
"sort_order": 1,
"price": 6664,
"price_type": "fixed",
"option_type_id": 7250
},
{
"title": "2",
"sort_order": 2,
"price": 0,
"price_type": "fixed",
"option_type_id": 7251
}
]
},
{
"product_sku": "abs",
"option_id": 1463,
"title": "test 3",
"type": "drop_down",
"sort_order": 3,
"is_require": true,
"max_characters": 0,
"image_size_x": 0,
"image_size_y": 0,
"values": [
{
"title": "3",
"sort_order": 1,
"price": 0,
"price_type": "fixed",
"option_type_id": 6693
},
{
"title": "4",
"sort_order": 2,
"price": 0,
"price_type": "fixed",
"option_type_id": 6694
}
]
}
],
"media_gallery_entries": [],
"tier_prices": [],
"custom_attributes": [
{
"attribute_code": "url_key",
"value": "abs"
},
{
"attribute_code": "price_per_unit",
"value": "0"
},
{
"attribute_code": "page_layout",
"value": "product-full-width"
},
{
"attribute_code": "gift_message_available",
"value": "2"
},
{
"attribute_code": "meta_title",
"value": "abs"
},
{
"attribute_code": "options_container",
"value": "container2"
},
{
"attribute_code": "meta_keyword",
"value": "abs"
},
{
"attribute_code": "meta_description",
"value": "abs "
},
{
"attribute_code": "tax_class_id",
"value": "0"
},
{
"attribute_code": "msrp_display_actual_price_type",
"value": "0"
},
{
"attribute_code": "category_ids",
"value": []
},
{
"attribute_code": "required_options",
"value": "1"
},
{
"attribute_code": "has_options",
"value": "1"
}
]
}
Create product¶
You can create a product with product attributes. The following attributes are added: "absolute_cost", "absolute_price", "absolute_weight", "hide_additional_product_price", "shareable_link", "sku_policy"
Request Format
POST /rest/V1/products
Payload
{
"product":
{
"id": 79,
"sku": "string",
"name": "string",
"attribute_set_id": 4,
"price": 11,
"status": 1,
"visibility": 4,
"type_id": "simple",
"created_at": "2021-11-21 19:16:08",
"updated_at": "2021-11-21 19:16:08",
"extension_attributes": {
"website_ids": [
1
],
"absolute_cost": true,
"absolute_price": true,
"absolute_weight": false,
"hide_additional_product_price": false,
"shareable_link": "use_config",
"sku_policy": "use_config"
},
"product_links": [],
"options": [],
"media_gallery_entries": [],
"tier_prices": [],
"custom_attributes": [
{
"attribute_code": "url_key",
"value": "string"
},
{
"attribute_code": "price_per_unit",
"value": "0"
},
{
"attribute_code": "page_layout",
"value": "product-full-width"
},
{
"attribute_code": "gift_message_available",
"value": "2"
},
{
"attribute_code": "meta_title",
"value": "string"
},
{
"attribute_code": "options_container",
"value": "container2"
},
{
"attribute_code": "meta_keyword",
"value": "string"
},
{
"attribute_code": "meta_description",
"value": "string "
},
{
"attribute_code": "tax_class_id",
"value": "0"
},
{
"attribute_code": "msrp_display_actual_price_type",
"value": "0"
},
{
"attribute_code": "category_ids",
"value": []
},
{
"attribute_code": "required_options",
"value": "0"
},
{
"attribute_code": "has_options",
"value": "0"
}
]
}
}
Response JSON example
{
"id": 79,
"sku": "string",
"name": "string",
"attribute_set_id": 4,
"price": 11,
"status": 1,
"visibility": 4,
"type_id": "simple",
"created_at": "2021-11-21 19:16:08",
"updated_at": "2021-12-23 21:11:57",
"extension_attributes": {
"website_ids": [
1
],
"stock_item": {
"item_id": 113,
"product_id": 79,
"stock_id": 1,
"qty": 1,
"is_in_stock": true,
"is_qty_decimal": false,
"show_default_notification_message": false,
"use_config_min_qty": true,
"min_qty": 0,
"use_config_min_sale_qty": 1,
"min_sale_qty": 1,
"use_config_max_sale_qty": true,
"max_sale_qty": 10000,
"use_config_backorders": true,
"backorders": 0,
"use_config_notify_stock_qty": true,
"notify_stock_qty": 1,
"use_config_qty_increments": true,
"qty_increments": 0,
"use_config_enable_qty_inc": true,
"enable_qty_increments": false,
"use_config_manage_stock": true,
"manage_stock": true,
"low_stock_date": null,
"is_decimal_divided": false,
"stock_status_changed_auto": 0
},
"absolute_cost": true,
"absolute_price": true,
"absolute_weight": false,
"hide_additional_product_price": false,
"shareable_link": "use_config",
"sku_policy": "use_config"
},
"product_links": [],
"options": [],
"media_gallery_entries": [],
"tier_prices": [],
"custom_attributes": [
{
"attribute_code": "image",
"value": "no_selection"
},
{
"attribute_code": "url_key",
"value": "string"
},
{
"attribute_code": "price_per_unit",
"value": "0"
},
{
"attribute_code": "page_layout",
"value": "product-full-width"
},
{
"attribute_code": "gift_message_available",
"value": "2"
},
{
"attribute_code": "small_image",
"value": "no_selection"
},
{
"attribute_code": "meta_title",
"value": "string"
},
{
"attribute_code": "options_container",
"value": "container2"
},
{
"attribute_code": "thumbnail",
"value": "no_selection"
},
{
"attribute_code": "meta_keyword",
"value": "string"
},
{
"attribute_code": "swatch_image",
"value": "no_selection"
},
{
"attribute_code": "meta_description",
"value": "string "
},
{
"attribute_code": "tax_class_id",
"value": "0"
},
{
"attribute_code": "msrp_display_actual_price_type",
"value": "0"
},
{
"attribute_code": "category_ids",
"value": []
},
{
"attribute_code": "required_options",
"value": "0"
},
{
"attribute_code": "has_options",
"value": "0"
}
]
}
Update product by sku¶
You can update a product by SKU.
The following attributes: "absolute_cost", "absolute_price", "absolute_weight", "hide_additional_product_price", "shareable_link", "sku_policy"
Request Format
PUT /V1/products/{sku}
Payload
{
"product":
{
"id": 79,
"sku": "string",
"name": "string",
"attribute_set_id": 4,
"price": 11,
"status": 1,
"visibility": 4,
"type_id": "simple",
"created_at": "2021-11-21 19:16:08",
"updated_at": "2021-11-21 19:16:08",
"extension_attributes": {
"website_ids": [
1
],
"absolute_cost": true,
"absolute_price": true,
"absolute_weight": true,
"hide_additional_product_price": false,
"shareable_link": "use_config",
"sku_policy": "use_config"
},
"product_links": [],
"options": [],
"media_gallery_entries": [],
"tier_prices": [],
"custom_attributes": [
{
"attribute_code": "url_key",
"value": "string"
},
{
"attribute_code": "price_per_unit",
"value": "0"
},
{
"attribute_code": "page_layout",
"value": "product-full-width"
},
{
"attribute_code": "gift_message_available",
"value": "2"
},
{
"attribute_code": "meta_title",
"value": "string"
},
{
"attribute_code": "options_container",
"value": "container2"
},
{
"attribute_code": "meta_keyword",
"value": "string"
},
{
"attribute_code": "meta_description",
"value": "string "
},
{
"attribute_code": "tax_class_id",
"value": "0"
},
{
"attribute_code": "msrp_display_actual_price_type",
"value": "0"
},
{
"attribute_code": "category_ids",
"value": []
},
{
"attribute_code": "required_options",
"value": "0"
},
{
"attribute_code": "has_options",
"value": "0"
}
]
}
}
Response JSON example
{
"id": 79,
"sku": "abs-2",
"name": "string",
"attribute_set_id": 4,
"price": 11,
"status": 1,
"visibility": 4,
"type_id": "simple",
"created_at": "2021-11-21 19:16:08",
"updated_at": "2021-12-23 21:25:20",
"extension_attributes": {
"website_ids": [
1
],
"stock_item": {
"item_id": 113,
"product_id": 79,
"stock_id": 1,
"qty": 1,
"is_in_stock": true,
"is_qty_decimal": false,
"show_default_notification_message": false,
"use_config_min_qty": true,
"min_qty": 0,
"use_config_min_sale_qty": 1,
"min_sale_qty": 1,
"use_config_max_sale_qty": true,
"max_sale_qty": 10000,
"use_config_backorders": true,
"backorders": 0,
"use_config_notify_stock_qty": true,
"notify_stock_qty": 1,
"use_config_qty_increments": true,
"qty_increments": 0,
"use_config_enable_qty_inc": true,
"enable_qty_increments": false,
"use_config_manage_stock": true,
"manage_stock": true,
"low_stock_date": null,
"is_decimal_divided": false,
"stock_status_changed_auto": 0
},
"absolute_cost": true,
"absolute_price": true,
"absolute_weight": true,
"hide_additional_product_price": false,
"shareable_link": "use_config",
"sku_policy": "use_config"
},
"product_links": [],
"options": [],
"media_gallery_entries": [],
"tier_prices": [],
"custom_attributes": [
{
"attribute_code": "image",
"value": "no_selection"
},
{
"attribute_code": "url_key",
"value": "string"
},
{
"attribute_code": "price_per_unit",
"value": "0"
},
{
"attribute_code": "page_layout",
"value": "product-full-width"
},
{
"attribute_code": "gift_message_available",
"value": "2"
},
{
"attribute_code": "small_image",
"value": "no_selection"
},
{
"attribute_code": "meta_title",
"value": "string"
},
{
"attribute_code": "options_container",
"value": "container2"
},
{
"attribute_code": "thumbnail",
"value": "no_selection"
},
{
"attribute_code": "meta_keyword",
"value": "string"
},
{
"attribute_code": "swatch_image",
"value": "no_selection"
},
{
"attribute_code": "meta_description",
"value": "string "
},
{
"attribute_code": "tax_class_id",
"value": "0"
},
{
"attribute_code": "msrp_display_actual_price_type",
"value": "0"
},
{
"attribute_code": "category_ids",
"value": []
},
{
"attribute_code": "required_options",
"value": "0"
},
{
"attribute_code": "has_options",
"value": "0"
}
]
}
Get list of custom options¶
You can get a list of custom options for a certain product.
The following attributes are added:
1) for options:
"mageworx_title", "qty_input", "one_time", "div_class", "mageworx_option_image_mode",
"selection_limit_from", "selection_limit_to", "is_hidden", "description",
"mageworx_option_gallery", "option_title_id", "dependency_type", "sku_policy",
"is_swatch", "is_all_groups", "is_all_websites", "disabled", "disabled_by_values"
2) for option values: "mageworx_title", "mageworx_option_type_price", "cost", "is_default", "load_linked_product" "qty_multiplier", "weight", "weight_type", "dependency_type", "option_type_title_id", "manage_stock", "qty", "disabled"
Request Format
GET /V1/products/{product_sku}/options
Response JSON example
[
{
"product_sku": "abs",
"option_id": 1461,
"title": "test-new",
"type": "drop_down",
"sort_order": 1,
"is_require": true,
"max_characters": 0,
"image_size_x": 0,
"image_size_y": 0,
"values": [
{
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"1-new\"},{\"store_id\":\"1\",\"title\":\"1-new\"}]",
"mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"6664.000000\"}]",
"cost": 45,
"is_default": false,
"load_linked_product": false,
"qty_multiplier": 0,
"weight": 22,
"weight_type": "fixed",
"dependency_type": "0",
"option_type_title_id": "",
"manage_stock": false,
"qty": 2,
"disabled": false
},
"title": "1-new",
"sort_order": 1,
"price": 6664,
"price_type": "fixed",
"option_type_id": 7250
},
{
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"2\"},{\"store_id\":\"1\",\"title\":\"2\"}]",
"mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"0.000000\"}]",
"cost": 0,
"is_default": false,
"load_linked_product": false,
"qty_multiplier": 0,
"weight": 0,
"weight_type": "",
"dependency_type": "0",
"option_type_title_id": "",
"manage_stock": true,
"qty": 123,
"disabled": false
},
"title": "2",
"sort_order": 2,
"price": 0,
"price_type": "fixed",
"option_type_id": 7251
}
],
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"test-new1\"},{\"store_id\":\"1\",\"title\":\"test-new\"}]",
"qty_input": true,
"one_time": true,
"div_class": "fff2",
"mageworx_option_image_mode": 0,
"selection_limit_from": 0,
"selection_limit_to": 0,
"is_hidden": false,
"description": "[{\"store_id\":\"0\",\"description\":\"<p>descritp</p>\"}]",
"mageworx_option_gallery": 0,
"option_title_id": "",
"dependency_type": "0",
"sku_policy": "use_config",
"is_swatch": 0,
"is_all_groups": true,
"is_all_websites": true,
"disabled": false,
"disabled_by_values": false
}
},
{
"product_sku": "abs",
"option_id": 1463,
"title": "test 3",
"type": "drop_down",
"sort_order": 3,
"is_require": true,
"max_characters": 0,
"image_size_x": 0,
"image_size_y": 0,
"values": [
{
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"3\"}]",
"mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"0.000000\"}]",
"cost": 0,
"is_default": false,
"load_linked_product": false,
"qty_multiplier": 0,
"weight": 0,
"weight_type": "",
"dependency_type": "0",
"option_type_title_id": "",
"manage_stock": false,
"qty": 0,
"disabled": false
},
"title": "3",
"sort_order": 1,
"price": 0,
"price_type": "fixed",
"option_type_id": 6693
},
{
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"4\"}]",
"mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"0.000000\"}]",
"cost": 0,
"is_default": false,
"load_linked_product": false,
"qty_multiplier": 0,
"weight": 0,
"weight_type": "",
"dependency_type": "0",
"option_type_title_id": "",
"manage_stock": false,
"qty": 0,
"disabled": false
},
"title": "4",
"sort_order": 2,
"price": 0,
"price_type": "fixed",
"option_type_id": 6694
}
],
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"test 3\"}]",
"qty_input": false,
"one_time": false,
"div_class": "",
"mageworx_option_image_mode": 0,
"selection_limit_from": 0,
"selection_limit_to": 0,
"is_hidden": false,
"mageworx_option_gallery": 0,
"option_title_id": "",
"dependency_type": "0",
"sku_policy": "use_config",
"is_swatch": 0,
"is_all_groups": true,
"is_all_websites": true,
"disabled": false,
"disabled_by_values": false
}
}
]
Get custom option for a certain product¶
You can get a custom option for a specific product by option ID
The following attributes are added:
1) for options:
"mageworx_title", "qty_input", "one_time", "div_class", "mageworx_option_image_mode",
"selection_limit_from", "selection_limit_to", "is_hidden", "description",
"mageworx_option_gallery", "option_title_id", "dependency_type", "sku_policy",
"is_swatch", "is_all_groups", "is_all_websites", "disabled", "disabled_by_values"
2) for option values:
"mageworx_title", "mageworx_option_type_price", "cost", "is_default", "load_linked_product"
"qty_multiplier", "weight", "weight_type", "dependency_type", "option_type_title_id",
"manage_stock", "qty", "disabled"
Request Format
GET /V1/products/{sku}/options/{optionId}
Response JSON example
{
"product_sku": "abs",
"option_id": 1461,
"title": "test-new",
"type": "drop_down",
"sort_order": 1,
"is_require": true,
"max_characters": 0,
"image_size_x": 0,
"image_size_y": 0,
"values": [
{
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"1-new\"},{\"store_id\":\"1\",\"title\":\"1-new\"}]",
"mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"6664.000000\"}]",
"cost": 33,
"is_default": false,
"load_linked_product": false,
"qty_multiplier": 0,
"weight": 125,
"weight_type": "fixed",
"dependency_type": "0",
"option_type_title_id": "",
"manage_stock": false,
"qty": 2,
"disabled": false
},
"title": "1-new",
"sort_order": 1,
"price": 6664,
"price_type": "fixed",
"option_type_id": 6887
},
{
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"2\"},{\"store_id\":\"1\",\"title\":\"2\"}]",
"mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"0.000000\"}]",
"cost": 0,
"is_default": false,
"load_linked_product": false,
"qty_multiplier": 0,
"weight": 0,
"weight_type": "",
"dependency_type": "0",
"option_type_title_id": "",
"manage_stock": true,
"qty": 123,
"disabled": false
},
"title": "2",
"sort_order": 2,
"price": 0,
"price_type": "fixed",
"option_type_id": 6888
}
],
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"test-new1\"},{\"store_id\":\"1\",\"title\":\"test-new\"}]",
"qty_input": true,
"one_time": true,
"div_class": "fff2",
"mageworx_option_image_mode": 0,
"selection_limit_from": 0,
"selection_limit_to": 0,
"is_hidden": false,
"description": "[{\"store_id\":\"0\",\"description\":\"<p>descritp</p>\"}]",
"mageworx_option_gallery": 0,
"option_title_id": "",
"dependency_type": "0",
"sku_policy": "use_config",
"is_swatch": 0,
"is_all_groups": true,
"is_all_websites": true,
"disabled": false,
"disabled_by_values": false
}
}
Add Custom Option¶
You can add/create product custom options using this request.
The following attributes were added:
1) for options:
"mageworx_title", "qty_input", "one_time", "div_class", "mageworx_option_image_mode",
"selection_limit_from", "selection_limit_to", "is_hidden", "description",
"mageworx_option_gallery", "option_title_id", "dependency_type", "sku_policy",
"is_swatch", "is_all_groups", "is_all_websites", "disabled", "disabled_by_values"
2) for option values:
"mageworx_title", "mageworx_option_type_price", "cost", "is_default", "load_linked_product"
"qty_multiplier", "weight", "weight_type", "dependency_type", "option_type_title_id",
"manage_stock", "qty", "disabled"
Request Format
POST /V1/products/options
Payload
```
{
"option":
{
"product_sku": "abs",
"title": "test-new2",
"type": "drop_down",
"sort_order": 1,
"is_require": true,
"max_characters": 0,
"image_size_x": 0,
"image_size_y": 0,
"values": [
{
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"1-new\"},{\"store_id\":\"1\",\"title\":\"1-new2\"}]",
"mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"6664.000000\"}]",
"special_price": "[{\"price\":\"122.0000\",\"customer_group_id\":\"32000\",\"price_type\":\"fixed\",\"date_from\":\"\",\"date_to\":\"\",\"comment\":\"\"}]",
"tier_price": "[{\"price\":\"55.0000\",\"customer_group_id\":\"32000\",\"price_type\":\"fixed\",\"date_from\":\"\",\"date_to\":\"\",\"qty\":\"132\"}]",
"cost": 11,
"description": "[{\"store_id\":\"0\",\"description\":\"<p>descr-NEW4</p>\"}]",
"is_default": true,
"load_linked_product": false,
"qty_multiplier": 55,
"weight": 4,
"weight_type": "fixed",
"dependency_type": "0",
"option_type_title_id": "",
"manage_stock": false,
"qty": 0,
"disabled": false
},
"title": "1-new2",
"sort_order": 1,
"price": 6664,
"price_type": "fixed"
}
],
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"test-new\"},{\"store_id\":\"1\",\"title\":\"test-new\"}]",
"qty_input": true,
"one_time": true,
"div_class": "fff2",
"mageworx_option_image_mode": 0,
"selection_limit_from": 0,
"selection_limit_to": 0,
"is_hidden": false,
"description": "[{\"store_id\":\"0\",\"description\":\"<p>eeeee-optionNEW</p>\"}]",
"mageworx_option_gallery": 0,
"option_title_id": "",
"dependency_type": "0",
"sku_policy": "use_config",
"is_swatch": 0,
"is_all_groups": true,
"is_all_websites": true,
"disabled": false,
"disabled_by_values": false
}
}
}
```
Response JSON example
{
"product_sku": "abs",
"option_id": 1688,
"title": "test-new2",
"type": "drop_down",
"sort_order": 1,
"is_require": true,
"max_characters": 0,
"image_size_x": 0,
"image_size_y": 0,
"values": [
{
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"1-new\"},{\"store_id\":\"1\",\"title\":\"1-new2\"}]",
"mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"6664.000000\"}]",
"special_price": "[{\"price\":\"122.0000\",\"customer_group_id\":\"32000\",\"price_type\":\"fixed\",\"date_from\":\"\",\"date_to\":\"\",\"comment\":\"\"}]",
"tier_price": "[{\"price\":\"55.0000\",\"customer_group_id\":\"32000\",\"price_type\":\"fixed\",\"date_from\":\"\",\"date_to\":\"\",\"qty\":\"132\"}]",
"cost": 11,
"description": "[{\"store_id\":\"0\",\"description\":\"<p>descr-NEW4</p>\"}]",
"is_default": true,
"load_linked_product": false,
"qty_multiplier": 55,
"weight": 4,
"weight_type": "fixed",
"dependency_type": "0",
"option_type_title_id": "",
"manage_stock": false,
"qty": 0,
"disabled": false
},
"title": "1-new2",
"sort_order": 1,
"price": 6664,
"price_type": "fixed"
}
],
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"test-new\"},{\"store_id\":\"1\",\"title\":\"test-new\"}]",
"qty_input": true,
"one_time": true,
"div_class": "fff2",
"mageworx_option_image_mode": 0,
"selection_limit_from": 0,
"selection_limit_to": 0,
"is_hidden": false,
"description": "[{\"store_id\":\"0\",\"description\":\"<p>eeeee-optionNEW</p>\"}]",
"mageworx_option_gallery": 0,
"option_title_id": "",
"dependency_type": "0",
"sku_policy": "use_config",
"is_swatch": 0,
"is_all_groups": true,
"is_all_websites": true,
"disabled": false,
"disabled_by_values": false
}
}
Update Custom Option¶
You can update product custom option using this request.
The following attributes were added:
1) for options:
"mageworx_title", "qty_input", "one_time", "div_class", "mageworx_option_image_mode",
"selection_limit_from", "selection_limit_to", "is_hidden", "description",
"mageworx_option_gallery", "option_title_id", "dependency_type", "sku_policy",
"is_swatch", "is_all_groups", "is_all_websites", "disabled", "disabled_by_values"
2) for option values:
"mageworx_title", "mageworx_option_type_price", "cost", "is_default", "load_linked_product"
"qty_multiplier", "weight", "weight_type", "dependency_type", "option_type_title_id",
"manage_stock", "qty", "disabled"
Request Format
PUT /V1/products/options/{optionId}
Payload
```
{
"option":
{
"product_sku": "abs",
"title": "test 3",
"type": "drop_down",
"sort_order": 3,
"is_require": true,
"max_characters": 0,
"image_size_x": 0,
"image_size_y": 0,
"values": [
{
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"3\"}]",
"mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"0.000000\"}]",
"description": "[{\"store_id\":\"0\",\"description\":\"<p>description value 123</p>\"}]",
"cost": 0,
"is_default": false,
"load_linked_product": false,
"qty_multiplier": 0,
"weight": 0,
"weight_type": "",
"dependency_type": "0",
"option_type_title_id": "",
"manage_stock": false,
"qty": 0,
"disabled": false
},
"title": "3",
"sort_order": 1,
"price": 0,
"price_type": "fixed",
"option_type_id": 7508
},
{
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"4\"}]",
"mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"0.000000\"}]",
"cost": 0,
"is_default": false,
"load_linked_product": false,
"qty_multiplier": 0,
"weight": 0,
"weight_type": "",
"dependency_type": "0",
"option_type_title_id": "",
"manage_stock": false,
"qty": 0,
"disabled": false
},
"title": "4",
"sort_order": 2,
"price": 0,
"price_type": "fixed"
}
],
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"test 3\"}]",
"qty_input": false,
"one_time": false,
"div_class": "",
"mageworx_option_image_mode": 0,
"selection_limit_from": 0,
"selection_limit_to": 0,
"is_hidden": false,
"mageworx_option_gallery": 0,
"option_title_id": "",
"dependency_type": "0",
"sku_policy": "use_config",
"is_swatch": 0,
"is_all_groups": true,
"is_all_websites": true,
"disabled": false,
"disabled_by_values": false
}
}
}
```
Response JSON example
{
"product_sku": "abs",
"option_id": 1687,
"title": "test 3",
"type": "drop_down",
"sort_order": 3,
"is_require": true,
"max_characters": 0,
"image_size_x": 0,
"image_size_y": 0,
"values": [
{
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"3\"}]",
"mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"0.000000\"}]",
"cost": 0,
"description": "[{\"store_id\":\"0\",\"description\":\"<p>description value 123</p>\"}]",
"is_default": false,
"load_linked_product": false,
"qty_multiplier": 0,
"weight": 0,
"weight_type": "",
"dependency_type": "0",
"option_type_title_id": "",
"manage_stock": false,
"qty": 0,
"disabled": false
},
"title": "3",
"sort_order": 1,
"price": 0,
"price_type": "fixed",
"option_type_id": 7508
},
{
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"4\"}]",
"mageworx_option_type_price": "[{\"store_id\":\"0\",\"price_type\":\"fixed\",\"price\":\"0.000000\"}]",
"cost": 0,
"is_default": false,
"load_linked_product": false,
"qty_multiplier": 0,
"weight": 0,
"weight_type": "",
"dependency_type": "0",
"option_type_title_id": "",
"manage_stock": false,
"qty": 0,
"disabled": false
},
"title": "4",
"sort_order": 2,
"price": 0,
"price_type": "fixed"
}
],
"extension_attributes": {
"mageworx_title": "[{\"store_id\":\"0\",\"title\":\"test 3\"}]",
"qty_input": false,
"one_time": false,
"div_class": "",
"mageworx_option_image_mode": 0,
"selection_limit_from": 0,
"selection_limit_to": 0,
"is_hidden": false,
"mageworx_option_gallery": 0,
"option_title_id": "",
"dependency_type": "0",
"sku_policy": "use_config",
"is_swatch": 0,
"is_all_groups": true,
"is_all_websites": true,
"disabled": false,
"disabled_by_values": false
}
}
GraphQL API (PWA) support¶
The extension supports the GraphQL API to retrieve all our features on the PWA store fronts.
Note
The Mageworx APO-GraphQL FREE add-on should be installed to enable this functionality. You can install it from our Github.
Our extension extends the standard products GraphQL request to add all our fields. You can remove the unnecessay fields manually if they are not applicable to your configuration.
We developed the separate GraphQL request to calculate the dependency and the default state. It returns the values that should be hidden and/or selected as the default, when the customers select certain options.
- Dependency state request:
json
{
dependencyState (
productSku: "24-MB01"
selectedValues: "2419,2420"
) {
hidden_options
hidden_values
preselected_values
}
}
- Dependency state response:
json
{
"data": {
"dependencyState": {
"hidden_options": [],
"hidden_values": [
2420
],
"preselected_values": "{\"73\":[2419]}"
}
}
}
- Dependency state errors response. This is the error example, that can occur if certain values in the 'Dependency state' request are added as selected, but they should be hidden. I.e. this error occurs if the selected values in the 'Dependency state' request are incorrect.
json
{
"errors": [
{
"message": "Selected value '2420' is wrong and should be hidden",
"extensions": {
"category": "graphql-input"
},
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"dependencyState"
]
}
],
"data": {
"dependencyState": null
}
}
Note
The 'Dependency state' request should be used if you use the dependent options. You should send the 'Dependency state' request each time the customer selects an option's value on the front-end to get the list of values that should be hidden or pre-selected. You should keep all selected values in this request. I.e. you should add the new selected value, keeping the previous values in this request so the extension will be able to calculate the dependency correctly.
The 'DependencyState' response contains the objects, which include the following keys:
- hidden_options - the array with option IDs, which should be hidden.
- hidden_values - the array with values IDs, which should be hidden.
- preselected_values - the JSON row, which contains the array with the structure "key - array with valules", where the "key" is the option ID, the "array with valules" - values IDs.
The "preselected_values" duplicates the values, sent in the request, and adds the values, which should be shown and might be pre-selected.
If you do not want to use this approach to calculate the dependencies and the default state for some reasons, we added the 'dependency_rules' fields to the Products request and response (see the Products request and response above for more details).
Otherwise, we recommend to remove the 'dependency_rules' fields from the Products request to improve the performance.
The 'dependency_rules' is the JSON row with the array of the rules. Every rule is the arraw with the following structure:
-
conditions - it is the array with the conditions. The possible keys inside each condition: {"values":["2418"],"type":"!eq","id":73}, where
--- "id" - the option ID,
--- "values" - the IDs of the values,
--- "type" - possible values "eq" и "!eq", which means "equal", "not equal".
The condition in this example will be valid if the value with ID "2418" of the option "73" is not selected. -
condition_type - it is the logic operator, which is used to combine the conditions. Possible values: "OR", "AND".
-
actions - it is the action that should be performed if the conditions are met. Example: {"hide":{"74":{"values":{"2420":2420},"id":74}}}. The current available action is the "hide" only. This example hides the value with ID "2420" of the option "74".
Note
The values exist for "selectable" options only. For the option types like "field", the "values" will be empty.
The "hidden_dependents" row has the same structure as the "DependencyState" (described above).
Health data checker & cleaner¶
This sub-extension called MageWorx_OptionHealthChecker was designed for analysis and clearing the tables of Advanced Product Options extension from the garbage data that could remain in the database due to some third-party factors.
At the first installation, the extension will clean the data from the APO tables that are not relevant anymore and not used anywhere. Also, there are 2 commands that can be run in CLI:
- analyzes APO tables and displays information about unnecessary (junk) data, if any
mageworx:apo:analyze-data
- clears the APO tables from unnecessary (junk) data, if any
mageworx:apo:clean-data
For developers¶
In order to help you to better understand how easily to customize and extend our extension, we prepared some technical articles with the customization examples.
How to add custom fields to custom options¶
Sometimes you need to add custom fields (like GTIN etc) to the custom options. We prepared the step-by-step guide how you can easily customize the extension and add any custom fields you need and display them in the order view.
Check this article for more details.
How to add custom fields to product options templates¶
This article descriibes how to add custom fields (like GTIN etc) to the custom options in the templates.
Check this article for more details.
How to remove + sign from customizable option titles programmatically¶
Sometimes you need to remove the "+" sign, which is added before the option's price on the front-end. See the example below:
We prepared the guide for you how to do this.
Check this article for more details.
What Magento 2 tables does the APO modify?¶
The APO module makes some changes in the following Magento 2 tables:
catalog_product_option
catalog_product_option_type_value
core_config_data
setup_module
FAQ¶
What are the difference between Magento 2 native customizable options and Advanced product options?¶
In to better understnad all the differences, we prepared the comparison article. See all the differences here
How to update the extension?¶
The Advanced Product Options extension has a specific way to update if the customer uses the installation by copying the code method.
To update the extension, the user needs to go to /app/code/Mageworx/ and manually delete the folders:
- AdvancedProductOptions
- OptionAdvancedPricing
- OptionBase
- OptionDependency
- OptionInventory
- OptionFeatures
- OptionTemplates
- OptionLink
- OptionSwatches
- OptionSkuPolicy
- OptionImportExport
- OptionVisibility
- Info
When done, please follow the default steps. For the composer installation, the procedure is the default as well.
What is the images size and format to upload?¶
We do not provide the exact rules for the images but we highly recommend using the .png or .jpg images. The maximum dimensions should be no more than 800x800 px to lessen the size of the webpage. Please note that our extension doesn’t support most of the photo zoom extension tool.
Product options SKU policy is taking the prices of the individual SKUs, how to change this?¶
Once the products are linked, currently it is not possible to change the price to some other one. We will implement this feature a bit later. If you suppose that the price will be different from the appropriate simple product taken for the SKU linking, we recommend you to unselect this setting in STORES ⟶ Configuration ⟶ MAGEWORX ⟶ Advanced Product Options ⟶ Option Link:
How to make the option hidden on the frontend when it is out of stock?¶
If the product has the Manage Stock toggle enabled and the quantity populated, the product option may become fully sold (out of stock). To manage such product options go to STORES ⟶ Configuration ⟶ MAGEWORX ⟶ Option Inventory.
The Out-Of-Stock configuration regulates the display of such options. If the setting is set up to Disable, the option will be visible on the frontend but not clickable. In case it is Hidden, it won't show at all.
On the left screenshot, the frontend view with the option enabled, on the right the option is disabled.
How does the Keep Options on Unlink option really work?¶
When you modify some products' custom options you may see the Keep Options on Unlink setting. in the Customizable Options tab (to see it, open CATALOG ⟶ Products and select the desired one).
If you assign a template to a product and then change or remove some options of the template directly on the product page, all your changes will be reverted to the original values in the next template update. You should unassign the template using the Keep Options on Unlink in this case.
Note
You should enable this toggle and unselect the necessary templates on a product level. Once the product is saved, the templates' options will be kept on the product, but without relation to the templates.
The steps are as follows:
1) Open a product for editing;
2) Unselect the templates you want to unassign from the current product;
3) Enable the "Keep options on unlink toggle";
4) Save the product.
Note
Note that the "Keep Options on Unlink" the toggle will be disabled after saving the product. You should choose it each time you want to unassign the options from the templates and keep the options on the product.
Thus, the options of the unselected templates will be unassigned from these templates and the options will be kept on the products without the relations to the templates.
You don't have the required triggers error¶
This issue happens sporadically after the installation of the extension. In most cases, this happens due to the migration errors. To fix this problem, please follow these steps:
1) Connect to the database and find the table setup_module. This table stores the list of all the modules installed on the website and their appropriate versions.
2) Find all the APO-related records. They start with MageWorx_Option...
. Currently, the full list is:
- AdvancedProductOptions
- OptionAdvancedPricing
- OptionBase
- OptionDependency
- OptionInventory
- OptionFeatures
- OptionTemplates
- OptionLink
- OptionSwatches
- OptionSkuPolicy
- OptionImportExport
- OptionVisibility
Delete all these records. All the data will stay intact, so you have nothing to worry about.
3) Reinstall the extension using the default procedure.
Saving product or template redirects to Magento 2 dashboard¶
It might happen that when you try to save a product or a template you are redirected to the home page in the Admin Panel and the changes for the added options are not saved. Infrequently, the ‘Something went wrong’ error will get displayed.
To solve the issue, you need to follow these steps:
- Check the php configurations. Specifically, they should be the php.ini configurations for your hosting.
-
Find two parameters and change them to the following values:
--- “max_input_vars” up to 50000
--- “memory_limit” up to 2GB -
Make sure that the changes have been applied. (You might need to restart the server).
If this doesn’t help, please contact our support team and we will be happy to help.
How to increase the size of the uploaded file when importing product options or templates?¶
By default, there is size limit for the files imported in your store. This limit affects the files you import in our extension as well. The size limit is shown in the message "Make sure your file isn't more than … M."
To increase this limit, you need to edit the “upload_max_filesize” parameter in your php.ini file.
How to calculate product price based on custom dimensions in Magento 2¶
The Mageworx Advanced Product Options extension offers such functionality and allows calculating the final price based on the sizes specified by the customers. We prepared the detailed explanation here.
How to track the stock of the common option in multiple products¶
Often you have several simple products in Magento 2 that have a common custom option with the same SKU, and you want to keep track of the inventory properly.
Example
- Product A with option SKU COMMON
- Product B with option SKU COMMON
This option has the common stock for both products.
Our module allows you to achieve that using the Options Link and Options Inventory features.
- you can create a new simple product with stock value equal to the common stock of this options. You can set the Visibility to "Not visible individually" in order to hide this product on the front-end.
- you can link these options to this product using our Link feature and sync the stock, i.e. these options will use the stock of this product.
After that all these options will have the same stock value, which will be correctly updated with every new order with all products with selected option.
How to change number of values shown per 1 page in the back-end¶
Sometimes you need to change the number of option's values, shown per 1 page for the option in the back-end. For this you should do the following:
- open the following file - app/code/MageWorx/OptionBase/view/adminhtml/web/js/dynamic-rows-22x.js
- Find the line number 162 ("pageSize: 20") and change this parameter to the number you need.
- After that, you need to re-deploy the full static-content (please remove the old static content first).
How to fill in the dependency columns in the products+options CSV file¶
Here you will find some more details regarding how to add the dependency for the option's values in the CSV file.
The column "custom_option_row_dependency" contains the IDs of options and values, that should be dependent from a certain value (row in CSV file). This column has the following format:
option_id, option_type_id | option_id, option_type_id | .....
The column "custom_option_row_dependency_type" should be filled with 0 or 1. It determines the type of the dependency: - 0 - OR - 1 - AND
The column "custom_option_dependency_type" on the option level should be filled with 0.
The "custom_option_dependency" can be left empty.
The "option_id", "option_type_id" can be retrieved from catalog_product_option and catalog_product_option_value.
Got Questions?¶
Need help with the extensions? Feel free submit a ticket from https://www.mageworx.com/support/
Mageworx offers outstanding services developing custom-tailored solutions for Magento platform to attain your eCommerce objectives. Our professional impassioned team provides profound and custom oriented development of your project in a short timeframe.