ProductRules
Returns rules that modify the properties of a product, such as weight, price, and product image.
Table-Specific Information
Select
The component uses the BigCommerce API to process WHERE clause conditions built with the following columns and operators:
- Id supports the = operator.
- ProductId supports the = operator.
The rest of the filter is executed client-side within the component.
For example, the following queries are processed server-side:
SELECT * FROM ProductRules WHERE Id = 1
SELECT * FROM ProductRules WHERE ProductId = 2
Insert
To insert a product rule, specify at least the following columns: ProductId and Conditions.
INSERT INTO ProductRules (ProductId, SortOrder, IsEnabled, IsStop, PriceAdjusterName, PriceAdjusterValue, WeightAdjusterName, WeightAdjusterValue, IsPurchasingDisabled, PurchasingDisabledMessage, IsPurchasingHidden, ImageUrl, Conditions) VALUES (81, 3, True, True, 'percentage', '60.01', 'relative', '50.02', True, 'for testing reasons', True, 'https://nymag.com/strategist/article/best-photo-scanners.html', '[{"modifier_id": 189, "modifier_value_id": 550}]')
Update
The following is an example of how to update the ProductRules table:
UPDATE ProductRules SET SortOrder = 5, IsEnabled = False WHERE ProductId = 81 AND Id = 1
Delete
The following is an example of how to delete from the ProductRules table:
DELETE FROM ProductRules WHERE ProductId = 81 AND Id = 1
Columns
| Name | Type | ReadOnly | Description |
| Id [KEY] | Integer | True |
The Id of the rule. |
| ProductId [KEY] | Integer | False |
The Id of the product to which the rule belongs. |
| SortOrder | Integer | False |
The order in which the rule is displayed on the product page. |
| IsEnabled | Boolean | False |
Indicates whether the rule is evaluated when a customer configures a product's options. |
| IsStop | Boolean | False |
Indicates whether processing stops after this rule evaluates to true, preventing rules with a higher sort order from being applied. |
| PriceAdjusterName | String | False |
The name of the price adjuster applied by this rule. |
| PriceAdjusterValue | Decimal | False |
The value of the price adjuster applied by this rule. |
| WeightAdjusterName | String | False |
The name of the weight adjuster applied by this rule. |
| WeightAdjusterValue | Decimal | False |
The value of the weight adjuster applied by this rule. |
| IsPurchasingDisabled | Boolean | False |
Indicates whether purchasing the product with the configured option values is prohibited by this rule. |
| PurchasingDisabledMessage | String | False |
The message displayed when the rule disables purchasing of the product. |
| IsPurchasingHidden | Boolean | False |
Indicates whether the product options are hidden by this rule. |
| ImageUrl | String | False |
The path to an image already uploaded via FTP in the import directory. The path must be relative to the import directory. |
| Conditions | String | False |
The conditions associated with product complex rules. |