We will sunset v2 of the Content API on March 29th, 2021. To avoid disruptions with your integration, please migrate to v2.1 as soon as possible. For more information, see Migrating to v2.1.

Using Pricing Rules

Pricing rules allow you to automatically update the price for products sold through Shopping Actions. Pricing rules calculate the new price value when products are served and do not affect the price value set on the products resource.

As part of a rule’s definition, you can set limits on how much the rule can change a product’s price, as well as set a fixed start and end time for when the rule is active. When a rule is outside of its set effective times, or when it is manually paused, the prices of the affected products revert to the values set on the products resource.

Currently, you can define TYPE_WIN_BUY_BOX pricing rules. This rule type automatically lowers the price of the product to maximize the chance of winning the Shopping Actions buy box. When creating pricing rules, you must set limits on the effects of the rules, either by setting a maximum price change (as a percentage or an absolute value) in the rule definition, or by setting an explicit minimum price on the products resource.

Creating pricing rules

Creating pricing rules involves defining the rule and selecting the products that are affected by the rule.

Defining win-buy-box rules

The TYPE_WIN_BUY_BOX rule type allows you to automatically lower a product’s price in an effort to win the Shopping Actions buy box, which makes you the default merchant for the product. This rule lowers the price of the product the minimum amount needed to win the buy box, within the price constraints that you specify. However, applying this rule does not guarantee that a product will always win the buy box.

Mutable and immutable fields

Rule definitions can contain both immutable fields, which cannot be changed once the rule is created, and mutable fields, which can be changed after the rule is created. The ruleId, countryCode, languageCode, and type are immutable. All other fields are mutable.

Example

In this example, you want to lower the price of the affected products to try to win their buy boxes. You are willing to lower a product’s price by a maximum of either $10 or 10% of the price set on the products resource, whichever is less. You want the rule to be in effect from 3:00 - 4:00 pm UTC on June 22nd, 2020.

To create this rule, make a POST request using following URL and request body:

https://www.googleapis.com/content/v2.1/merchantId/repricingrules?ruleIdbuyboxrule
{
 "title": “Win the Buy Boxes!”,
 "paused": false,
 “countryCode: “US”,
 “languageCode: “en”,
 "eligibleOfferMatcher": {
    "matcherOption": "MATCHER_OPTION_CUSTOM_FILTER"
    “offerIdMatcher”: [
        ‘1111111111’,
        ‘2222222222’,
        ‘3333333333’,
      ],
    “itemGroupIdMatcher”: [
        ‘12345’,
        ‘67890’,
        ‘11223’,
      ],
    “brandMatcher”: [
        ‘Nike’,
        ‘Adidas’,
        ‘New Balance’,
      ],
   “matcherOption: “CUSTOM_FILTER”
  },
 "effectiveTimes": [
    {
      “startTime”: "2020-06-20T12:00:00+00:00"
      “endTime”: "2020-06-20T14:00:00+00:00"
    }
 ],
 "type": ‘TYPE_WIN_BUY_BOX’,
 "restriction": {
    “floor”: {
      “priceDelta”: “-10”,
      “percentageDelta”: -10
    }
  }
}

Selecting which products are affected by a rule

You can either select products by listing offerIDs, itemGroupIds, and/or brand as part of definition of the rule itself, or by associating the rule with a product via the products resource:

  • To select the affected products as part of a rule definition, you must first set the matcherOption field (nested inside the eligibleOfferMatcher field) to "CUSTOM_FILTER".
    • You can then pass a list of offerIDs, itemGroupIds, and brands within the rule’s eligibleOfferMatcher field via the nested fields of offerIdMatcher, itemGroupIdMatcher, and brandMatcher, as shown in the Defining win-buy-box rules example. Keep in mind that you can only select a maximum of 20 total values when you sum the number of elements in the offerIdMatcher, itemGroupIdMatcher, and brandMatcher fields.
  • To select affected products by assigning a pricing rule via the products resource, you must first set the matcherOption field (nested inside the eligibleOfferMatcher field) to "USE_FEED_ATTRIBUTE".
    • You can then set the repricingRuleId field on the products resource to the rule’s ruleId value. The repricingRuleId field accepts a maximum of ten ruleIds per product.

Pausing rules

In addition to setting the effectiveTimes values when creating a rule, you can update the rule’s paused field to control whether or not a rule is active. When a rule is paused, or when the rule is outside of its set effective times, the prices of the affected products revert to the values set on the products resource.

Example

To pause an existing rule, make a PATCH request using the following URL and request body:

https://www.googleapis.com/content/v2.1/merchantId/repricingRules/rule_id
{
 // include all mutable fields from the existing rule definition
 ...
 "paused": true
}