Storefront Sticky Add to Cart - Version 1.1.3

Version Description

  • 04.26.2016 =
  • Tweak - Integration with Catalog Visibility Options extension.
Download this release

Release Info

Developer jameskoster
Plugin Icon 128x128 Storefront Sticky Add to Cart
Version 1.1.3
Comparing to
See all releases

Code changes from version 1.1.2 to 1.1.3

Files changed (2) hide show
  1. readme.txt +4 -1
  2. storefront-sticky-add-to-cart.php +17 -2
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: jameskoster, woothemes
3
  Tags: woocommerce, ecommerce, storefront, sticky
4
  Requires at least: 4.0
5
  Tested up to: 4.5.0
6
- Stable tag: 1.1.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -35,6 +35,9 @@ It's very simple, most of the core styles are loaded regardless. You'll just nee
35
 
36
  == Changelog ==
37
 
 
 
 
38
  = 1.1.2 - 04.13.2016 =
39
  * Tweak - Compatibility with products other than simple/variable (eg. Subscriptions).
40
 
3
  Tags: woocommerce, ecommerce, storefront, sticky
4
  Requires at least: 4.0
5
  Tested up to: 4.5.0
6
+ Stable tag: 1.1.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
35
 
36
  == Changelog ==
37
 
38
+ = 1.1.3 - 04.26.2016 =
39
+ * Tweak - Integration with Catalog Visibility Options extension.
40
+
41
  = 1.1.2 - 04.13.2016 =
42
  * Tweak - Compatibility with products other than simple/variable (eg. Subscriptions).
43
 
storefront-sticky-add-to-cart.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Storefront Sticky Add to Cart
4
  * Plugin URI: https://wordpress.org/plugins/storefront-sticky-add-to-cart/
5
  * Description: Adds a sticky add-to-cart bar in single product pages that is revealed as the user scrolls down the page.
6
- * Version: 1.1.2
7
  * Author: WooThemes
8
  * Author URI: http://woothemes.com/
9
  * Requires at least: 4.0.0
@@ -90,7 +90,7 @@ final class Storefront_Sticky_Add_to_Cart {
90
  $this->token = 'storefront-sticky-add-to-cart';
91
  $this->plugin_url = plugin_dir_url( __FILE__ );
92
  $this->plugin_path = plugin_dir_path( __FILE__ );
93
- $this->version = '1.1.2';
94
 
95
  register_activation_hook( __FILE__, array( $this, 'install' ) );
96
 
@@ -295,12 +295,27 @@ final class Storefront_Sticky_Add_to_Cart {
295
  echo '<span class="price">' . wp_kses_post( $product->get_price_html() ) . '</span> ' . wp_kses_post( $product->get_rating_html() );
296
  echo wp_kses_post( apply_filters( 'woocommerce_stock_html', $availability_html, $availability['availability'], $product ) );
297
 
 
 
298
  if ( $product->is_type( 'simple' ) ) {
299
  echo '<br /><a href="' . esc_url( $product->add_to_cart_url() ) . '" class="button alt">' . esc_attr( $product->single_add_to_cart_text() ) . '</a>';
300
  } else {
301
  echo '<br /><a class="button alt variable">' . esc_attr__( 'Select options', 'storefront-sticky-add-to-cart' ) . '</a>';
302
  wp_enqueue_script( 'ssatc-variable' );
303
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  echo '</div>';
305
  ?>
306
  </div>
3
  * Plugin Name: Storefront Sticky Add to Cart
4
  * Plugin URI: https://wordpress.org/plugins/storefront-sticky-add-to-cart/
5
  * Description: Adds a sticky add-to-cart bar in single product pages that is revealed as the user scrolls down the page.
6
+ * Version: 1.1.3
7
  * Author: WooThemes
8
  * Author URI: http://woothemes.com/
9
  * Requires at least: 4.0.0
90
  $this->token = 'storefront-sticky-add-to-cart';
91
  $this->plugin_url = plugin_dir_url( __FILE__ );
92
  $this->plugin_path = plugin_dir_path( __FILE__ );
93
+ $this->version = '1.1.3';
94
 
95
  register_activation_hook( __FILE__, array( $this, 'install' ) );
96
 
295
  echo '<span class="price">' . wp_kses_post( $product->get_price_html() ) . '</span> ' . wp_kses_post( $product->get_rating_html() );
296
  echo wp_kses_post( apply_filters( 'woocommerce_stock_html', $availability_html, $availability['availability'], $product ) );
297
 
298
+ ob_start();
299
+
300
  if ( $product->is_type( 'simple' ) ) {
301
  echo '<br /><a href="' . esc_url( $product->add_to_cart_url() ) . '" class="button alt">' . esc_attr( $product->single_add_to_cart_text() ) . '</a>';
302
  } else {
303
  echo '<br /><a class="button alt variable">' . esc_attr__( 'Select options', 'storefront-sticky-add-to-cart' ) . '</a>';
304
  wp_enqueue_script( 'ssatc-variable' );
305
  }
306
+
307
+ if ( class_exists( 'WC_Catalog_Restrictions' ) ) {
308
+ if ( ! WC_Catalog_Restrictions_Filters::instance()->user_can_purchase( $product ) ) {
309
+ ob_end_clean();
310
+ global $wc_cvo;
311
+ $html = apply_filters( 'catalog_visibility_alternate_add_to_cart_button', do_shortcode( wpautop( wptexturize( $wc_cvo->setting( 'wc_cvo_s_price_text' ) ) ) ) );
312
+
313
+ echo $html;
314
+ }
315
+ }
316
+
317
+ ob_end_flush();
318
+
319
  echo '</div>';
320
  ?>
321
  </div>