CTX Feed – WooCommerce Product Feed Manager Plugin - Version 4.3.39

Version Description

(2021-03-02) = * Added: Added filter for all product attributes.

Download this release

Release Info

Developer wahid0003
Plugin Icon 128x128 CTX Feed – WooCommerce Product Feed Manager Plugin
Version 4.3.39
Comparing to
See all releases

Code changes from version 4.3.38 to 4.3.39

README.txt CHANGED
@@ -5,7 +5,7 @@ Tags: Product Feed, WooCommerce, Google Shopping, Google Merchant, Facebook Cata
5
  Requires at least: 3.6
6
  Tested Up To: 5.6.1
7
  Requires PHP: 5.6
8
- Stable tag: 4.3.38
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -498,6 +498,9 @@ Using pro version:
498
 
499
  == Changelog ==
500
 
 
 
 
501
  = 4.3.38 (2021-02-28) =
502
  * Tweak: Rakuten.de template updated.
503
 
5
  Requires at least: 3.6
6
  Tested Up To: 5.6.1
7
  Requires PHP: 5.6
8
+ Stable tag: 4.3.39
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
498
 
499
  == Changelog ==
500
 
501
+ = 4.3.39 (2021-03-02) =
502
+ * Added: Added filter for all product attributes.
503
+
504
  = 4.3.38 (2021-02-28) =
505
  * Tweak: Rakuten.de template updated.
506
 
includes/classes/class-woo-feed-products-v3.php CHANGED
@@ -1513,7 +1513,9 @@ class Woo_Feed_Products_v3
1513
  * @since 3.2.0
1514
  */
1515
  protected function id( $product ) {
1516
- return $product->get_id();
 
 
1517
  }
1518
 
1519
  /**
@@ -1526,8 +1528,9 @@ class Woo_Feed_Products_v3
1526
  *
1527
  */
1528
  protected function title( $product ) {
 
1529
 
1530
- return wp_strip_all_tags($this->remove_short_codes($product->get_name()));
1531
  }
1532
 
1533
  /**
@@ -1547,7 +1550,7 @@ class Woo_Feed_Products_v3
1547
  $title = $this->title($product);
1548
  }
1549
 
1550
- return $title;
1551
  }
1552
 
1553
  /**
@@ -1580,10 +1583,12 @@ class Woo_Feed_Products_v3
1580
  $meta_title = $title . ' ' . $sep . ' ' . $site_title;
1581
 
1582
  if ( ! empty($meta_title) ) {
1583
- return $meta_title;
1584
  }
1585
  }elseif ( ! empty($yoast_title) ) {
1586
- return $yoast_title;
 
 
1587
  }
1588
 
1589
  // $title = '';
@@ -1594,7 +1599,7 @@ class Woo_Feed_Products_v3
1594
  // return $title;
1595
  // }
1596
 
1597
- return $this->title($product);
1598
  }
1599
 
1600
  /**
@@ -1627,7 +1632,7 @@ class Woo_Feed_Products_v3
1627
  }
1628
  }
1629
 
1630
- return $rank_title;
1631
  }
1632
 
1633
  /**
@@ -1665,10 +1670,10 @@ class Woo_Feed_Products_v3
1665
  //strip tags and spacial characters
1666
  $strip_description = wp_strip_all_tags(wp_specialchars_decode($description));
1667
 
1668
- return ! empty(strlen($strip_description)) && 0 < strlen($strip_description) ? $strip_description : $description;
1669
  }
1670
 
1671
- return $description;
1672
  }
1673
 
1674
  /**
@@ -1696,7 +1701,7 @@ class Woo_Feed_Products_v3
1696
  }
1697
  }
1698
 
1699
- return $canonical_url;
1700
  }
1701
 
1702
 
@@ -1728,11 +1733,10 @@ class Woo_Feed_Products_v3
1728
  $title = apply_filters('aioseop_title', $title);
1729
  }
1730
  }
1731
- if ( ! empty($title) ) {
1732
- return $title;
1733
- }
1734
 
1735
- return $this->title($product);
 
 
1736
  }
1737
 
1738
  /**
@@ -1745,7 +1749,6 @@ class Woo_Feed_Products_v3
1745
  *
1746
  */
1747
  protected function description( $product ) {
1748
-
1749
  $description = $product->get_description();
1750
 
1751
  // Get Variation Description
@@ -1769,7 +1772,9 @@ class Woo_Feed_Products_v3
1769
  //strip tags and spacial characters
1770
  $strip_description = wp_strip_all_tags(wp_specialchars_decode($description));
1771
 
1772
- return ! empty(strlen($strip_description)) && 0 < strlen($strip_description) ? $strip_description : $description;
 
 
1773
  }
1774
 
1775
  /**
@@ -1787,11 +1792,12 @@ class Woo_Feed_Products_v3
1787
  $description = wpseo_replace_vars(WPSEO_Meta::get_value('metadesc', $product->get_id()),
1788
  get_post($product->get_id()));
1789
  }
1790
- if ( ! empty($description) ) {
1791
- return $description;
 
1792
  }
1793
 
1794
- return $this->description($product);
1795
  }
1796
 
1797
  /**
@@ -1820,11 +1826,12 @@ class Woo_Feed_Products_v3
1820
  $aiosp->apply_description_format($description, get_post($product->get_id())));
1821
  }
1822
  }
1823
- if ( ! empty($description) ) {
1824
- return $description;
 
1825
  }
1826
 
1827
- return $this->description($product);
1828
  }
1829
 
1830
  /**
@@ -1837,7 +1844,6 @@ class Woo_Feed_Products_v3
1837
  *
1838
  */
1839
  protected function short_description( $product ) {
1840
-
1841
  $short_description = $product->get_short_description();
1842
 
1843
  // Get Variation Short Description
@@ -1850,7 +1856,9 @@ class Woo_Feed_Products_v3
1850
  $short_description = $this->remove_short_codes($short_description);
1851
 
1852
  //strip tags and spacial characters
1853
- return wp_strip_all_tags(wp_specialchars_decode($short_description));
 
 
1854
  }
1855
 
1856
 
@@ -1912,7 +1920,9 @@ class Woo_Feed_Products_v3
1912
  }
1913
  }
1914
 
1915
- return $main_category instanceof WP_Term ? $main_category->name : '';
 
 
1916
  }
1917
 
1918
  /**
@@ -1942,7 +1952,9 @@ class Woo_Feed_Products_v3
1942
  }
1943
  }
1944
 
1945
- return $main_category instanceof WP_Term ? $main_category->term_id : '';
 
 
1946
  }
1947
 
1948
  /**
@@ -1958,7 +1970,7 @@ class Woo_Feed_Products_v3
1958
  $last_cat = ! empty($terms) && is_array($terms) ? end($terms) : [];
1959
  $child_category = isset($last_cat->name) && ! empty($last_cat->name) ? $last_cat->name : '';
1960
 
1961
- return $child_category;
1962
  }
1963
 
1964
  /**
@@ -1972,7 +1984,9 @@ class Woo_Feed_Products_v3
1972
  $id = $product->get_id();
1973
  $cat_ids = $product->get_category_ids();
1974
 
1975
- return ! empty($cat_ids) && is_array($cat_ids) ? end($cat_ids) : '';
 
 
1976
  }
1977
 
1978
  /**
@@ -1991,8 +2005,10 @@ class Woo_Feed_Products_v3
1991
  }
1992
 
1993
  $separator = apply_filters('woo_feed_product_type_separator', '>', $this->config, $product);
1994
-
1995
- return woo_feed_get_terms_list_hierarchical_order($id, 'product_cat');
 
 
1996
  }
1997
 
1998
  /**
@@ -2018,7 +2034,9 @@ class Woo_Feed_Products_v3
2018
  return add_query_arg(array_filter($utm), $product->get_permalink());
2019
  }
2020
 
2021
- return $product->get_permalink();
 
 
2022
  }
2023
 
2024
  /**
@@ -2038,7 +2056,7 @@ class Woo_Feed_Products_v3
2038
  $link = $this->link($product);
2039
  }
2040
 
2041
- return $link;
2042
  }
2043
 
2044
  /**
@@ -2047,12 +2065,14 @@ class Woo_Feed_Products_v3
2047
  * @return mixed
2048
  */
2049
  protected function canonical_link( $product ) {
2050
- if ( $product->is_type('variation') ) {
2051
- $product = wc_get_product($product->get_parent_id());
2052
- return $product->get_permalink();
 
 
2053
  }
2054
 
2055
- return $product->get_permalink();
2056
  }
2057
 
2058
  /**
@@ -2065,11 +2085,13 @@ class Woo_Feed_Products_v3
2065
  *
2066
  */
2067
  protected function ex_link( $product ) {
2068
- if ( $product->is_type('external') ) {
2069
- return $product->get_product_url();
 
 
2070
  }
2071
 
2072
- return '';
2073
  }
2074
 
2075
  /**
@@ -2102,7 +2124,7 @@ class Woo_Feed_Products_v3
2102
  endif;
2103
  }
2104
 
2105
- return $image;
2106
  }
2107
 
2108
  /**
@@ -2115,7 +2137,7 @@ class Woo_Feed_Products_v3
2115
  *
2116
  */
2117
  protected function feature_image( $product ) {
2118
- return $this->image($product);
2119
  }
2120
 
2121
  /**
@@ -2139,13 +2161,15 @@ class Woo_Feed_Products_v3
2139
  // Return Specific Additional Image URL
2140
  if ( '' != $additionalImg ) {
2141
  if ( array_key_exists($additionalImg, $imgUrls) ) {
2142
- return $imgUrls[ $additionalImg ];
2143
  } else {
2144
- return '';
2145
  }
 
 
2146
  }
2147
 
2148
- return implode(',', array_filter($imgUrls));
2149
  }
2150
 
2151
  /**
@@ -2194,7 +2218,7 @@ class Woo_Feed_Products_v3
2194
  *
2195
  */
2196
  protected function type( $product ) {
2197
- return $product->get_type();
2198
  }
2199
 
2200
  /**
@@ -2207,11 +2231,13 @@ class Woo_Feed_Products_v3
2207
  *
2208
  */
2209
  protected function is_bundle( $product ) {
2210
- if ( $product->is_type('bundle') || $product->is_type('yith_bundle') ) {
2211
- return 'yes';
 
 
2212
  }
2213
 
2214
- return 'no';
2215
  }
2216
 
2217
  /**
@@ -2242,7 +2268,7 @@ class Woo_Feed_Products_v3
2242
  *
2243
  */
2244
  protected function visibility( $product ) {
2245
- return $product->get_catalog_visibility();
2246
  }
2247
 
2248
  /**
@@ -2255,7 +2281,7 @@ class Woo_Feed_Products_v3
2255
  *
2256
  */
2257
  protected function rating_total( $product ) {
2258
- return $product->get_rating_count();
2259
  }
2260
 
2261
  /**
@@ -2268,7 +2294,7 @@ class Woo_Feed_Products_v3
2268
  *
2269
  */
2270
  protected function rating_average( $product ) {
2271
- return $product->get_average_rating();
2272
  }
2273
 
2274
  /**
@@ -2295,7 +2321,9 @@ class Woo_Feed_Products_v3
2295
  */
2296
  $separator = apply_filters('woo_feed_tags_separator', ',', $this->config, $product);
2297
 
2298
- return wp_strip_all_tags(get_the_term_list($id, 'product_tag', '', $separator, ''));
 
 
2299
  }
2300
 
2301
  /**
@@ -2313,7 +2341,7 @@ class Woo_Feed_Products_v3
2313
  $id = $product->get_parent_id();
2314
  }
2315
 
2316
- return $id;
2317
  }
2318
 
2319
  /**
@@ -2326,7 +2354,7 @@ class Woo_Feed_Products_v3
2326
  *
2327
  */
2328
  protected function sku( $product ) {
2329
- return $product->get_sku();
2330
  }
2331
 
2332
  /**
@@ -2340,8 +2368,9 @@ class Woo_Feed_Products_v3
2340
  */
2341
  protected function sku_id( $product ) {
2342
  $sku = ! empty($product->get_sku()) ? $product->get_sku() . '_' : '';
 
2343
 
2344
- return $sku . $product->get_id();
2345
  }
2346
 
2347
  /**
@@ -2354,14 +2383,16 @@ class Woo_Feed_Products_v3
2354
  *
2355
  */
2356
  protected function parent_sku( $product ) {
2357
- if ( $product->is_type('variation') ) {
2358
- $id = $product->get_parent_id();
2359
- $parent = wc_get_product($id);
2360
 
2361
- return $parent->get_sku();
 
 
2362
  }
2363
 
2364
- return $product->get_sku();
2365
  }
2366
 
2367
  /**
@@ -2376,14 +2407,16 @@ class Woo_Feed_Products_v3
2376
  protected function availability( $product ) {
2377
  $status = $product->get_stock_status();
2378
  if ( 'instock' == $status ) {
2379
- return 'in stock';
2380
  } elseif ( 'outofstock' == $status ) {
2381
- return 'out of stock';
2382
  } elseif ( 'onbackorder' == $status ) {
2383
- return 'on backorder';
2384
  } else {
2385
- return 'in stock';
2386
  }
 
 
2387
  }
2388
 
2389
  /**
@@ -2399,7 +2432,9 @@ class Woo_Feed_Products_v3
2399
  $url = $this->link($product);
2400
  $suffix = 'add-to-cart=' . $product->get_id();
2401
 
2402
- return woo_feed_make_url_with_parameter($url,$suffix);
 
 
2403
  }
2404
 
2405
  /**
@@ -2423,20 +2458,22 @@ class Woo_Feed_Products_v3
2423
  if ( isset($this->config['variable_quantity']) ) {
2424
  $vaQty = $this->config['variable_quantity'];
2425
  if ( 'max' == $vaQty ) {
2426
- return max($qty);
2427
  } elseif ( 'min' == $vaQty ) {
2428
- return min($qty);
2429
  } elseif ( 'sum' == $vaQty ) {
2430
- return array_sum($qty);
2431
  } elseif ( 'first' == $vaQty ) {
2432
- return ( (int)$qty[0]);
2433
  }
2434
 
2435
- return array_sum($qty);
2436
  }
2437
  }
2438
 
2439
- return $product->get_stock_quantity();
 
 
2440
  }
2441
 
2442
  /**
@@ -2450,11 +2487,13 @@ class Woo_Feed_Products_v3
2450
  */
2451
  protected function sale_price_sdate( $product ) {
2452
  $startDate = $product->get_date_on_sale_from();
2453
- if ( is_object($startDate) ) {
2454
- return $startDate->date_i18n();
 
 
2455
  }
2456
 
2457
- return '';
2458
  }
2459
 
2460
  /**
@@ -2468,11 +2507,13 @@ class Woo_Feed_Products_v3
2468
  */
2469
  protected function sale_price_edate( $product ) {
2470
  $endDate = $product->get_date_on_sale_to();
2471
- if ( is_object($endDate) ) {
2472
- return $endDate->date_i18n();
 
 
2473
  }
2474
 
2475
- return '';
2476
  }
2477
 
2478
  /**
@@ -2486,18 +2527,20 @@ class Woo_Feed_Products_v3
2486
  */
2487
  protected function price( $product ) {
2488
  if ( $product->is_type('variable') ) {
2489
- return $this->getVariableProductPrice($product, 'regular_price');
2490
  } elseif ( $product->is_type('grouped') ) {
2491
- return $this->getGroupProductPrice($product,
2492
  'regular'); // this calls self::price() so no need to use self::getWPMLPrice()
2493
  }elseif ( $product->is_type( 'bundle' ) ) {
2494
- return $this->getBundleProductPrice(
2495
  $product,
2496
  'price'
2497
  ); // this calls self::price() so no need to use self::getWPMLPrice()
2498
  } else {
2499
- return $product->get_regular_price();
2500
  }
 
 
2501
  }
2502
 
2503
  /**
@@ -2511,14 +2554,16 @@ class Woo_Feed_Products_v3
2511
  */
2512
  protected function current_price( $product ) {
2513
  if ( $product->is_type('variable') ) {
2514
- return $this->getVariableProductPrice($product, 'price');
2515
  } elseif ( $product->is_type('grouped') ) {
2516
- return $this->getGroupProductPrice($product, 'current');
2517
  } elseif ( $product->is_type( 'bundle' ) ) {
2518
- return $this->getBundleProductPrice( $product, 'price' );
2519
  }else {
2520
- return $product->get_price();
2521
  }
 
 
2522
  }
2523
 
2524
  /**
@@ -2532,16 +2577,18 @@ class Woo_Feed_Products_v3
2532
  */
2533
  protected function sale_price( $product ) {
2534
  if ( $product->is_type('variable') ) {
2535
- return $this->getVariableProductPrice($product, 'sale_price');
2536
  } elseif ( $product->is_type('grouped') ) {
2537
- return $this->getGroupProductPrice($product, 'sale');
2538
  } elseif ( $product->is_type( 'bundle' ) ) {
2539
- return $this->getBundleProductPrice( $product, 'sale_price' );
2540
  } else {
2541
  $price = $product->get_sale_price();
2542
 
2543
- return $price > 0 ? $price : '';
2544
  }
 
 
2545
  }
2546
 
2547
  /**
@@ -2555,16 +2602,18 @@ class Woo_Feed_Products_v3
2555
  */
2556
  protected function price_with_tax( $product ) {
2557
  if ( $product->is_type('variable') ) {
2558
- return $this->getVariableProductPrice($product, 'regular_price', true);
2559
  } elseif ( $product->is_type('grouped') ) {
2560
- return $this->getGroupProductPrice($product, 'regular', true);
2561
  } else {
2562
  $price = $this->price($product);
2563
 
2564
  // Get price with tax.
2565
- return ($product->is_taxable() && ! empty($price)) ? $this->get_price_with_tax($product,
2566
  $price) : $price;
2567
  }
 
 
2568
  }
2569
 
2570
  /**
@@ -2578,16 +2627,18 @@ class Woo_Feed_Products_v3
2578
  */
2579
  protected function current_price_with_tax( $product ) {
2580
  if ( $product->is_type('variable') ) {
2581
- return $this->getVariableProductPrice($product, 'current_price', true);
2582
  } elseif ( $product->is_type('grouped') ) {
2583
- return $this->getGroupProductPrice($product, 'current', true);
2584
  } else {
2585
  $price = $this->current_price($product);
2586
 
2587
  // Get price with tax
2588
- return ($product->is_taxable() && ! empty($price)) ? $this->get_price_with_tax($product,
2589
  $price) : $price;
2590
  }
 
 
2591
  }
2592
 
2593
  /**
@@ -2601,17 +2652,19 @@ class Woo_Feed_Products_v3
2601
  */
2602
  protected function sale_price_with_tax( $product ) {
2603
  if ( $product->is_type('variable') ) {
2604
- return $this->getVariableProductPrice($product, 'sale_price', true);
2605
  } elseif ( $product->is_type('grouped') ) {
2606
- return $this->getGroupProductPrice($product, 'sale', true);
2607
  } else {
2608
  $price = $this->sale_price($product);
2609
  if ( $product->is_taxable() && ! empty($price) ) {
2610
  $price = $this->get_price_with_tax($product, $price);
2611
  }
2612
 
2613
- return $price > 0 ? $price : '';
2614
  }
 
 
2615
  }
2616
 
2617
  /**
@@ -2758,7 +2811,7 @@ class Woo_Feed_Products_v3
2758
  *
2759
  */
2760
  protected function weight( $product ) {
2761
- return $product->get_weight();
2762
  }
2763
 
2764
  /**
@@ -2771,7 +2824,7 @@ class Woo_Feed_Products_v3
2771
  *
2772
  */
2773
  protected function weight_unit( $product ) {
2774
- return get_option('woocommerce_weight_unit');
2775
  }
2776
 
2777
  /**
@@ -2784,7 +2837,7 @@ class Woo_Feed_Products_v3
2784
  *
2785
  */
2786
  protected function width( $product ) {
2787
- return $product->get_width();
2788
  }
2789
 
2790
  /**
@@ -2797,7 +2850,7 @@ class Woo_Feed_Products_v3
2797
  *
2798
  */
2799
  protected function height( $product ) {
2800
- return $product->get_height();
2801
  }
2802
 
2803
  /**
@@ -2810,7 +2863,7 @@ class Woo_Feed_Products_v3
2810
  *
2811
  */
2812
  protected function length( $product ) {
2813
- return $product->get_length();
2814
  }
2815
 
2816
  /**
@@ -2829,7 +2882,7 @@ class Woo_Feed_Products_v3
2829
  $feedBody .= $get_shipping->get_google_shipping();
2830
  }
2831
 
2832
- return $feedBody;
2833
 
2834
  }
2835
 
@@ -2844,7 +2897,8 @@ class Woo_Feed_Products_v3
2844
  */
2845
  protected function shipping_cost( $product ) {
2846
  $shipping_obj = new Woo_Feed_Shipping($product, $this->config);
2847
- return $shipping_obj->get_lowest_shipping_price();
 
2848
  }
2849
 
2850
  /**
@@ -2857,7 +2911,7 @@ class Woo_Feed_Products_v3
2857
  *
2858
  */
2859
  protected function shipping_class( $product ) {
2860
- return $product->get_shipping_class();
2861
  }
2862
 
2863
  /**
@@ -2900,7 +2954,9 @@ class Woo_Feed_Products_v3
2900
  *
2901
  */
2902
  protected function date_created( $product ) {
2903
- return gmdate('Y-m-d', strtotime($product->get_date_created()));
 
 
2904
  }
2905
 
2906
  /**
@@ -2913,7 +2969,9 @@ class Woo_Feed_Products_v3
2913
  *
2914
  */
2915
  protected function date_updated( $product ) {
2916
- return gmdate('Y-m-d', strtotime($product->get_date_modified()));
 
 
2917
  }
2918
 
2919
  /**
@@ -2931,7 +2989,7 @@ class Woo_Feed_Products_v3
2931
  $feedBody .= $shipping_obj->get_google_tax();
2932
  }
2933
 
2934
- return $feedBody;
2935
  }
2936
 
2937
  /**
@@ -2940,7 +2998,7 @@ class Woo_Feed_Products_v3
2940
  * @return string
2941
  */
2942
  protected function tax_class( $product ) {
2943
- return $product->get_tax_class();
2944
  }
2945
 
2946
  /**
@@ -2949,7 +3007,7 @@ class Woo_Feed_Products_v3
2949
  * @return string
2950
  */
2951
  protected function tax_status( $product ) {
2952
- return $product->get_tax_status();
2953
  }
2954
 
2955
  /**
@@ -3042,10 +3100,12 @@ class Woo_Feed_Products_v3
3042
  $value = $product->get_attribute( $attr );
3043
  }
3044
 
3045
- return $value;
3046
  } else {
3047
- return implode(',', wc_get_product_terms($id, $attr, array( 'fields' => 'names' )));
3048
  }
 
 
3049
  }
3050
 
3051
  /**
@@ -3065,7 +3125,7 @@ class Woo_Feed_Products_v3
3065
  $value = get_post_meta($product->get_parent_id(), $meta, true);
3066
  }
3067
 
3068
- return $value;
3069
  }
3070
 
3071
  /**
@@ -3099,7 +3159,9 @@ class Woo_Feed_Products_v3
3099
 
3100
  $separator = apply_filters('woo_feed_product_taxonomy_term_list_separator', ',', $this->config, $product);
3101
 
3102
- return wp_strip_all_tags(get_the_term_list($id, $taxonomy, '', $separator, ''));
 
 
3103
  }
3104
 
3105
  /**
1513
  * @since 3.2.0
1514
  */
1515
  protected function id( $product ) {
1516
+ $id = $product->get_id();
1517
+
1518
+ return apply_filters('woo_feed_filter_product_id', $id, $product, $this->config);
1519
  }
1520
 
1521
  /**
1528
  *
1529
  */
1530
  protected function title( $product ) {
1531
+ $title = wp_strip_all_tags($this->remove_short_codes($product->get_name()));
1532
 
1533
+ return apply_filters('woo_feed_filter_product_title', $title, $product, $this->config);
1534
  }
1535
 
1536
  /**
1550
  $title = $this->title($product);
1551
  }
1552
 
1553
+ return apply_filters('woo_feed_filter_product_parent_title', $title, $product, $this->config);
1554
  }
1555
 
1556
  /**
1583
  $meta_title = $title . ' ' . $sep . ' ' . $site_title;
1584
 
1585
  if ( ! empty($meta_title) ) {
1586
+ $title = $meta_title;
1587
  }
1588
  }elseif ( ! empty($yoast_title) ) {
1589
+ $title = $yoast_title;
1590
+ }else {
1591
+ $title = $this->title( $product );
1592
  }
1593
 
1594
  // $title = '';
1599
  // return $title;
1600
  // }
1601
 
1602
+ return apply_filters('woo_feed_filter_product_yoast_wpseo_title', $title, $product, $this->config);
1603
  }
1604
 
1605
  /**
1632
  }
1633
  }
1634
 
1635
+ return apply_filters('woo_feed_filter_product_rank_math_title', $rank_title, $product, $this->config);
1636
  }
1637
 
1638
  /**
1670
  //strip tags and spacial characters
1671
  $strip_description = wp_strip_all_tags(wp_specialchars_decode($description));
1672
 
1673
+ $description = ! empty(strlen($strip_description)) && 0 < strlen($strip_description) ? $strip_description : $description;
1674
  }
1675
 
1676
+ return apply_filters('woo_feed_filter_product_rank_math_description', $description, $product, $this->config);
1677
  }
1678
 
1679
  /**
1701
  }
1702
  }
1703
 
1704
+ return apply_filters('woo_feed_filter_product_rank_math_canonical_url', $canonical_url, $product, $this->config);
1705
  }
1706
 
1707
 
1733
  $title = apply_filters('aioseop_title', $title);
1734
  }
1735
  }
 
 
 
1736
 
1737
+ $title = !empty( $title ) ? $title : $this->title( $product );
1738
+
1739
+ return apply_filters('woo_feed_filter_product_aioseop_title', $title, $product, $this->config);
1740
  }
1741
 
1742
  /**
1749
  *
1750
  */
1751
  protected function description( $product ) {
 
1752
  $description = $product->get_description();
1753
 
1754
  // Get Variation Description
1772
  //strip tags and spacial characters
1773
  $strip_description = wp_strip_all_tags(wp_specialchars_decode($description));
1774
 
1775
+ $description = ! empty(strlen($strip_description)) && 0 < strlen($strip_description) ? $strip_description : $description;
1776
+
1777
+ return apply_filters('woo_feed_filter_product_description', $description, $product, $this->config);
1778
  }
1779
 
1780
  /**
1792
  $description = wpseo_replace_vars(WPSEO_Meta::get_value('metadesc', $product->get_id()),
1793
  get_post($product->get_id()));
1794
  }
1795
+
1796
+ if ( empty($description) ) {
1797
+ $description = $this->description($product);
1798
  }
1799
 
1800
+ return apply_filters('woo_feed_filter_product_yoast_wpseo_metadesc', $description, $product, $this->config);
1801
  }
1802
 
1803
  /**
1826
  $aiosp->apply_description_format($description, get_post($product->get_id())));
1827
  }
1828
  }
1829
+
1830
+ if ( empty( $description ) ) {
1831
+ $description = $this->description( $product );
1832
  }
1833
 
1834
+ return apply_filters('woo_feed_filter_product_aioseop_description', $description, $product, $this->config);
1835
  }
1836
 
1837
  /**
1844
  *
1845
  */
1846
  protected function short_description( $product ) {
 
1847
  $short_description = $product->get_short_description();
1848
 
1849
  // Get Variation Short Description
1856
  $short_description = $this->remove_short_codes($short_description);
1857
 
1858
  //strip tags and spacial characters
1859
+ $short_description = wp_strip_all_tags(wp_specialchars_decode($short_description));
1860
+
1861
+ return apply_filters('woo_feed_filter_product_short_description', $short_description, $product, $this->config);
1862
  }
1863
 
1864
 
1920
  }
1921
  }
1922
 
1923
+ $category = $main_category instanceof WP_Term ? $main_category->name : '';
1924
+
1925
+ return apply_filters('woo_feed_filter_product_primary_category', $category, $product, $this->config);
1926
  }
1927
 
1928
  /**
1952
  }
1953
  }
1954
 
1955
+ $category_id = $main_category instanceof WP_Term ? $main_category->term_id : '';
1956
+
1957
+ return apply_filters('woo_feed_filter_product_primary_category_id', $category_id, $product, $this->config);
1958
  }
1959
 
1960
  /**
1970
  $last_cat = ! empty($terms) && is_array($terms) ? end($terms) : [];
1971
  $child_category = isset($last_cat->name) && ! empty($last_cat->name) ? $last_cat->name : '';
1972
 
1973
+ return apply_filters('woo_feed_filter_product_child_category', $child_category, $product, $this->config);
1974
  }
1975
 
1976
  /**
1984
  $id = $product->get_id();
1985
  $cat_ids = $product->get_category_ids();
1986
 
1987
+ $child_category_id = ! empty($cat_ids) && is_array($cat_ids) ? end($cat_ids) : '';
1988
+
1989
+ return apply_filters('woo_feed_filter_product_child_category_id', $child_category_id, $product, $this->config);
1990
  }
1991
 
1992
  /**
2005
  }
2006
 
2007
  $separator = apply_filters('woo_feed_product_type_separator', '>', $this->config, $product);
2008
+
2009
+ $product_type = woo_feed_get_terms_list_hierarchical_order($id, 'product_cat');
2010
+
2011
+ return apply_filters('woo_feed_filter_product_local_category', $product_type, $product, $this->config);
2012
  }
2013
 
2014
  /**
2034
  return add_query_arg(array_filter($utm), $product->get_permalink());
2035
  }
2036
 
2037
+ $link = $product->get_permalink();
2038
+
2039
+ return apply_filters('woo_feed_filter_product_link', $link, $product, $this->config);
2040
  }
2041
 
2042
  /**
2056
  $link = $this->link($product);
2057
  }
2058
 
2059
+ return apply_filters('woo_feed_filter_product_parent_link', $link, $product, $this->config);
2060
  }
2061
 
2062
  /**
2065
  * @return mixed
2066
  */
2067
  protected function canonical_link( $product ) {
2068
+ if ( $product->is_type( 'variation' ) ) {
2069
+ $product = wc_get_product( $product->get_parent_id() );
2070
+ $canonical_link = $product->get_permalink();
2071
+ }else {
2072
+ $canonical_link = $product->get_permalink();
2073
  }
2074
 
2075
+ return apply_filters('woo_feed_filter_product_canonical_link', $canonical_link, $product, $this->config);
2076
  }
2077
 
2078
  /**
2085
  *
2086
  */
2087
  protected function ex_link( $product ) {
2088
+ if ( $product->is_type( 'external' ) ) {
2089
+ $ex_link = $product->get_product_url();
2090
+ }else {
2091
+ $ex_link = '';
2092
  }
2093
 
2094
+ return apply_filters('woo_feed_filter_product_ex_link', $ex_link, $product, $this->config);
2095
  }
2096
 
2097
  /**
2124
  endif;
2125
  }
2126
 
2127
+ return apply_filters('woo_feed_filter_product_image', $image, $product, $this->config);
2128
  }
2129
 
2130
  /**
2137
  *
2138
  */
2139
  protected function feature_image( $product ) {
2140
+ return apply_filters('woo_feed_filter_product_feature_image', $this->image( $product ), $product, $this->config);
2141
  }
2142
 
2143
  /**
2161
  // Return Specific Additional Image URL
2162
  if ( '' != $additionalImg ) {
2163
  if ( array_key_exists($additionalImg, $imgUrls) ) {
2164
+ $images = $imgUrls[ $additionalImg ];
2165
  } else {
2166
+ $images = '';
2167
  }
2168
+ }else {
2169
+ $images = implode( ',', array_filter( $imgUrls ) );
2170
  }
2171
 
2172
+ return apply_filters('woo_feed_filter_product_images', $images, $product, $this->config);
2173
  }
2174
 
2175
  /**
2218
  *
2219
  */
2220
  protected function type( $product ) {
2221
+ return apply_filters('woo_feed_filter_product_type', $product->get_type(), $product, $this->config);
2222
  }
2223
 
2224
  /**
2231
  *
2232
  */
2233
  protected function is_bundle( $product ) {
2234
+ if ( $product->is_type( 'bundle' ) || $product->is_type( 'yith_bundle' ) ) {
2235
+ $is_bundle = 'yes';
2236
+ }else {
2237
+ $is_bundle = 'no';
2238
  }
2239
 
2240
+ return apply_filters('woo_feed_filter_product_is_bundle', $is_bundle, $product, $this->config);
2241
  }
2242
 
2243
  /**
2268
  *
2269
  */
2270
  protected function visibility( $product ) {
2271
+ return apply_filters('woo_feed_filter_product_visibility', $product->get_catalog_visibility(), $product, $this->config);
2272
  }
2273
 
2274
  /**
2281
  *
2282
  */
2283
  protected function rating_total( $product ) {
2284
+ return apply_filters('woo_feed_filter_product_rating_total', $product->get_rating_count(), $product, $this->config);
2285
  }
2286
 
2287
  /**
2294
  *
2295
  */
2296
  protected function rating_average( $product ) {
2297
+ return apply_filters('woo_feed_filter_product_rating_average', $product->get_average_rating(), $product, $this->config);
2298
  }
2299
 
2300
  /**
2321
  */
2322
  $separator = apply_filters('woo_feed_tags_separator', ',', $this->config, $product);
2323
 
2324
+ $tags = wp_strip_all_tags(get_the_term_list($id, 'product_tag', '', $separator, ''));
2325
+
2326
+ return apply_filters('woo_feed_filter_product_tags', $tags, $product, $this->config);
2327
  }
2328
 
2329
  /**
2341
  $id = $product->get_parent_id();
2342
  }
2343
 
2344
+ return apply_filters('woo_feed_filter_product_item_group_id', $id, $product, $this->config);
2345
  }
2346
 
2347
  /**
2354
  *
2355
  */
2356
  protected function sku( $product ) {
2357
+ return apply_filters('woo_feed_filter_product_sku', $product->get_sku(), $product, $this->config);
2358
  }
2359
 
2360
  /**
2368
  */
2369
  protected function sku_id( $product ) {
2370
  $sku = ! empty($product->get_sku()) ? $product->get_sku() . '_' : '';
2371
+ $sku_id = $sku . $product->get_id();
2372
 
2373
+ return apply_filters('woo_feed_filter_product_sku_id', $sku_id, $product, $this->config);
2374
  }
2375
 
2376
  /**
2383
  *
2384
  */
2385
  protected function parent_sku( $product ) {
2386
+ if ( $product->is_type( 'variation' ) ) {
2387
+ $id = $product->get_parent_id();
2388
+ $parent = wc_get_product( $id );
2389
 
2390
+ $parent_sku = $parent->get_sku();
2391
+ }else {
2392
+ $parent_sku = $product->get_sku();
2393
  }
2394
 
2395
+ return apply_filters('woo_feed_filter_product_parent_sku', $parent_sku, $product, $this->config);
2396
  }
2397
 
2398
  /**
2407
  protected function availability( $product ) {
2408
  $status = $product->get_stock_status();
2409
  if ( 'instock' == $status ) {
2410
+ $availability = 'in stock';
2411
  } elseif ( 'outofstock' == $status ) {
2412
+ $availability = 'out of stock';
2413
  } elseif ( 'onbackorder' == $status ) {
2414
+ $availability = 'on backorder';
2415
  } else {
2416
+ $availability = 'in stock';
2417
  }
2418
+
2419
+ return apply_filters('woo_feed_filter_product_availability', $availability, $product, $this->config);
2420
  }
2421
 
2422
  /**
2432
  $url = $this->link($product);
2433
  $suffix = 'add-to-cart=' . $product->get_id();
2434
 
2435
+ $add_to_cart_link = woo_feed_make_url_with_parameter($url,$suffix);
2436
+
2437
+ return apply_filters('woo_feed_filter_product_add_to_cart_link', $add_to_cart_link, $product, $this->config);
2438
  }
2439
 
2440
  /**
2458
  if ( isset($this->config['variable_quantity']) ) {
2459
  $vaQty = $this->config['variable_quantity'];
2460
  if ( 'max' == $vaQty ) {
2461
+ $quantity = max($qty);
2462
  } elseif ( 'min' == $vaQty ) {
2463
+ $quantity = min($qty);
2464
  } elseif ( 'sum' == $vaQty ) {
2465
+ $quantity = array_sum($qty);
2466
  } elseif ( 'first' == $vaQty ) {
2467
+ $quantity = ( (int)$qty[0]);
2468
  }
2469
 
2470
+ $quantity = array_sum($qty);
2471
  }
2472
  }
2473
 
2474
+ $quantity = $product->get_stock_quantity();
2475
+
2476
+ return apply_filters('woo_feed_filter_product_quantity', $quantity, $product, $this->config);
2477
  }
2478
 
2479
  /**
2487
  */
2488
  protected function sale_price_sdate( $product ) {
2489
  $startDate = $product->get_date_on_sale_from();
2490
+ if ( is_object( $startDate ) ) {
2491
+ $sale_price_sdate = $startDate->date_i18n();
2492
+ }else {
2493
+ $sale_price_sdate = '';
2494
  }
2495
 
2496
+ return apply_filters('woo_feed_filter_product_sale_price_sdate', $sale_price_sdate, $product, $this->config);
2497
  }
2498
 
2499
  /**
2507
  */
2508
  protected function sale_price_edate( $product ) {
2509
  $endDate = $product->get_date_on_sale_to();
2510
+ if ( is_object( $endDate ) ) {
2511
+ $sale_price_edate = $endDate->date_i18n();
2512
+ }else {
2513
+ $sale_price_edate = "";
2514
  }
2515
 
2516
+ return apply_filters('woo_feed_filter_product_sale_price_edate', $sale_price_edate, $product, $this->config);
2517
  }
2518
 
2519
  /**
2527
  */
2528
  protected function price( $product ) {
2529
  if ( $product->is_type('variable') ) {
2530
+ $price = $this->getVariableProductPrice($product, 'regular_price');
2531
  } elseif ( $product->is_type('grouped') ) {
2532
+ $price = $this->getGroupProductPrice($product,
2533
  'regular'); // this calls self::price() so no need to use self::getWPMLPrice()
2534
  }elseif ( $product->is_type( 'bundle' ) ) {
2535
+ $price = $this->getBundleProductPrice(
2536
  $product,
2537
  'price'
2538
  ); // this calls self::price() so no need to use self::getWPMLPrice()
2539
  } else {
2540
+ $price = $product->get_regular_price();
2541
  }
2542
+
2543
+ return apply_filters('woo_feed_filter_product_price', $price, $product, $this->config);
2544
  }
2545
 
2546
  /**
2554
  */
2555
  protected function current_price( $product ) {
2556
  if ( $product->is_type('variable') ) {
2557
+ $current_price = $this->getVariableProductPrice($product, 'price');
2558
  } elseif ( $product->is_type('grouped') ) {
2559
+ $current_price = $this->getGroupProductPrice($product, 'current');
2560
  } elseif ( $product->is_type( 'bundle' ) ) {
2561
+ $current_price = $this->getBundleProductPrice( $product, 'price' );
2562
  }else {
2563
+ $current_price = $product->get_price();
2564
  }
2565
+
2566
+ return apply_filters('woo_feed_filter_product_regular_price', $current_price, $product, $this->config);
2567
  }
2568
 
2569
  /**
2577
  */
2578
  protected function sale_price( $product ) {
2579
  if ( $product->is_type('variable') ) {
2580
+ $sale_price = $this->getVariableProductPrice($product, 'sale_price');
2581
  } elseif ( $product->is_type('grouped') ) {
2582
+ $sale_price = $this->getGroupProductPrice($product, 'sale');
2583
  } elseif ( $product->is_type( 'bundle' ) ) {
2584
+ $sale_price = $this->getBundleProductPrice( $product, 'sale_price' );
2585
  } else {
2586
  $price = $product->get_sale_price();
2587
 
2588
+ $sale_price = $price > 0 ? $price : '';
2589
  }
2590
+
2591
+ return apply_filters('woo_feed_filter_product_sale_price', $sale_price, $product, $this->config);
2592
  }
2593
 
2594
  /**
2602
  */
2603
  protected function price_with_tax( $product ) {
2604
  if ( $product->is_type('variable') ) {
2605
+ $price_with_tax = $this->getVariableProductPrice($product, 'regular_price', true);
2606
  } elseif ( $product->is_type('grouped') ) {
2607
+ $price_with_tax = $this->getGroupProductPrice($product, 'regular', true);
2608
  } else {
2609
  $price = $this->price($product);
2610
 
2611
  // Get price with tax.
2612
+ $price_with_tax = ($product->is_taxable() && ! empty($price)) ? $this->get_price_with_tax($product,
2613
  $price) : $price;
2614
  }
2615
+
2616
+ return apply_filters('woo_feed_filter_product_price_with_tax', $price_with_tax, $product, $this->config);
2617
  }
2618
 
2619
  /**
2627
  */
2628
  protected function current_price_with_tax( $product ) {
2629
  if ( $product->is_type('variable') ) {
2630
+ $current_price_with_tax = $this->getVariableProductPrice($product, 'current_price', true);
2631
  } elseif ( $product->is_type('grouped') ) {
2632
+ $current_price_with_tax = $this->getGroupProductPrice($product, 'current', true);
2633
  } else {
2634
  $price = $this->current_price($product);
2635
 
2636
  // Get price with tax
2637
+ $current_price_with_tax = ($product->is_taxable() && ! empty($price)) ? $this->get_price_with_tax($product,
2638
  $price) : $price;
2639
  }
2640
+
2641
+ return apply_filters('woo_feed_filter_product_regular_price_with_tax', $current_price_with_tax, $product, $this->config);
2642
  }
2643
 
2644
  /**
2652
  */
2653
  protected function sale_price_with_tax( $product ) {
2654
  if ( $product->is_type('variable') ) {
2655
+ $sale_price_with_tax = $this->getVariableProductPrice($product, 'sale_price', true);
2656
  } elseif ( $product->is_type('grouped') ) {
2657
+ $sale_price_with_tax = $this->getGroupProductPrice($product, 'sale', true);
2658
  } else {
2659
  $price = $this->sale_price($product);
2660
  if ( $product->is_taxable() && ! empty($price) ) {
2661
  $price = $this->get_price_with_tax($product, $price);
2662
  }
2663
 
2664
+ $sale_price_with_tax = $price > 0 ? $price : '';
2665
  }
2666
+
2667
+ return apply_filters('woo_feed_filter_product_sale_price_with_tax', $sale_price_with_tax, $product, $this->config);
2668
  }
2669
 
2670
  /**
2811
  *
2812
  */
2813
  protected function weight( $product ) {
2814
+ return apply_filters('woo_feed_filter_product_weight', $product->get_weight(), $product, $this->config);
2815
  }
2816
 
2817
  /**
2824
  *
2825
  */
2826
  protected function weight_unit( $product ) {
2827
+ return apply_filters('woo_feed_filter_product_weight_unit', get_option('woocommerce_weight_unit'), $product, $this->config);
2828
  }
2829
 
2830
  /**
2837
  *
2838
  */
2839
  protected function width( $product ) {
2840
+ return apply_filters('woo_feed_filter_product_width', $product->get_width(), $product, $this->config);
2841
  }
2842
 
2843
  /**
2850
  *
2851
  */
2852
  protected function height( $product ) {
2853
+ return apply_filters('woo_feed_filter_product_height', $product->get_height(), $product, $this->config);
2854
  }
2855
 
2856
  /**
2863
  *
2864
  */
2865
  protected function length( $product ) {
2866
+ return apply_filters('woo_feed_filter_product_length', $product->get_length(), $product, $this->config);
2867
  }
2868
 
2869
  /**
2882
  $feedBody .= $get_shipping->get_google_shipping();
2883
  }
2884
 
2885
+ return apply_filters('woo_feed_filter_product_shipping', $feedBody, $product, $this->config);
2886
 
2887
  }
2888
 
2897
  */
2898
  protected function shipping_cost( $product ) {
2899
  $shipping_obj = new Woo_Feed_Shipping($product, $this->config);
2900
+
2901
+ return apply_filters('woo_feed_filter_product_shipping_cost', $shipping_obj->get_lowest_shipping_price(), $product, $this->config);
2902
  }
2903
 
2904
  /**
2911
  *
2912
  */
2913
  protected function shipping_class( $product ) {
2914
+ return apply_filters('woo_feed_filter_product_shipping_class', $product->get_shipping_class(), $product, $this->config);
2915
  }
2916
 
2917
  /**
2954
  *
2955
  */
2956
  protected function date_created( $product ) {
2957
+ $date_created = gmdate('Y-m-d', strtotime($product->get_date_created()));
2958
+
2959
+ return apply_filters('woo_feed_filter_product_date_created', $date_created, $product, $this->config);
2960
  }
2961
 
2962
  /**
2969
  *
2970
  */
2971
  protected function date_updated( $product ) {
2972
+ $date_updated = gmdate('Y-m-d', strtotime($product->get_date_modified()));
2973
+
2974
+ return apply_filters('woo_feed_filter_product_date_updated', $date_updated, $product, $this->config);
2975
  }
2976
 
2977
  /**
2989
  $feedBody .= $shipping_obj->get_google_tax();
2990
  }
2991
 
2992
+ return apply_filters('woo_feed_filter_product_tax', $feedBody, $product, $this->config);
2993
  }
2994
 
2995
  /**
2998
  * @return string
2999
  */
3000
  protected function tax_class( $product ) {
3001
+ return apply_filters('woo_feed_filter_product_tax_class', $product->get_tax_class(), $product, $this->config);
3002
  }
3003
 
3004
  /**
3007
  * @return string
3008
  */
3009
  protected function tax_status( $product ) {
3010
+ return apply_filters('woo_feed_filter_product_tax_status', $product->get_tax_status(), $product, $this->config);
3011
  }
3012
 
3013
  /**
3100
  $value = $product->get_attribute( $attr );
3101
  }
3102
 
3103
+ $getproductattribute = $value;
3104
  } else {
3105
+ $getproductattribute = implode(',', wc_get_product_terms($id, $attr, array( 'fields' => 'names' )));
3106
  }
3107
+
3108
+ return apply_filters('woo_feed_filter_product_attribute', $getproductattribute, $product, $this->config);
3109
  }
3110
 
3111
  /**
3125
  $value = get_post_meta($product->get_parent_id(), $meta, true);
3126
  }
3127
 
3128
+ return apply_filters('woo_feed_filter_product_meta', $value, $product, $this->config);
3129
  }
3130
 
3131
  /**
3159
 
3160
  $separator = apply_filters('woo_feed_product_taxonomy_term_list_separator', ',', $this->config, $product);
3161
 
3162
+ $getproducttaxonomy = wp_strip_all_tags(get_the_term_list($id, $taxonomy, '', $separator, ''));
3163
+
3164
+ return apply_filters('woo_feed_filter_product_taxonomy', $getproducttaxonomy, $product, $this->config);
3165
  }
3166
 
3167
  /**
woo-feed.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: CTX Feed
11
  * Plugin URI: https://webappick.com/
12
  * Description: Easily generate woocommerce product feed for any marketing channel like Google Shopping(Merchant), Facebook Remarketing, Bing, eBay & more. Support 100+ Merchants.
13
- * Version: 4.3.38
14
  * Author: WebAppick
15
  * Author URI: https://webappick.com/
16
  * License: GPL v2
@@ -38,7 +38,7 @@ if ( ! defined( 'WOO_FEED_FREE_VERSION' ) ) {
38
  * @var string
39
  * @since 3.1.6
40
  */
41
- define( 'WOO_FEED_FREE_VERSION', '4.3.38' );
42
  }
43
 
44
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
10
  * Plugin Name: CTX Feed
11
  * Plugin URI: https://webappick.com/
12
  * Description: Easily generate woocommerce product feed for any marketing channel like Google Shopping(Merchant), Facebook Remarketing, Bing, eBay & more. Support 100+ Merchants.
13
+ * Version: 4.3.39
14
  * Author: WebAppick
15
  * Author URI: https://webappick.com/
16
  * License: GPL v2
38
  * @var string
39
  * @since 3.1.6
40
  */
41
+ define( 'WOO_FEED_FREE_VERSION', '4.3.39' );
42
  }
43
 
44
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {