WooCommerce is the most popular ecommerce plugin for WordPress users to sell physical and digital goods. Many WooCommerce store owners also have a blog for publishing content related to their products. This helps to drive traffic to store as well as monetize the content with display ads using free plugins like Ad Inserter. However, the problem comes when a paying customer sees advertisements in WooCommerce store pages. In this article, we will explain how to disable ads in WooCommerce pages in Ad Inserter plugin settings.
WooCommerce Pages in WordPress
Depending upon the setup, WooCommerce will create the following pages in your WordPress site:
- Shop page
- Cart page
- Checkout page
- Product pages
- Shop archives
- Product category archives
- Product tag archives
While the first three are pages and the last three are archives, the plugin uses a custom post type “product” for single product pages.
Disabling Ads on WooCommerce Pages in Ad Inserter
You need to disable ads on all the above listed pages to make sure premium customers are not seeing distracting ads. Let us take an example case that you want to insert an ad block below the page title but do not want to show the ad on WooCommerce section. For this, you need to paste the ad code in any of the available blocks under “Settings > Ad Inserter” section and select insertion option as “Before content”. Now, follow one of the below tips depending upon your need to disable the ad block.
Show Ads Only on Posts or Pages
This is a common scenario that you want to show the ad block only on blog posts and disable on all other sections including WooCommerce sections. Ad Inserter plugin makes this task simple and you can select “Posts” option and save your settings. The ad block will be only inserted on posts (post type – post) and excluded on all other sections of your site.
Similarly, select “Static pages” option (post type – page) when you want to show ads only on pages. You can also select both posts and static pages for displaying ad block on both pages and posts.
Disable Only on WooCommerce Section
The problem with the above approach is that the ad block will not work on custom post types if you have on your site. In addition, if you are using an ad block in loop pages like search, category and tag archives, then there are no options other than manually excluding WooCommerce loop pages like product category and product tag archives. Whatsoever is the case with your site, you can add exceptions in your ad block to disable ads on WooCommerce sections. First, click on the “Lists” button to see a list of inclusions and exclusions options.
Since WooCommerce has pages, products and archives, you need to use the combination of different options in the lists to exclude them.
Product Pages
Click the checkbox next to “Taxonomies” and you will see all the available taxonomies in your site. Type “product” in the search box and select “post-type:product (Product)” option.
This will add the product post type in the right column and also in the “Taxonomies” text box.
Again, click on the checkbox to hide the dropdown list. At the end of the “Taxonomies” item, you will see a X mark indicating the added item will be excluded (blacklisted). If you see a tick mark, make sure to click on that and change to X mark.
WooCommerce Pages and Archives
Except cart and checkout pages, other pages in WooCommerce are archives with pagination. Because of this, you can use wildcard (*) to block the archives and direct URL for cart/checkout pages.
- Click the checkbox next to “Urls” to open a text box.
- Add /shop*, /checkout, /cart, /product-tag* and /product-category* each item in a separate line.
- If required, you can also make /cart* and /checkout* to make those URLs wildcard. In fact, you can add /product* to blacklist all product pages instead of using “Taxonomies” option as explained above.
- Again, click on the checkbox next to “Urls” to hide the text box and make sure the X mark is shown at the end of the “Urls” item.
Scroll up and click “Save Settings 1- 16” button to apply your changes and block ads on WooCommerce pages. If you are using caching, make sure to purge the cache before testing WooCommerce pages on your site.
For AdSense Auto Ads
If you are using auto ads setup from AdSense, then you need to disable ads on specific pages/section in your AdSense account. You do not need Ad Inserter or any other plugin for this purpose. Learn more on how to setup auto ads and exclude pages and section to disable ads on WooCommerce related pages in your site.
1 Comment
Leave your reply.