Catalog price rules
Discounts on every product a condition picks — a filter over the products’ categories, set and attribute values, written as their List takes it — for some customer groups and views, over a period: a percentage or an amount off, applied by priority. The products a rule is on say so in their price_rule_ids.
List catalog price rules
Lists the website's catalog price rules in the order they apply: the highest priority first, then the oldest. filter takes is_active, customer_group_ids:"<id>" — the rules for one customer group — view_ids:"<id>" and create_time; order_by takes priority, display_name and create_time.
path Parameters
website_idId of the parent website.
query Parameters
page_sizeRows per page. Over the maximum is clamped, not rejected.
page_tokenOpaque token from a previous next_page_token. A token minted under a different order_by/filter is rejected.
skipRows to skip before the page (AIP-158). skip + page_size is capped at 10000; beyond that is OUT_OF_RANGE.
order_byComma-separated field [asc|desc], at most 3 keys. Default: priority desc, create_time asc. Sortable: create_time, display_name, priority.
filterAIP-160 subset (§8). Filterable: create_time, customer_group_ids, is_active, view_ids. A field outside the list is INVALID_ARGUMENT.
List catalog price rules › Responses
One page of catalog_price_rules.
This page of catalog_price_rules, in the requested order.
next_page_tokenOpaque. Absent or empty means this was the last page.
total_sizeRows in the whole filtered collection, not in this page.
Create catalog price rule
Adds a catalog price rule. display_name and action are required; condition is a filter over the products as GET …/catalog_products?filter= takes it, of category_ids, attribute_set_id and attributes.<key> — another field, an attribute the website does not have or a mistake of the grammar is INVALID_ARGUMENT on condition with the reason and its offset. action takes exactly one of percent_off and amount, as its type says. Every id of customer_group_ids and view_ids must be a customer group or a view of the website. A website that already has 50 rules answers FAILED_PRECONDITION, and an active rule whose groups would make more than 20 customer groups priced apart FAILED_PRECONDITION PRICED_GROUPS_LIMIT. The products the condition picks get the rule in their price_rule_ids within seconds.
path Parameters
website_idId of the parent website.
Create catalog price rule › Request Body
display_nameThe rule's name, for the admin — «Sale −10 %», «Trade discount». Not blank, at most 255 characters.
actionWhat the rule takes off: {"type": "PERCENT_OFF", "percent_off": "10"} — a percentage, above 0 and at most 100 with at most two decimals, as a decimal string — or {"type": "AMOUNT_OFF", "amount": {…}} — a google.type.Money above zero in the website's base currency, converted at the rate of the currency a price is in. Exactly the one its type takes. Replaced whole when sent. A price never goes below zero.
priorityThe order the rules of a product apply in: the higher first, then the older, each to what the one before left. 0 when omitted; negative numbers are fine.
is_activeWhether the rule applies at all. Switched off, it takes nothing off any price. true when omitted.
starts_atWhen the rule starts to apply. Absent — from now on. null under update_mask clears it.
ends_atWhen the rule stops applying: after starts_at. Absent — for good. null under update_mask clears it.
customer_group_idsThe ids of the website's customer groups the rule is for, each once. Empty — the default — means every visitor, guests included. A group an active rule names is priced apart, as by a price list: a website has at most 20 such groups, and a write past that answers FAILED_PRECONDITION PRICED_GROUPS_LIMIT. Deleting a group takes it out of every rule, and a rule it was the last group of is switched off rather than opened to everyone.
view_idsThe ids of the website's views the rule applies on, each once, at most 100. Empty — the default — means every view.
conditionWhich products the rule is for: a filter over a product, written as GET …/catalog_products?filter= takes it — category_ids:"<id>" (or =), attribute_set_id (=, !=) and attributes.<key> of the website's attributes, joined by AND, OR, NOT and parentheses — so that list, sent the condition, shows the products the rule is on. At most 2000 characters. Empty — the default — is no product, never every one. Another field, an attribute the website does not have or a mistake of the grammar is INVALID_ARGUMENT on condition, with the reason and its offset.
stop_further_rulesWhether the rules after this one in priority stop applying to a price this one applied to. false when omitted.
Create catalog price rule › Responses
The created resource.
nameThe resource name (§5) — the identity of this resource, and the path that addresses it: websites/{website}/cms_pages/{cms_page}. It is the handle to store, not a human label.
idThe last segment of name on its own, for a client that needs to build a child URL. Unique inside its parent, never across the platform.
create_timeWhen the resource was created (RFC 3339, UTC).
update_timeWhen the resource last changed (RFC 3339, UTC).
etagVersion of the persisted state. Send it back in If-Match on Update or Delete and the write is rejected with ABORTED if anyone else changed the resource meanwhile (§14).
display_nameThe rule's name, for the admin — «Sale −10 %», «Trade discount». Not blank, at most 255 characters.
priorityThe order the rules of a product apply in: the higher first, then the older, each to what the one before left. 0 when omitted; negative numbers are fine.
is_activeWhether the rule applies at all. Switched off, it takes nothing off any price. true when omitted.
starts_atWhen the rule starts to apply. Absent — from now on. null under update_mask clears it.
ends_atWhen the rule stops applying: after starts_at. Absent — for good. null under update_mask clears it.
customer_group_idsThe ids of the website's customer groups the rule is for, each once. Empty — the default — means every visitor, guests included. A group an active rule names is priced apart, as by a price list: a website has at most 20 such groups, and a write past that answers FAILED_PRECONDITION PRICED_GROUPS_LIMIT. Deleting a group takes it out of every rule, and a rule it was the last group of is switched off rather than opened to everyone.
view_idsThe ids of the website's views the rule applies on, each once, at most 100. Empty — the default — means every view.
conditionWhich products the rule is for: a filter over a product, written as GET …/catalog_products?filter= takes it — category_ids:"<id>" (or =), attribute_set_id (=, !=) and attributes.<key> of the website's attributes, joined by AND, OR, NOT and parentheses — so that list, sent the condition, shows the products the rule is on. At most 2000 characters. Empty — the default — is no product, never every one. Another field, an attribute the website does not have or a mistake of the grammar is INVALID_ARGUMENT on condition, with the reason and its offset.
actionWhat the rule takes off: {"type": "PERCENT_OFF", "percent_off": "10"} — a percentage, above 0 and at most 100 with at most two decimals, as a decimal string — or {"type": "AMOUNT_OFF", "amount": {…}} — a google.type.Money above zero in the website's base currency, converted at the rate of the currency a price is in. Exactly the one its type takes. Replaced whole when sent. A price never goes below zero.
stop_further_rulesWhether the rules after this one in priority stop applying to a price this one applied to. false when omitted.
Get catalog price rule
A discount on every product a condition picks — «−10 % on the category Sale», «5 off the brand Acme for the trade group» — for some customer groups and views, over a period. Which products a rule is on is kept on them, in their price_rule_ids; the rules of a product apply highest priority first, each to what the one before left, until one says stop_further_rules. At most 50 per website.
path Parameters
website_idId of the parent website.
price_rule_idId of the parent price_rule.
Headers
If-None-MatchA matching etag answers 304 with no body (§16).
Get catalog price rule › Responses
The resource.
nameThe resource name (§5) — the identity of this resource, and the path that addresses it: websites/{website}/cms_pages/{cms_page}. It is the handle to store, not a human label.
idThe last segment of name on its own, for a client that needs to build a child URL. Unique inside its parent, never across the platform.
create_timeWhen the resource was created (RFC 3339, UTC).
update_timeWhen the resource last changed (RFC 3339, UTC).
etagVersion of the persisted state. Send it back in If-Match on Update or Delete and the write is rejected with ABORTED if anyone else changed the resource meanwhile (§14).
display_nameThe rule's name, for the admin — «Sale −10 %», «Trade discount». Not blank, at most 255 characters.
priorityThe order the rules of a product apply in: the higher first, then the older, each to what the one before left. 0 when omitted; negative numbers are fine.
is_activeWhether the rule applies at all. Switched off, it takes nothing off any price. true when omitted.
starts_atWhen the rule starts to apply. Absent — from now on. null under update_mask clears it.
ends_atWhen the rule stops applying: after starts_at. Absent — for good. null under update_mask clears it.
customer_group_idsThe ids of the website's customer groups the rule is for, each once. Empty — the default — means every visitor, guests included. A group an active rule names is priced apart, as by a price list: a website has at most 20 such groups, and a write past that answers FAILED_PRECONDITION PRICED_GROUPS_LIMIT. Deleting a group takes it out of every rule, and a rule it was the last group of is switched off rather than opened to everyone.
view_idsThe ids of the website's views the rule applies on, each once, at most 100. Empty — the default — means every view.
conditionWhich products the rule is for: a filter over a product, written as GET …/catalog_products?filter= takes it — category_ids:"<id>" (or =), attribute_set_id (=, !=) and attributes.<key> of the website's attributes, joined by AND, OR, NOT and parentheses — so that list, sent the condition, shows the products the rule is on. At most 2000 characters. Empty — the default — is no product, never every one. Another field, an attribute the website does not have or a mistake of the grammar is INVALID_ARGUMENT on condition, with the reason and its offset.
actionWhat the rule takes off: {"type": "PERCENT_OFF", "percent_off": "10"} — a percentage, above 0 and at most 100 with at most two decimals, as a decimal string — or {"type": "AMOUNT_OFF", "amount": {…}} — a google.type.Money above zero in the website's base currency, converted at the rate of the currency a price is in. Exactly the one its type takes. Replaced whole when sent. A price never goes below zero.
stop_further_rulesWhether the rules after this one in priority stop applying to a price this one applied to. false when omitted.
Delete catalog price rule
Deletes a catalog price rule; the products it was on lose it from their price_rule_ids within seconds. Switch is_active off instead to keep it.
path Parameters
website_idId of the parent website.
price_rule_idId of the parent price_rule.
Headers
If-MatchThe etag the client last read. A mismatch is ABORTED (409) with the current resource in the error details (§14).
Delete catalog price rule › Responses
Deleted. No body (§7).
Update catalog price rule
Changes a catalog price rule; each field sent is checked as on create, the period against the stored bound the body leaves out, and action replaced whole. A new condition moves the rule onto the products it now picks, and off the others, within seconds.
path Parameters
website_idId of the parent website.
price_rule_idId of the parent price_rule.
query Parameters
update_maskComma-separated field paths to merge. A field named here and sent as null is cleared; without the mask a null is dropped (§7, §11).
Headers
If-MatchThe etag the client last read. A mismatch is ABORTED (409) with the current resource in the error details (§14).
Update catalog price rule › Request Body
display_nameThe rule's name, for the admin — «Sale −10 %», «Trade discount». Not blank, at most 255 characters.
priorityThe order the rules of a product apply in: the higher first, then the older, each to what the one before left. 0 when omitted; negative numbers are fine.
is_activeWhether the rule applies at all. Switched off, it takes nothing off any price. true when omitted.
starts_atWhen the rule starts to apply. Absent — from now on. null under update_mask clears it.
ends_atWhen the rule stops applying: after starts_at. Absent — for good. null under update_mask clears it.
customer_group_idsThe ids of the website's customer groups the rule is for, each once. Empty — the default — means every visitor, guests included. A group an active rule names is priced apart, as by a price list: a website has at most 20 such groups, and a write past that answers FAILED_PRECONDITION PRICED_GROUPS_LIMIT. Deleting a group takes it out of every rule, and a rule it was the last group of is switched off rather than opened to everyone.
view_idsThe ids of the website's views the rule applies on, each once, at most 100. Empty — the default — means every view.
conditionWhich products the rule is for: a filter over a product, written as GET …/catalog_products?filter= takes it — category_ids:"<id>" (or =), attribute_set_id (=, !=) and attributes.<key> of the website's attributes, joined by AND, OR, NOT and parentheses — so that list, sent the condition, shows the products the rule is on. At most 2000 characters. Empty — the default — is no product, never every one. Another field, an attribute the website does not have or a mistake of the grammar is INVALID_ARGUMENT on condition, with the reason and its offset.
actionWhat the rule takes off: {"type": "PERCENT_OFF", "percent_off": "10"} — a percentage, above 0 and at most 100 with at most two decimals, as a decimal string — or {"type": "AMOUNT_OFF", "amount": {…}} — a google.type.Money above zero in the website's base currency, converted at the rate of the currency a price is in. Exactly the one its type takes. Replaced whole when sent. A price never goes below zero.
stop_further_rulesWhether the rules after this one in priority stop applying to a price this one applied to. false when omitted.
Update catalog price rule › Responses
The updated resource.
nameThe resource name (§5) — the identity of this resource, and the path that addresses it: websites/{website}/cms_pages/{cms_page}. It is the handle to store, not a human label.
idThe last segment of name on its own, for a client that needs to build a child URL. Unique inside its parent, never across the platform.
create_timeWhen the resource was created (RFC 3339, UTC).
update_timeWhen the resource last changed (RFC 3339, UTC).
etagVersion of the persisted state. Send it back in If-Match on Update or Delete and the write is rejected with ABORTED if anyone else changed the resource meanwhile (§14).
display_nameThe rule's name, for the admin — «Sale −10 %», «Trade discount». Not blank, at most 255 characters.
priorityThe order the rules of a product apply in: the higher first, then the older, each to what the one before left. 0 when omitted; negative numbers are fine.
is_activeWhether the rule applies at all. Switched off, it takes nothing off any price. true when omitted.
starts_atWhen the rule starts to apply. Absent — from now on. null under update_mask clears it.
ends_atWhen the rule stops applying: after starts_at. Absent — for good. null under update_mask clears it.
customer_group_idsThe ids of the website's customer groups the rule is for, each once. Empty — the default — means every visitor, guests included. A group an active rule names is priced apart, as by a price list: a website has at most 20 such groups, and a write past that answers FAILED_PRECONDITION PRICED_GROUPS_LIMIT. Deleting a group takes it out of every rule, and a rule it was the last group of is switched off rather than opened to everyone.
view_idsThe ids of the website's views the rule applies on, each once, at most 100. Empty — the default — means every view.
conditionWhich products the rule is for: a filter over a product, written as GET …/catalog_products?filter= takes it — category_ids:"<id>" (or =), attribute_set_id (=, !=) and attributes.<key> of the website's attributes, joined by AND, OR, NOT and parentheses — so that list, sent the condition, shows the products the rule is on. At most 2000 characters. Empty — the default — is no product, never every one. Another field, an attribute the website does not have or a mistake of the grammar is INVALID_ARGUMENT on condition, with the reason and its offset.
actionWhat the rule takes off: {"type": "PERCENT_OFF", "percent_off": "10"} — a percentage, above 0 and at most 100 with at most two decimals, as a decimal string — or {"type": "AMOUNT_OFF", "amount": {…}} — a google.type.Money above zero in the website's base currency, converted at the rate of the currency a price is in. Exactly the one its type takes. Replaced whole when sent. A price never goes below zero.
stop_further_rulesWhether the rules after this one in priority stop applying to a price this one applied to. false when omitted.