Version v2 of the Content API is scheduled for sunset on September 30th, 2021. Onboarding to v2 will stop on April 30, 2021. To avoid disruptions with your integration, please migrate to v2.1 as soon as possible.

For more information, see Migrating to v2.1 and this blog post.

Using Pricing Rules

Pricing rules allow you to automatically update the price for products sold through Buy on Google. 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_STATS_BASED and TYPE_COGS_BASED pricing rules. These rule types automatically change the price of the product to maximize the likelihood of selling your product. 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 stats-based rules

The TYPE_STATS_BASED rule type allows you to automatically change a product’s price in an effort to compete effectively against other merchants selling the same product on Buy on Google. This rule alters the price of the product based on statistical measurements (min) within the price constraints that you specify. However, applying this rule does not guarantee that your product will outsell competitors who sell the same product.

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 maximize your chances out outselling your competitors. 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 specify that you are willing to lower your price to be 10% higher than the lowest price of competitors selling the same product, as long as the new price does not require you to lower your current price past your restriction values. 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://shoppingcontent.googleapis.com/content/v2.1/merchantId/repricingrules?ruleIdbuyboxrule
{
 "title": “10% higher than the lowest price!”,
 "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_STATS_BASED’,
 "restriction": {
    “floor”: {
      “priceDelta”: “-10”,
      “percentageDelta”: -10
    }
  }
  "stats_based_rule": {
    "percentage_delta": 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://shoppingcontent.googleapis.com/content/v2.1/merchantId/repricingRules/rule_id
{
 // include all mutable fields from the existing rule definition
 ...
 "paused": true
}