Product Feed PRO for WooCommerce - Version 7.5.8

Version Description

Adding Brand and MPN to product JSON-LD when woosea values are set for products; When a variation SKU has been filled in that will show in the structured data SKU instead of the parent variable SKU; The Yoast WooCommerce SEO plugin was removing our structured data price fix for variations. This has been solved;

Download this release

Release Info

Developer jorisverwater
Plugin Icon 128x128 Product Feed PRO for WooCommerce
Version 7.5.8
Comparing to
See all releases

Code changes from version 7.5.7 to 7.5.8

Files changed (4) hide show
  1. TODO.txt +1 -1
  2. js/woosea_key.js +1 -1
  3. readme.txt +11 -1
  4. woocommerce-sea.php +225 -6
TODO.txt CHANGED
@@ -5,7 +5,7 @@ Tutorial / Blog posts:
5
  - Explain all the different fields/attributes that can be selected from the drop-downs
6
 
7
  Priority issues:
8
- - Add feature to add parent product to feeds (DSA and possible others)
9
  - Change XML header for Elite users (so it doesn't say its free for example)
10
  - Make extra woosea fields available for front-end usage
11
  - Only update feed when changes to products have been made
5
  - Explain all the different fields/attributes that can be selected from the drop-downs
6
 
7
  Priority issues:
8
+ - Make category path primary (Yoast) category
9
  - Change XML header for Elite users (so it doesn't say its free for example)
10
  - Make extra woosea fields available for front-end usage
11
  - Only update feed when changes to products have been made
js/woosea_key.js CHANGED
@@ -27,7 +27,7 @@ jQuery(document).ready(function($) {
27
  var license_key = $('#license-key').val();
28
 
29
  jQuery.ajax({
30
- url: 'https://www.adtribes.io/check/license.php?key=' + license_key + '&email=' + license_email + '&domain=' + root_domain + '&version=7.5.7',
31
  jsonp: 'callback',
32
  dataType: 'jsonp',
33
  type: 'GET',
27
  var license_key = $('#license-key').val();
28
 
29
  jQuery.ajax({
30
+ url: 'https://www.adtribes.io/check/license.php?key=' + license_key + '&email=' + license_email + '&domain=' + root_domain + '&version=7.5.8',
31
  jsonp: 'callback',
32
  dataType: 'jsonp',
33
  type: 'GET',
readme.txt CHANGED
@@ -5,7 +5,7 @@ License URI: http://www.gnu.org/licenses/gpl.html
5
  Tags: Product Feed, Google Shopping, Google Shopping Feed, WooCommerce Product Feed, WooCommerce Product Feed PRO, Bing Shopping, Bing product feed, Bing remarking, Google Merchant Feed, Google DRM Feed, Google Dynamic Remarketing Feed, Facebook feed, Google feed, Bing feed, Facebook Product Feed, Facebook Dynamic remarketing, Data Feed, WooCommerce Feed, XML product feed, CSV product feed, TSV, TXT product feed, comparison shopping engines, comparison shopping websites, vergelijk.nl, vergelijk.be, vertaa.fi, beslist.nl, kieskeurig.nl, bol.com, raketten, pricerunner, pricegrabber, Buy, leGuide, Kelkoo, Twenga, Yandex, Etsy, Dealtime, Shopzilla, Billiger, Google Product Review feed
6
  Requires at least: 4.5
7
  Tested up to: 5.3
8
- Stable tag: 7.5.7
9
 
10
  == Description ==
11
 
@@ -312,6 +312,11 @@ Questions left or unanswered? Please do not hesitate to contact us at support@ad
312
 
313
  === Changelog ===
314
 
 
 
 
 
 
315
  = 7.5.7 (2020-02-25) =
316
  * Changed the Skroutz template to reflect all changes of last week
317
 
@@ -2408,6 +2413,11 @@ Questions left or unanswered? Please do not hesitate to contact us at support@ad
2408
 
2409
  == Upgrade Notice ==
2410
 
 
 
 
 
 
2411
  = 7.5.7 =
2412
  Changed the Skroutz template to reflect all changes of last week
2413
 
5
  Tags: Product Feed, Google Shopping, Google Shopping Feed, WooCommerce Product Feed, WooCommerce Product Feed PRO, Bing Shopping, Bing product feed, Bing remarking, Google Merchant Feed, Google DRM Feed, Google Dynamic Remarketing Feed, Facebook feed, Google feed, Bing feed, Facebook Product Feed, Facebook Dynamic remarketing, Data Feed, WooCommerce Feed, XML product feed, CSV product feed, TSV, TXT product feed, comparison shopping engines, comparison shopping websites, vergelijk.nl, vergelijk.be, vertaa.fi, beslist.nl, kieskeurig.nl, bol.com, raketten, pricerunner, pricegrabber, Buy, leGuide, Kelkoo, Twenga, Yandex, Etsy, Dealtime, Shopzilla, Billiger, Google Product Review feed
6
  Requires at least: 4.5
7
  Tested up to: 5.3
8
+ Stable tag: 7.5.8
9
 
10
  == Description ==
11
 
312
 
313
  === Changelog ===
314
 
315
+ = 7.5.8 (2020-02-28) =
316
+ * Adding Brand and MPN to product JSON-LD when woosea values are set for products;
317
+ * When a variation SKU has been filled in that will show in the structured data SKU instead of the parent variable SKU;
318
+ * The Yoast WooCommerce SEO plugin was removing our structured data price fix for variations. This has been solved;
319
+
320
  = 7.5.7 (2020-02-25) =
321
  * Changed the Skroutz template to reflect all changes of last week
322
 
2413
 
2414
  == Upgrade Notice ==
2415
 
2416
+ = 7.5.8 =
2417
+ Adding Brand and MPN to product JSON-LD when woosea values are set for products;
2418
+ When a variation SKU has been filled in that will show in the structured data SKU instead of the parent variable SKU;
2419
+ The Yoast WooCommerce SEO plugin was removing our structured data price fix for variations. This has been solved;
2420
+
2421
  = 7.5.7 =
2422
  Changed the Skroutz template to reflect all changes of last week
2423
 
woocommerce-sea.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: Product Feed PRO for WooCommerce
4
- * Version: 7.5.7
5
  * Plugin URI: https://www.adtribes.io/support/?utm_source=wpadmin&utm_medium=plugin&utm_campaign=woosea_product_feed_pro
6
  * Description: Configure and maintain your WooCommerce product feeds for Google Shopping, Facebook, Remarketing, Bing, Yandex, Comparison shopping websites and over a 100 channels more.
7
  * Author: AdTribes.io
@@ -48,7 +48,7 @@ if (!defined('ABSPATH')) {
48
  * Plugin versionnumber, please do not override.
49
  * Define some constants
50
  */
51
- define( 'WOOCOMMERCESEA_PLUGIN_VERSION', '7.5.7' );
52
  define( 'WOOCOMMERCESEA_PLUGIN_NAME', 'woocommerce-product-feed-pro' );
53
  define( 'WOOCOMMERCESEA_PLUGIN_NAME_SHORT', 'woo-product-feed-pro' );
54
 
@@ -1223,7 +1223,7 @@ function woosea_product_delete_meta_price( $product = null ) {
1223
  $link .= $_SERVER['HTTP_HOST'];
1224
  // Append the requested resource location to the URL
1225
  $link .= $_SERVER['REQUEST_URI'];
1226
-
1227
  if($structured_data_fix == "yes"){
1228
 
1229
  $pr_woo = wc_get_price_to_display($product);
@@ -1342,7 +1342,7 @@ function woosea_product_delete_meta_price( $product = null ) {
1342
  'priceCurrency' => $shop_currency,
1343
  'itemCondition' => 'https://schema.org/'.$json_condition.'',
1344
  'availability' => 'https://schema.org/'.$availability.'',
1345
- 'sku' => $product->get_sku(),
1346
  'image' => wp_get_attachment_url( $product->get_image_id() ),
1347
  'description' => $product->get_description(),
1348
  'seller' => array(
@@ -1539,7 +1539,226 @@ function woosea_product_delete_meta_price( $product = null ) {
1539
  }
1540
  return $markup_offer;
1541
  }
1542
- add_filter( 'woocommerce_structured_data_product_offer', 'woosea_product_delete_meta_price' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1543
 
1544
  /**
1545
  * Get the shipping zone countries and ID's
@@ -3833,7 +4052,7 @@ function woosea_license_valid(){
3833
 
3834
  if(!empty($license_information['license_key'])){
3835
  $curl = curl_init();
3836
- $url = "https://www.adtribes.io/check/license.php?key=$license_information[license_key]&email=$license_information[license_email]&domain=$domain&version=7.5.7";
3837
 
3838
  curl_setopt_array($curl, array(
3839
  CURLOPT_RETURNTRANSFER => 1,
1
  <?php
2
  /**
3
  * Plugin Name: Product Feed PRO for WooCommerce
4
+ * Version: 7.5.8
5
  * Plugin URI: https://www.adtribes.io/support/?utm_source=wpadmin&utm_medium=plugin&utm_campaign=woosea_product_feed_pro
6
  * Description: Configure and maintain your WooCommerce product feeds for Google Shopping, Facebook, Remarketing, Bing, Yandex, Comparison shopping websites and over a 100 channels more.
7
  * Author: AdTribes.io
48
  * Plugin versionnumber, please do not override.
49
  * Define some constants
50
  */
51
+ define( 'WOOCOMMERCESEA_PLUGIN_VERSION', '7.5.8' );
52
  define( 'WOOCOMMERCESEA_PLUGIN_NAME', 'woocommerce-product-feed-pro' );
53
  define( 'WOOCOMMERCESEA_PLUGIN_NAME_SHORT', 'woo-product-feed-pro' );
54
 
1223
  $link .= $_SERVER['HTTP_HOST'];
1224
  // Append the requested resource location to the URL
1225
  $link .= $_SERVER['REQUEST_URI'];
1226
+
1227
  if($structured_data_fix == "yes"){
1228
 
1229
  $pr_woo = wc_get_price_to_display($product);
1342
  'priceCurrency' => $shop_currency,
1343
  'itemCondition' => 'https://schema.org/'.$json_condition.'',
1344
  'availability' => 'https://schema.org/'.$availability.'',
1345
+ 'sku' => $variable_product->get_sku(),
1346
  'image' => wp_get_attachment_url( $product->get_image_id() ),
1347
  'description' => $product->get_description(),
1348
  'seller' => array(
1539
  }
1540
  return $markup_offer;
1541
  }
1542
+ //add_filter( 'woocommerce_structured_data_product_offer', 'woosea_product_delete_meta_price', 1000, 1 );
1543
+
1544
+ /**
1545
+ * Check if Yoast SEO WooCommerce plugin is enabled
1546
+ * If so, remove their product schema filter as it breaks ours
1547
+ */
1548
+ function woosea_check_for_yoast_woocommerce(){
1549
+ if ( class_exists( 'WPSEO_WooCommerce_Schema' ) ) {
1550
+ // When neded we will use this function to remove pieces of Yoast's code
1551
+ }
1552
+ }
1553
+ add_action('plugins_loaded', 'woosea_check_for_yoast_woocommerce');
1554
+
1555
+
1556
+ /**
1557
+ * Fix the WooCommerce schema markup bug for variation prices
1558
+ */
1559
+ function woosea_product_fix_structured_data( $product = null ) {
1560
+ $markup = array();
1561
+
1562
+ if ( ! is_object( $product ) ) {
1563
+ global $product;
1564
+ }
1565
+ if ( ! is_a( $product, 'WC_Product' ) ) {
1566
+ return;
1567
+ }
1568
+
1569
+ $shop_name = get_bloginfo( 'name' );
1570
+ $shop_url = home_url();
1571
+ $currency = get_woocommerce_currency();
1572
+
1573
+ // Sisplay URL of current page.
1574
+ if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') {
1575
+ $link = "https";
1576
+ } else {
1577
+ $link = "http";
1578
+ }
1579
+ // Here append the common URL characters.
1580
+ $link .= "://";
1581
+ // Append the host(domain name, ip) to the URL.
1582
+ $link .= $_SERVER['HTTP_HOST'];
1583
+ // Append the requested resource location to the URL
1584
+ $link .= $_SERVER['REQUEST_URI'];
1585
+
1586
+ $structured_data_fix = get_option ('structured_data_fix');
1587
+
1588
+ // This is an Elite user who enababled the structured data fix
1589
+ if($structured_data_fix == "yes"){
1590
+ // We should first check if there are any _GET parameters available
1591
+ // When there are not we are on a variable product page but not on a specific variable one
1592
+ // In that case we need to put in the AggregateOffer structured data
1593
+ $nr_get = count($_GET);
1594
+
1595
+ if($nr_get > 0){
1596
+ // This is a variable product
1597
+ $mother_id = wc_get_product()->get_id();
1598
+ $children_ids = $product->get_children();
1599
+
1600
+ foreach ($children_ids as &$child_val) {
1601
+ $product_variations = new WC_Product_Variation( $child_val );
1602
+ $variations = array_filter($product_variations->get_variation_attributes());
1603
+ $from_url = str_replace("\\","",$_GET,$i);
1604
+ $intersect = array_intersect($from_url, $variations);
1605
+ if($variations == $intersect){
1606
+ $variation_id = $child_val;
1607
+ }
1608
+ }
1609
+
1610
+ if(isset($variation_id )){
1611
+ $variable_product = wc_get_product($variation_id);
1612
+ }
1613
+
1614
+ if( (isset($variation_id)) AND ( is_object( $variable_product ) ) ) {
1615
+
1616
+ $markup = array(
1617
+ '@type' => 'Product',
1618
+ '@id' => $link . '#product', // Append '#product' to differentiate between this @id and the @id generated for the Breadcrumblist.
1619
+ 'name' => $variable_product->get_name(),
1620
+ 'url' => $link,
1621
+ 'description' => wp_strip_all_tags( do_shortcode( $variable_product->get_short_description() ? $variable_product->get_short_description() : $variable_product->get_description() ) ),
1622
+ );
1623
+ $image = wp_get_attachment_url( $variable_product->get_image_id() );
1624
+ if ( $image ) {
1625
+ $markup['image'] = $image;
1626
+ }
1627
+
1628
+ // Get product brand
1629
+ $brand = get_post_meta( $variation_id, '_woosea_brand', true );
1630
+ if ( $brand ) {
1631
+ $markup['brand'] = array (
1632
+ '@type' => 'Thing',
1633
+ 'name' => $brand,
1634
+ );
1635
+ }
1636
+
1637
+ // Get product MPN
1638
+ $mpn = get_post_meta( $variation_id, '_woosea_mpn', true );
1639
+ if ( $mpn ) {
1640
+ $markup['mpn'] = $mpn;
1641
+ }
1642
+
1643
+ // Declare SKU or fallback to ID.
1644
+ if ( $variable_product->get_sku() ) {
1645
+ $markup['sku'] = $variable_product->get_sku();
1646
+ } else {
1647
+ $markup['sku'] = $variable_product->get_id();
1648
+ }
1649
+ }
1650
+ } else {
1651
+ // This is a simple product
1652
+ $markup = array(
1653
+ '@type' => 'Product',
1654
+ '@id' => $link . '#product', // Append '#product' to differentiate between this @id and the @id generated for the Breadcrumblist.
1655
+ 'name' => $product->get_name(),
1656
+ 'url' => $link,
1657
+ 'description' => wp_strip_all_tags( do_shortcode( $product->get_short_description() ? $product->get_short_description() : $product->get_description() ) ),
1658
+ );
1659
+
1660
+
1661
+ $brand = get_post_meta( $product->get_id(), '_woosea_brand', true );
1662
+ if ( $brand ) {
1663
+ $markup['brand'] = array (
1664
+ '@type' => 'Thing',
1665
+ 'name' => $brand,
1666
+ );
1667
+ }
1668
+
1669
+ // Get product MPN
1670
+ $mpn = get_post_meta( $product->get_id(), '_woosea_mpn', true );
1671
+ if ( $mpn ) {
1672
+ $markup['mpn'] = $mpn;
1673
+ }
1674
+
1675
+ $image = wp_get_attachment_url( $product->get_image_id() );
1676
+ if ( $image ) {
1677
+ $markup['image'] = $image;
1678
+ }
1679
+
1680
+ // Declare SKU or fallback to ID.
1681
+ if ( $product->get_sku() ) {
1682
+ $markup['sku'] = $product->get_sku();
1683
+ } else {
1684
+ $markup['sku'] = $product->get_id();
1685
+ }
1686
+ }
1687
+ } else {
1688
+ // Structured data fix is not enabled
1689
+ $markup = array(
1690
+ '@type' => 'Product',
1691
+ '@id' => $link . '#product', // Append '#product' to differentiate between this @id and the @id generated for the Breadcrumblist.
1692
+ 'name' => $product->get_name(),
1693
+ 'url' => $link,
1694
+ 'description' => wp_strip_all_tags( do_shortcode( $product->get_short_description() ? $product->get_short_description() : $product->get_description() ) ),
1695
+ );
1696
+
1697
+ $image = wp_get_attachment_url( $product->get_image_id() );
1698
+ if ( $image ) {
1699
+ $markup['image'] = $image;
1700
+ }
1701
+
1702
+ // Declare SKU or fallback to ID.
1703
+ if ( $product->get_sku() ) {
1704
+ $markup['sku'] = $product->get_sku();
1705
+ } else {
1706
+ $markup['sku'] = $product->get_id();
1707
+ }
1708
+ }
1709
+
1710
+ // Get the offers structured data schema markup
1711
+ $markup['offers'] = woosea_product_delete_meta_price($product);
1712
+
1713
+ if ( $product->get_rating_count() && wc_review_ratings_enabled() ) {
1714
+ $markup['aggregateRating'] = array(
1715
+ '@type' => 'AggregateRating',
1716
+ 'ratingValue' => $product->get_average_rating(),
1717
+ 'reviewCount' => $product->get_review_count(),
1718
+ );
1719
+
1720
+ // Markup 5 most recent rating/review.
1721
+ $comments = get_comments(
1722
+ array(
1723
+ 'number' => 5,
1724
+ 'post_id' => $product->get_id(),
1725
+ 'status' => 'approve',
1726
+ 'post_status' => 'publish',
1727
+ 'post_type' => 'product',
1728
+ 'parent' => 0,
1729
+ 'meta_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
1730
+ array(
1731
+ 'key' => 'rating',
1732
+ 'type' => 'NUMERIC',
1733
+ 'compare' => '>',
1734
+ 'value' => 0,
1735
+ ),
1736
+ ),
1737
+ )
1738
+ );
1739
+
1740
+ if ( $comments ) {
1741
+ $markup['review'] = array();
1742
+ foreach ( $comments as $comment ) {
1743
+ $markup['review'][] = array(
1744
+ '@type' => 'Review',
1745
+ 'reviewRating' => array(
1746
+ '@type' => 'Rating',
1747
+ 'ratingValue' => get_comment_meta( $comment->comment_ID, 'rating', true ),
1748
+ ),
1749
+ 'author' => array(
1750
+ '@type' => 'Person',
1751
+ 'name' => get_comment_author( $comment ),
1752
+ ),
1753
+ 'reviewBody' => get_comment_text( $comment ),
1754
+ 'datePublished' => get_comment_date( 'c', $comment ),
1755
+ );
1756
+ }
1757
+ }
1758
+ }
1759
+ return $markup;
1760
+ }
1761
+ add_filter( 'woocommerce_structured_data_product', 'woosea_product_fix_structured_data', 2000, 2 );
1762
 
1763
  /**
1764
  * Get the shipping zone countries and ID's
4052
 
4053
  if(!empty($license_information['license_key'])){
4054
  $curl = curl_init();
4055
+ $url = "https://www.adtribes.io/check/license.php?key=$license_information[license_key]&email=$license_information[license_email]&domain=$domain&version=7.5.8";
4056
 
4057
  curl_setopt_array($curl, array(
4058
  CURLOPT_RETURNTRANSFER => 1,