Skip to main content

Configuration

Cache Exclusion for Automated Discounts

This is important

You need to make sure that all cache layers exclude caching of WooCommerce sessions and if the following parameters are set. Otherwise Automated Discounts will not be displayed and processed correctly.

Exclude caching if the URL query parameter pv2 is present in the URL

Example: https://example.com/socks/?pv2=1234

Typically, caches exist in one or more of the following:

  • Server of your hosting provider
  • Caching plugins (sometimes shop managers use more than one caching plugin. Make sure to configure all of them.)
  • Content Delivery Networks (CDNs) like Cloudflare.

Once you've set the cache exclusion, also make sure to flush the cache(s) before testing.

The plugin sets a cookie sgadwc_session_active when a visitor clicks on an Automated Discounts link.

Make sure that the cache is disabled if that cookie is present in the browser of the visitor.

Test your cache exclusion

  1. Go to the plugin settings page. You will find testing links.
caution

The testing links expire within 24 hours. The following test only works with valid (not expired) testing links. In case you need new testing links, simply reload the plugin settings page.

cache test

  1. Right click on one of the testing links in the second column of the table and open the link in an incognito window.

The link contains an Automated Discounts payload. If everything has bee set up correctly, it will start a new WooCommerce session and display the discounted price.

You can check if the session has been started by looking at the cookies in the browser.

  1. Open the developer tools of your browser and go to the Console tab.

  2. Check if the following text is present in the console: Automated Discounts session active

cache test

If you see the text Automated Discounts session active in the console, it means that the cache exclusion works correctly.

If you don't see the text Automated Discounts session active in the console, it means that the cache exclusion does not work correctly, or that your testing link has expired.

Cache Exclusion for WooCommerce Sessions

Make sure to follow WooCommerce's guidelines on how to exclude caching for WooCommerce sessions.

If the cache exclusion for WooCommerce sessions is not set correctly, the Automated Discounts program will not approve your shop for the program.

Cart session must be valid for at least 48 hours after a click on an Automated Discounts link.

Google Merchant Center ID

  1. Get the Google Merchant Center ID by logging into the Google Merchant Center and copying the ID from the URL.

Google Merchant Center ID

  1. Save the Google Merchant Center ID in the settings of the plugin.

Google Merchant Center ID

Order Info

The plugin will add a column to the order list and a column to the order item page in the WooCommerce backend. The columns will show if an order has been placed with an Automated Discount and how much the discount was.

Order List Info

The plugin will add a column to the order list in the WooCommerce backend. The column will show if an order has been placed with an Automated Discount.

  • Badge in color: The order contains items that have been discounted with Automated Discounts.
  • Badge in gray: The order was created during an Automated Discounts session, but no order items have been discounted with Automated Discounts. That's when a visitor clicks on an Automated Discounts link in Google Shopping ads, but doesn't purchase any of the discounted products.

Order List Info

Order Item Info

The plugin will add a meta box to the order item page in the WooCommerce backend. The meta box will show if an order has been placed with an Automated Discount and how much the discount was.

Order Item Info

Variations Discount Inheritance

If you have variable products with variations that have the same or similar prices, you may want to use the Variations Discount Inheritance feature.

An Automated Discount is only generated for specific product IDs in the Google Merchant Center feed, not for groups of products (such as product variations of the same parent product). If a visitor clicks on an Automated Discount ad for a specific product variation of a variable product, the discount will only be applied to that specific product variation.

Without the Variations Discount Inheritance feature, discounts on a product page will be lost when switching from one variation to another. With the Variations Discount Inheritance feature enabled, the new variation will inherit the discount.

The feature is disabled by default. You can enable it in the plugin settings.

Variations Discount Inheritance Activation

Use cases

For example, if you sell shoes in different sizes and colors, the shop visitors might click on an Automated Discount ad with a shoe color they like but get directed to the wrong shoe size. Once they are on the product page for that shoe, they will likely change the size. But they will lose the discount as it was only valid for the first variant. Enabling the Variations Discount Inheritance feature will ensure the new variation inherits the discount.

However, using Variations Discount Inheritance doesn't make sense in every case. If your variations have very different prices and/or product margins, inheriting the same discount for all variations may cause issues. This could be true if you are using variable products to sell new and used versions of the same product.

Inheritance Logic

  • Only for variable products: The Variations Discount Inheritance feature only works with variable products. It is not available for simple or other products.
  • Only inherit within the same product: The Variations Discount Inheritance feature only inherits discounts to other variations of the same parent product.
  • Automated Discount clicks trigger inheritance: Once a visitor clicks on an ad with an Automated Discount for a product variation, the discount will be inherited to all other variations of the same parent product.
  • Automated Discount clicks override inherited discounts: If a visitor clicks on a second ad with an Automated Discount for another variation of the same parent product, the previously inherited discount on the second variation will be overwritten with the new discount.
  • The highest discount is inherited: If the discount for the second ad click is higher than the discount for the first ad click, the higher discount will be inherited to all other variations of the same product (except the variations that are in a specific Automated Discounts session).
  • The lowest sale price rules: If a variation is about to receive a discount through inheritance but has an existing sale price lower than the price calculated through the inherited discount, the lower sale price will be used.
  • COG overrules: If a variation is about to receive a discount through inheritance but has an existing Cost of Good (COG) price set that is higher than the price calculated through the inherited discount, the COG price will be used. (This works with the following COGS plugins: WooCommerce Cost of Goods by SkyVerge and Cost of Goods Sold by WPFactory).

Discount Type to Inherit

Google sends a fixed discounted price in the payload of the Automated Discount link (eg. 23.50).

There are two ways in which the plugin allows the discount to be inherited: Fixed Price Discount Inheritance and Percentage Discount Inheritance.

Fixed Price Discount Inheritance

The plugin will inherit the same fixed discounted price to all other variations of the same parent product.

If the discounted price is USD 23.50, then all other variations will inherit the same price of USD 23.50.

Percentage Discount Inheritance

The plugin will inherit the same percentage discount to all other variations of the same parent product.

On the first visit, the plugin will calculate the percentage discount based on the regular and discounted prices. The same percentage discount will then be inherited from all other variations of the same parent product.

Example: The regular price is USD 100.00, and the discounted price is USD 75.50. The plugin will calculate a percentage discount of 24.5%. All other variations will then inherit the same percentage discount of 24.5%.

If the resulting prices don't follow your decimal formatting rules, you can use the following filter to adjust the two digits after the comma.

/wp-content/themes/child-theme/functions.php
add_filter( 'sgadwc_percent_discount_variation_discounted_price', function ( $price, $product_id ) {
// Return the price with the decimals removed and replaced with .99
return floor( $price ) + 0.99;
} );
Possible Performance Issues

If a parent product has many variations (e.g. more than 100), it may cause performance issues when loading the first product page.

You can use the following filter to limit the number of variations considered for the discount inheritance.

/wp-content/themes/child-theme/functions.php
add_filter( 'sgadwc_discount_variation_array_max_length', function () {
return 50;
} );

Discount Banner

info

Available from version 1.4.2

To emphasize the discount an the urgency to buy, you can display a discount banner on the product page. In most cases it will increase the conversion rate.

When activated, the plugin will display the discount banner on the product page above the product. The banner will show the time left until the discount expires. After expiration the banner will will show an expired message.

Discount Banner

The discount banner works with simple and variable products.

It is disabled by default. You can enable it in the plugin settings.

To give you full control over the design, the banner is built as a template that can be overridden by your theme.

Activate the discount banner

  1. Go to the plugin settings page.

  2. Click on the Discount Banner checkbox.

  3. Click on the Save Changes button.

Discount Banner Template

You can find the template in the plugin folder under /templates/discount-banner-flipper.php.

Copy the template to your child theme folder under /sgadwc/discount-banner-flipper.php.

The default template uses the Flip counter plugin. If you want to keep using it, simply keep flipper in the template name. This will automatically load the flipper plugin scripts and stylings.

If you don't plan to user the Flip counter plugin, you can remove flipper from the template name. This will prevent the Flip plugin scripts and stylings from being loaded. The file name would then be /sgadwc/discount-banner.php.

The template has access to the $ad_banner_settings array. The information in the array can be used to customize the banner. It contains the following values:

 $ad_banner_settings = [
'productId' => 16,
'expiryInSeconds' => 876, // Seconds until the discount expires
'discountDetails' => [
'sale_price' => 17.48,
'regular_price' => 21,
'discount_percentage' => 16.76,
'exp' => 1706015751, // Unix timestamp of the expiry time
],
'localization' => [ // These fields are automatically used by the Flip counter plugin
'expiryText' => 'exp.'
'MINUTE_PLURAL' => 'Minutes',
'MINUTE_SINGULAR' => 'Minute',
'SECOND_PLURAL' => 'Seconds',
'SECOND_SINGULAR' => 'Seconds',
],
];

Translate the discount banner

We provide a .pot file in the plugin folder under /languages/sgadwc.pot. You can use it to translate the discount banner into your language.

Alternatively, you can use the following filter to translate just the banner text.

Here's and example on how to translate the default English text to German.

/wp-content/themes/child-theme/functions.php
add_filter( 'gettext', function ( $translated_text, $text, $domain ) {

if ( $text == 'Discount offer ends in' ) {
return 'Rabattangebot endet in';
}

if ( $text == 'Minutes' ) {
return 'Minuten';
}

if ( $text == 'Minute' ) {
return 'Minute';
}

if ( $text == 'Seconds' ) {
return 'Sekunden';
}

if ( $text == 'Second' ) {
return 'Sekunde';
}

return $translated_text;

}, 10, 3 );
info

Available from version 1.6.0 Currently available with beta version 1.6.0-beta.4

The plugin offers an option to transmit the Google Ads Custom Variable gad_discounted with the purchase conversion event.

This will enable reports in Google Ads that show the number of conversions that were made with a product that was discounted with Automated Discounts.

The requirement is that you are using our Pixel Manager for WooCommerce.

Setup Part 1: Enable the Custom Variable and use Segmentation

Setup Part 2: Create a Custom Column in Google Ads

Example with a segmentation report

Google Ads Custom Variable segmentation report

Example with a custom column

Google Ads Custom Variable custom column

Example with a graph

Google Ads Custom Variable graph

Boost your sales with Google Shopping ads. Allow Google to set your discount to secure the sale and optimize your profit margin.