Skip to content

Commit

Permalink
* Fix - Added check to prevent wc_add_notice() from trying to display…
Browse files Browse the repository at this point in the history
… on admin. Closes #7
  • Loading branch information
stuartduff committed Sep 5, 2016
1 parent 6e55b09 commit 6d28ef7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ All support requests for this extension should be posted to the [WooCommerce Dyn

## Changelog

**1.0.5 - 05/09/16**
* Fix - Added check to prevent wc_add_notice() from trying to display on admin.

**1.0.4 - 30/08/16**
* Feature - Added the ability to display [Simple Category Pricing](https://docs.woocommerce.com/document/woocommerce-dynamic-pricing/#section-4) discounts on WooCommerce categories.

Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: stuartduff
Tags: ecommerce, e-commerce, store, sales, sell, shop, cart, checkout, storefront
Requires at least: 4.5
Tested up to: 4.5.2
Stable tag: 1.0.4
Stable tag: 1.0.5
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -31,6 +31,9 @@ Below are the discounts that the plugin will currently display.

== Changelog ==

= 1.0.5 - 05/09/16 =
* Fix - Added check to prevent wc_add_notice() from trying to display on admin.

= 1.0.4 - 30/08/16 =
* Feature - Added the ability to display Simple Category Pricing discounts on WooCommerce categories.

Expand Down
9 changes: 6 additions & 3 deletions woocommerce-dynamic-pricing-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WooCommerce Dynamic Pricing Table
* Plugin URI: https://github.com/stuartduff/woocommerce-dynamic-pricing-table
* Description: Displays a pricing discount table on WooCommerce products, a user role discount message and a simple category discount message when using the WooCommerce Dynamic Pricing plugin.
* Version: 1.0.4
* Version: 1.0.5
* Author: Stuart Duff
* Author URI: http://stuartduff.com
* Requires at least: 4.6
Expand Down Expand Up @@ -138,8 +138,11 @@ private function log_plugin_version_number() {
public function plugin_setup() {
if ( class_exists( 'WC_Dynamic_Pricing' ) ) {
add_action( 'woocommerce_before_add_to_cart_button', array( $this, 'output_dynamic_pricing_table' ) );
add_action( 'wp', array( $this, 'output_dynamic_pricing_role_message' ) );
add_action( 'wp', array( $this, 'output_dynamic_pricing_category_message' ) );

if ( ! is_admin() ) {
add_action( 'wp', array( $this, 'output_dynamic_pricing_role_message' ) );
add_action( 'wp', array( $this, 'output_dynamic_pricing_category_message' ) );
}
} else {
add_action( 'admin_notices', array( $this, 'install_wc_dynamic_pricing_notice' ) );
}
Expand Down

0 comments on commit 6d28ef7

Please sign in to comment.