Skip to content

Commit

Permalink
* Fix - Notice: id was called incorrectly error.
Browse files Browse the repository at this point in the history
* Added -  external_add_product_link_html filter.
* Added -  external_add_product_link_html_classes filter.
  • Loading branch information
stuartduff committed Feb 20, 2020
1 parent 3ec2ea4 commit 2e4c5da
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ All support requests for this extension should be posted to the [WooCommerce Ext

## Changelog

**1.0.3 - 19/02/20**
* Fix - Notice: id was called incorrectly error.
* Added - external_add_product_link_html filter.
* Added - external_add_product_link_html_classes filter.

**1.0.2 - 27/10/17**
* Added WooCommerce plugin version check compatibility.
* Added - WooCommerce plugin version check compatibility.

**1.0.1 - 14/02/17**
* Fix - Added additional css class of product_type_external to archive external products button.
Expand Down
13 changes: 9 additions & 4 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
=== WooCommerce External Product New Tab ===
Contributors: stuartduff
Tags: ecommerce, e-commerce, store, sales, sell, shop, cart, checkout, woocommerce
Requires at least: 4.6
Tested up to: 4.8
Stable tag: 1.0.2
Requires at least: 5.3
Tested up to: 5,3
Stable tag: 1.0.3
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand All @@ -26,8 +26,13 @@ For this extension to function the [WooCommerce](https://wordpress.org/plugins/w

== Changelog ==

= 1.0.3 - 19/02/20 =
* Fix - Notice: id was called incorrectly error.
* Added - external_add_product_link_html filter.
* Added - external_add_product_link_html_classes filter.

= 1.0.2 - 27/10/17 =
* Added WooCommerce plugin version check compatibility.
* Added - WooCommerce plugin version check compatibility.

= 1.0.1 - 14/02/17 =
* Fix - Added additional css class of product_type_external to archive external products button.
Expand Down
14 changes: 7 additions & 7 deletions wc-external-product-new-tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
* Version: 1.0.2
* Author: Stuart Duff
* Author URI: http://stuartduff.com
* Requires at least: 4.6
* Tested up to: 4.8
* Requires at least: 5.3
* Tested up to: 5.3
* Text Domain: wc-external-product-new-tab
* Domain Path: /languages/
* WC requires at least: 3.0.0
* WC tested up to: 3.2.0
* WC requires at least: 3.9
* WC tested up to: 4.0
*
* @package WC_External_Product_New_Tab
*/
Expand Down Expand Up @@ -177,12 +177,12 @@ public function external_add_product_link( $link ) {
/**
* The original code is located in the WooCommerce file /templates/loop/add-to-cart.php
*/
$link = sprintf( '<a rel="nofollow" href="%s" data-quantity="%s" data-product_id="%s" data-product_sku="%s" class="%s" target="_blank">%s</a>',
$link = sprintf( apply_filters( 'external_add_product_link_html', '<a rel="nofollow" href="%s" data-quantity="%s" data-product_id="%s" data-product_sku="%s" class="%s" target="_blank">%s</a>' ),
esc_url( $product->add_to_cart_url() ),
esc_attr( isset( $quantity ) ? $quantity : 1 ),
esc_attr( $product->id ),
esc_attr( $product->get_id() ),
esc_attr( $product->get_sku() ),
esc_attr( isset( $class ) ? $class : 'button product_type_external' ),
esc_attr( isset( $class ) ? $class : apply_filters( 'external_add_product_link_html_classes', 'button product_type_external' ) ),
esc_html( $product->add_to_cart_text() )
);
}
Expand Down

0 comments on commit 2e4c5da

Please sign in to comment.