Booster for WooCommerce - Version 5.3.4

Version Description

  • 06/10/2020 =
  • Fix - Improper replacement of get_option() by wcj_option().
  • Fix - SHIPPING & ORDERS - Custom Shipping - Created custom shipping name as null.
  • Fix - Undefined index: weight_table_total_rows.
  • Dev - PRICES & CURRENCIES - Multicurrency (Currency Switcher) - Default currency - Add 'Currency' and 'Force' options.
Download this release

Release Info

Developer pluggabl
Plugin Icon 128x128 Booster for WooCommerce
Version 5.3.4
Comparing to
See all releases

Code changes from version 5.3.2 to 5.3.4

Files changed (259) hide show
  1. includes/add-to-cart/class-wcj-add-to-cart-per-category.php +5 -5
  2. includes/add-to-cart/class-wcj-add-to-cart-per-product-type.php +7 -7
  3. includes/add-to-cart/class-wcj-add-to-cart-per-product.php +1 -1
  4. includes/admin/class-wc-settings-jetpack.php +33 -10
  5. includes/admin/class-wcj-settings-custom-fields.php +4 -4
  6. includes/admin/class-wcj-settings-manager.php +2 -2
  7. includes/admin/class-wcj-tools.php +1 -1
  8. includes/class-wcj-add-to-cart-button-visibility.php +15 -15
  9. includes/class-wcj-address-formats.php +2 -2
  10. includes/class-wcj-admin-bar.php +7 -7
  11. includes/class-wcj-admin-orders-list.php +34 -34
  12. includes/class-wcj-admin-products-list.php +9 -9
  13. includes/class-wcj-admin-tools.php +10 -10
  14. includes/class-wcj-breadcrumbs.php +3 -3
  15. includes/class-wcj-call-for-price.php +12 -12
  16. includes/class-wcj-cart-customization.php +8 -8
  17. includes/class-wcj-cart.php +7 -7
  18. includes/class-wcj-checkout-core-fields.php +14 -14
  19. includes/class-wcj-checkout-custom-fields.php +80 -75
  20. includes/class-wcj-checkout-custom-info.php +6 -6
  21. includes/class-wcj-checkout-customization.php +25 -25
  22. includes/class-wcj-checkout-fees.php +21 -21
  23. includes/class-wcj-checkout-files-upload.php +63 -63
  24. includes/class-wcj-coupon-by-user-role.php +3 -3
  25. includes/class-wcj-coupon-code-generator.php +3 -3
  26. includes/class-wcj-cross-sells.php +11 -11
  27. includes/class-wcj-currency-exchange-rates.php +20 -20
  28. includes/class-wcj-currency-external-products.php +2 -2
  29. includes/class-wcj-currency-per-product.php +29 -29
  30. includes/class-wcj-currency.php +9 -9
  31. includes/class-wcj-custom-css.php +8 -8
  32. includes/class-wcj-custom-js.php +6 -6
  33. includes/class-wcj-custom-php.php +1 -1
  34. includes/class-wcj-debug-tools.php +1 -1
  35. includes/class-wcj-email-options.php +7 -7
  36. includes/class-wcj-emails-verification.php +14 -14
  37. includes/class-wcj-emails.php +4 -4
  38. includes/class-wcj-empty-cart-button.php +1 -1
  39. includes/class-wcj-eu-vat-number.php +33 -33
  40. includes/class-wcj-export-import.php +3 -3
  41. includes/class-wcj-free-price.php +5 -5
  42. includes/class-wcj-general.php +12 -12
  43. includes/class-wcj-global-discount.php +36 -36
  44. includes/class-wcj-left-to-free-shipping.php +6 -6
  45. includes/class-wcj-max-products-per-user.php +10 -10
  46. includes/class-wcj-mini-cart.php +6 -6
  47. includes/class-wcj-more-button-labels.php +2 -2
  48. includes/class-wcj-multicurrency-product-base-price.php +16 -16
  49. includes/class-wcj-multicurrency.php +108 -52
  50. includes/class-wcj-my-account.php +33 -33
  51. includes/class-wcj-offer-price.php +28 -28
  52. includes/class-wcj-order-custom-statuses.php +32 -16
  53. includes/class-wcj-order-min-amount.php +13 -13
  54. includes/class-wcj-order-numbers.php +29 -29
  55. includes/class-wcj-order-quantities.php +47 -47
  56. includes/class-wcj-orders.php +13 -13
  57. includes/class-wcj-payment-gateways-by-country.php +9 -9
  58. includes/class-wcj-payment-gateways-by-currency.php +2 -2
  59. includes/class-wcj-payment-gateways-by-shipping.php +1 -1
  60. includes/class-wcj-payment-gateways-by-user-role.php +3 -3
  61. includes/class-wcj-payment-gateways-currency.php +6 -6
  62. includes/class-wcj-payment-gateways-fees.php +16 -16
  63. includes/class-wcj-payment-gateways-icons.php +3 -3
  64. includes/class-wcj-payment-gateways-min-max.php +8 -8
  65. includes/class-wcj-payment-gateways-per-category.php +5 -5
  66. includes/class-wcj-payment-gateways.php +1 -1
  67. includes/class-wcj-pdf-invoicing.php +4 -4
  68. includes/class-wcj-price-by-country.php +6 -6
  69. includes/class-wcj-price-by-user-role.php +29 -29
  70. includes/class-wcj-price-formats.php +14 -14
  71. includes/class-wcj-price-labels.php +14 -14
  72. includes/class-wcj-product-add-to-cart.php +33 -33
  73. includes/class-wcj-product-addons.php +45 -45
  74. includes/class-wcj-product-bookings.php +17 -17
  75. includes/class-wcj-product-bulk-meta-editor.php +3 -3
  76. includes/class-wcj-product-bulk-price-converter.php +1 -1
  77. includes/class-wcj-product-by-country.php +5 -5
  78. includes/class-wcj-product-by-date.php +9 -9
  79. includes/class-wcj-product-by-time.php +5 -5
  80. includes/class-wcj-product-by-user-role.php +1 -1
  81. includes/class-wcj-product-by-user.php +1 -1
  82. includes/class-wcj-product-custom-info.php +12 -12
  83. includes/class-wcj-product-custom-visibility.php +1 -1
  84. includes/class-wcj-product-images.php +16 -16
  85. includes/class-wcj-product-info.php +13 -13
  86. includes/class-wcj-product-input-fields.php +3 -3
  87. includes/class-wcj-product-listings.php +11 -11
  88. includes/class-wcj-product-msrp.php +14 -14
  89. includes/class-wcj-product-open-pricing.php +23 -23
  90. includes/class-wcj-product-price-by-formula.php +14 -14
  91. includes/class-wcj-product-tabs.php +47 -47
  92. includes/class-wcj-products-per-page.php +8 -8
  93. includes/class-wcj-products-xml.php +19 -19
  94. includes/class-wcj-purchase-data.php +12 -12
  95. includes/class-wcj-related-products.php +45 -45
  96. includes/class-wcj-sale-flash.php +12 -12
  97. includes/class-wcj-shipping-by-order-amount.php +3 -3
  98. includes/class-wcj-shipping-by-order-qty.php +3 -3
  99. includes/class-wcj-shipping-by-products.php +4 -4
  100. includes/class-wcj-shipping-by-time.php +1 -1
  101. includes/class-wcj-shipping-by-user-role.php +1 -1
  102. includes/class-wcj-shipping-calculator.php +9 -9
  103. includes/class-wcj-shipping-description.php +4 -4
  104. includes/class-wcj-shipping-icons.php +5 -5
  105. includes/class-wcj-shipping-options.php +8 -8
  106. includes/class-wcj-shipping.php +2 -2
  107. includes/class-wcj-sku.php +36 -36
  108. includes/class-wcj-sorting.php +12 -12
  109. includes/class-wcj-stock.php +20 -20
  110. includes/class-wcj-tax-display.php +10 -10
  111. includes/class-wcj-template-editor.php +5 -5
  112. includes/class-wcj-track-users.php +12 -12
  113. includes/class-wcj-upsells.php +9 -9
  114. includes/class-wcj-url-coupons.php +4 -4
  115. includes/class-wcj-wholesale-price.php +19 -19
  116. includes/class-wcj-wpml.php +5 -5
  117. includes/classes/class-wcj-invoice.php +9 -9
  118. includes/classes/class-wcj-module-product-by-condition.php +21 -21
  119. includes/classes/class-wcj-module-shipping-by-condition.php +2 -2
  120. includes/classes/class-wcj-module.php +30 -27
  121. includes/classes/class-wcj-pdf-invoice.php +22 -22
  122. includes/classes/class-wcj-tcpdf.php +3 -3
  123. includes/core/class-wcj-admin.php +1 -1
  124. includes/core/class-wcj-scripts.php +5 -5
  125. includes/core/wcj-constants.php +2 -2
  126. includes/core/wcj-loader.php +3 -3
  127. includes/core/wcj-options.php +3 -3
  128. includes/core/wcj-shortcodes.php +1 -1
  129. includes/emails/class-wc-email-wcj-custom.php +5 -5
  130. includes/exchange-rates/class-wcj-exchange-rates-crons.php +23 -23
  131. includes/export/class-wcj-exporter-customers.php +3 -3
  132. includes/export/class-wcj-exporter-orders.php +18 -18
  133. includes/export/class-wcj-exporter-products.php +9 -9
  134. includes/functions/wcj-functions-admin.php +12 -9
  135. includes/functions/wcj-functions-booster-core.php +3 -3
  136. includes/functions/wcj-functions-core.php +20 -0
  137. includes/functions/wcj-functions-country.php +1 -1
  138. includes/functions/wcj-functions-crons.php +2 -2
  139. includes/functions/wcj-functions-date-time.php +3 -3
  140. includes/functions/wcj-functions-debug.php +4 -4
  141. includes/functions/wcj-functions-eu-vat.php +2 -2
  142. includes/functions/wcj-functions-exchange-rates.php +11 -11
  143. includes/functions/wcj-functions-general.php +8 -8
  144. includes/functions/wcj-functions-html.php +5 -5
  145. includes/functions/wcj-functions-invoicing.php +14 -14
  146. includes/functions/wcj-functions-orders.php +1 -1
  147. includes/functions/wcj-functions-price-currency.php +37 -37
  148. includes/functions/wcj-functions-products.php +14 -14
  149. includes/functions/wcj-functions-shipping.php +4 -4
  150. includes/functions/wcj-functions-users.php +2 -2
  151. includes/gateways/class-wc-gateway-wcj-custom.php +6 -6
  152. includes/input-fields/class-wcj-product-input-fields-core.php +27 -27
  153. includes/input-fields/wcj-product-input-fields-options.php +1 -1
  154. includes/pdf-invoices/class-wcj-pdf-invoicing-report-tool.php +8 -8
  155. includes/pdf-invoices/submodules/class-wcj-pdf-invoicing-display.php +19 -19
  156. includes/pdf-invoices/submodules/class-wcj-pdf-invoicing-emails.php +3 -3
  157. includes/pdf-invoices/submodules/class-wcj-pdf-invoicing-numbering.php +1 -1
  158. includes/price-by-country/class-wcj-price-by-country-core.php +43 -43
  159. includes/price-by-country/class-wcj-price-by-country-group-generator.php +1 -1
  160. includes/price-by-country/class-wcj-price-by-country-local.php +8 -8
  161. includes/reports/class-wcj-currency-reports.php +5 -5
  162. includes/reports/wcj-class-reports-monthly-sales.php +4 -4
  163. includes/reports/wcj-class-reports-sales-daily.php +4 -4
  164. includes/reports/wcj-class-reports-sales.php +10 -10
  165. includes/reports/wcj-class-reports-stock.php +5 -5
  166. includes/settings/meta-box/wcj-settings-meta-box-currency-per-product.php +3 -3
  167. includes/settings/meta-box/wcj-settings-meta-box-custom-css.php +1 -1
  168. includes/settings/meta-box/wcj-settings-meta-box-multicurrency-base-price.php +4 -4
  169. includes/settings/meta-box/wcj-settings-meta-box-multicurrency.php +4 -4
  170. includes/settings/meta-box/wcj-settings-meta-box-offer-price.php +4 -4
  171. includes/settings/meta-box/wcj-settings-meta-box-order-quantities.php +1 -1
  172. includes/settings/meta-box/wcj-settings-meta-box-orders.php +1 -1
  173. includes/settings/meta-box/wcj-settings-meta-box-price-by-country.php +7 -7
  174. includes/settings/meta-box/wcj-settings-meta-box-price-by-user-role.php +2 -2
  175. includes/settings/meta-box/wcj-settings-meta-box-product-add-to-cart.php +4 -4
  176. includes/settings/meta-box/wcj-settings-meta-box-product-by-condition.php +3 -3
  177. includes/settings/meta-box/wcj-settings-meta-box-product-by-date.php +1 -1
  178. includes/settings/meta-box/wcj-settings-meta-box-product-msrp.php +2 -2
  179. includes/settings/meta-box/wcj-settings-meta-box-product-price-by-formula.php +4 -4
  180. includes/settings/meta-box/wcj-settings-meta-box-purchase-data.php +11 -11
  181. includes/settings/meta-box/wcj-settings-meta-box-related-products.php +2 -2
  182. includes/settings/meta-box/wcj-settings-meta-box-wholesale-price.php +1 -1
  183. includes/settings/wcj-settings-add-to-cart.php +1 -1
  184. includes/settings/wcj-settings-admin-orders-list.php +5 -5
  185. includes/settings/wcj-settings-admin-products-list.php +1 -1
  186. includes/settings/wcj-settings-cart.php +1 -1
  187. includes/settings/wcj-settings-checkout-custom-fields.php +12 -4
  188. includes/settings/wcj-settings-checkout-custom-info.php +1 -1
  189. includes/settings/wcj-settings-checkout-fees.php +4 -4
  190. includes/settings/wcj-settings-checkout-files-upload.php +2 -2
  191. includes/settings/wcj-settings-currency-exchange-rates.php +3 -3
  192. includes/settings/wcj-settings-currency-per-product.php +10 -10
  193. includes/settings/wcj-settings-currency.php +1 -1
  194. includes/settings/wcj-settings-emails.php +1 -1
  195. includes/settings/wcj-settings-export.php +3 -3
  196. includes/settings/wcj-settings-global-discount.php +2 -2
  197. includes/settings/wcj-settings-mini-cart.php +1 -1
  198. includes/settings/wcj-settings-multicurrency-base-price.php +3 -3
  199. includes/settings/wcj-settings-multicurrency.php +52 -6
  200. includes/settings/wcj-settings-my-account.php +2 -2
  201. includes/settings/wcj-settings-offer-price.php +2 -2
  202. includes/settings/wcj-settings-order-custom-statuses.php +9 -1
  203. includes/settings/wcj-settings-order-quantities.php +1 -1
  204. includes/settings/wcj-settings-orders.php +1 -1
  205. includes/settings/wcj-settings-payment-gateways-by-shipping.php +1 -1
  206. includes/settings/wcj-settings-payment-gateways-currency.php +1 -1
  207. includes/settings/wcj-settings-payment-gateways-fees.php +1 -1
  208. includes/settings/wcj-settings-payment-gateways-icons.php +1 -1
  209. includes/settings/wcj-settings-payment-gateways-per-category.php +2 -2
  210. includes/settings/wcj-settings-payment-gateways.php +1 -1
  211. includes/settings/wcj-settings-pdf-invoicing-advanced.php +5 -5
  212. includes/settings/wcj-settings-pdf-invoicing-display.php +1 -1
  213. includes/settings/wcj-settings-pdf-invoicing-emails.php +2 -2
  214. includes/settings/wcj-settings-pdf-invoicing-footer.php +1 -1
  215. includes/settings/wcj-settings-pdf-invoicing-header.php +1 -1
  216. includes/settings/wcj-settings-pdf-invoicing-numbering.php +1 -1
  217. includes/settings/wcj-settings-pdf-invoicing-page.php +1 -1
  218. includes/settings/wcj-settings-pdf-invoicing-styling.php +1 -1
  219. includes/settings/wcj-settings-pdf-invoicing-templates.php +1 -1
  220. includes/settings/wcj-settings-price-by-country.php +12 -12
  221. includes/settings/wcj-settings-price-by-user-role.php +1 -1
  222. includes/settings/wcj-settings-price-formats.php +4 -4
  223. includes/settings/wcj-settings-product-addons.php +1 -1
  224. includes/settings/wcj-settings-product-by-user.php +2 -2
  225. includes/settings/wcj-settings-product-custom-info.php +5 -5
  226. includes/settings/wcj-settings-product-input-fields.php +2 -2
  227. includes/settings/wcj-settings-product-listings.php +1 -1
  228. includes/settings/wcj-settings-product-open-pricing.php +1 -1
  229. includes/settings/wcj-settings-product-price-by-formula.php +1 -1
  230. includes/settings/wcj-settings-product-tabs.php +6 -6
  231. includes/settings/wcj-settings-products-xml.php +7 -7
  232. includes/settings/wcj-settings-purchase-data.php +1 -1
  233. includes/settings/wcj-settings-related-products.php +1 -1
  234. includes/settings/wcj-settings-sale-flash.php +1 -1
  235. includes/settings/wcj-settings-shipping-by-condition.php +1 -1
  236. includes/settings/wcj-settings-shipping-by-order-amount.php +1 -1
  237. includes/settings/wcj-settings-shipping-by-order-qty.php +1 -1
  238. includes/settings/wcj-settings-shipping-description.php +1 -1
  239. includes/settings/wcj-settings-shipping-icons.php +1 -1
  240. includes/settings/wcj-settings-shipping-time.php +2 -2
  241. includes/settings/wcj-settings-shipping.php +1 -1
  242. includes/settings/wcj-settings-sku.php +1 -1
  243. includes/settings/wcj-settings-tax-display.php +1 -1
  244. includes/settings/wcj-settings-template-editor.php +2 -2
  245. includes/settings/wcj-settings-url-coupons.php +1 -1
  246. includes/settings/wcj-settings-wholesale-price.php +3 -3
  247. includes/shipping/class-wc-shipping-wcj-custom-with-shipping-zones.php +9 -9
  248. includes/shipping/class-wc-shipping-wcj-custom.php +4 -4
  249. includes/shortcodes/class-wcj-shortcodes-general.php +26 -26
  250. includes/shortcodes/class-wcj-shortcodes-invoices.php +1 -1
  251. includes/shortcodes/class-wcj-shortcodes-order-items.php +3 -3
  252. includes/shortcodes/class-wcj-shortcodes-orders.php +7 -7
  253. includes/shortcodes/class-wcj-shortcodes-products-add-form.php +31 -31
  254. includes/shortcodes/class-wcj-shortcodes-products-crowdfunding.php +2 -2
  255. includes/shortcodes/class-wcj-shortcodes-products.php +7 -7
  256. includes/widgets/class-wcj-widget-country-switcher.php +1 -1
  257. langs/woocommerce-jetpack.pot +243 -186
  258. readme.txt +25 -1
  259. woocommerce-jetpack.php +11 -3
includes/add-to-cart/class-wcj-add-to-cart-per-category.php CHANGED
@@ -16,7 +16,7 @@ class WCJ_Add_To_Cart_Per_Category {
16
  * Constructor.
17
  */
18
  function __construct() {
19
- if ( 'yes' === get_option( 'wcj_add_to_cart_per_category_enabled' ) ) {
20
  add_filter( 'woocommerce_product_single_add_to_cart_text', array( $this, 'change_add_to_cart_button_text_single' ), PHP_INT_MAX );
21
  add_filter( 'woocommerce_product_add_to_cart_text', array( $this, 'change_add_to_cart_button_text_archive' ), PHP_INT_MAX );
22
  }
@@ -44,14 +44,14 @@ class WCJ_Add_To_Cart_Per_Category {
44
  function change_add_to_cart_button_text( $add_to_cart_text, $single_or_archive ) {
45
  $product_categories = get_the_terms( get_the_ID(), 'product_cat' );
46
  if ( empty( $product_categories ) ) return $add_to_cart_text;
47
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_add_to_cart_per_category_total_groups_number', 1 ) ); $i++ ) {
48
- if ( 'yes' !== get_option( 'wcj_add_to_cart_per_category_enabled_group_' . $i ) ) continue;
49
- $categories = get_option( 'wcj_add_to_cart_per_category_ids_group_' . $i );
50
  if ( empty( $categories ) ) continue;
51
  foreach ( $product_categories as $product_category ) {
52
  foreach ( $categories as $category ) {
53
  if ( $product_category->term_id == $category ) {
54
- return get_option( 'wcj_add_to_cart_per_category_text_' . $single_or_archive . '_group_' . $i, $add_to_cart_text );
55
  }
56
  }
57
  }
16
  * Constructor.
17
  */
18
  function __construct() {
19
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_per_category_enabled' ) ) {
20
  add_filter( 'woocommerce_product_single_add_to_cart_text', array( $this, 'change_add_to_cart_button_text_single' ), PHP_INT_MAX );
21
  add_filter( 'woocommerce_product_add_to_cart_text', array( $this, 'change_add_to_cart_button_text_archive' ), PHP_INT_MAX );
22
  }
44
  function change_add_to_cart_button_text( $add_to_cart_text, $single_or_archive ) {
45
  $product_categories = get_the_terms( get_the_ID(), 'product_cat' );
46
  if ( empty( $product_categories ) ) return $add_to_cart_text;
47
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_add_to_cart_per_category_total_groups_number', 1 ) ); $i++ ) {
48
+ if ( 'yes' !== wcj_get_option( 'wcj_add_to_cart_per_category_enabled_group_' . $i ) ) continue;
49
+ $categories = wcj_get_option( 'wcj_add_to_cart_per_category_ids_group_' . $i );
50
  if ( empty( $categories ) ) continue;
51
  foreach ( $product_categories as $product_category ) {
52
  foreach ( $categories as $category ) {
53
  if ( $product_category->term_id == $category ) {
54
+ return wcj_get_option( 'wcj_add_to_cart_per_category_text_' . $single_or_archive . '_group_' . $i, $add_to_cart_text );
55
  }
56
  }
57
  }
includes/add-to-cart/class-wcj-add-to-cart-per-product-type.php CHANGED
@@ -18,7 +18,7 @@ class WCJ_Add_To_Cart_Per_Product_Type {
18
  * @version 3.4.0
19
  */
20
  function __construct() {
21
- if ( 'yes' === get_option( 'wcj_add_to_cart_text_enabled', 'no' ) ) {
22
  add_filter( 'woocommerce_product_single_add_to_cart_text', array( $this, 'custom_add_to_cart_button_text' ), 100 );
23
  add_filter( 'woocommerce_product_add_to_cart_text', array( $this, 'custom_add_to_cart_button_text' ), 100 );
24
  }
@@ -47,7 +47,7 @@ class WCJ_Add_To_Cart_Per_Product_Type {
47
  $single_or_archive = ( 'woocommerce_product_single_add_to_cart_text' == current_filter() ? 'single' : 'archives' );
48
 
49
  // Already in cart
50
- if ( '' != ( $text_already_in_cart = get_option( 'wcj_add_to_cart_text_on_' . $single_or_archive . '_in_cart_' . $product_type, '' ) ) && isset( $woocommerce->cart ) ) {
51
  foreach( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {
52
  $_product = $values['data'];
53
  if( get_the_ID() == wcj_get_product_id_or_variation_parent_id( $_product ) ) {
@@ -57,27 +57,27 @@ class WCJ_Add_To_Cart_Per_Product_Type {
57
  }
58
 
59
  // Not in stock
60
- if ( '' != ( $text_on_not_in_stock = get_option( 'wcj_add_to_cart_text_on_' . $single_or_archive . '_not_in_stock_' . $product_type, '' ) ) && ! $product->is_in_stock() ) {
61
  return do_shortcode( $text_on_not_in_stock );
62
  }
63
 
64
  // On sale
65
- if ( '' != ( $text_on_sale = get_option( 'wcj_add_to_cart_text_on_' . $single_or_archive . '_sale_' . $product_type, '' ) ) && $product->is_on_sale() ) {
66
  return do_shortcode( $text_on_sale );
67
  }
68
 
69
  // Empty price
70
- if ( '' != ( $text_on_no_price = get_option( 'wcj_add_to_cart_text_on_' . $single_or_archive . '_no_price_' . $product_type, '' ) ) && '' === $product->get_price() ) {
71
  return do_shortcode( $text_on_no_price );
72
  }
73
 
74
  // Free (i.e. zero price)
75
- if ( '' != ( $text_on_zero_price = get_option( 'wcj_add_to_cart_text_on_' . $single_or_archive . '_zero_price_' . $product_type, '' ) ) && 0 == $product->get_price() ) {
76
  return do_shortcode( $text_on_zero_price );
77
  }
78
 
79
  // General
80
- if ( '' != ( $text_general = get_option( 'wcj_add_to_cart_text_on_' . $single_or_archive . '_' . $product_type, '' ) ) ) {
81
  return do_shortcode( $text_general );
82
  }
83
 
18
  * @version 3.4.0
19
  */
20
  function __construct() {
21
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_text_enabled', 'no' ) ) {
22
  add_filter( 'woocommerce_product_single_add_to_cart_text', array( $this, 'custom_add_to_cart_button_text' ), 100 );
23
  add_filter( 'woocommerce_product_add_to_cart_text', array( $this, 'custom_add_to_cart_button_text' ), 100 );
24
  }
47
  $single_or_archive = ( 'woocommerce_product_single_add_to_cart_text' == current_filter() ? 'single' : 'archives' );
48
 
49
  // Already in cart
50
+ if ( '' != ( $text_already_in_cart = wcj_get_option( 'wcj_add_to_cart_text_on_' . $single_or_archive . '_in_cart_' . $product_type, '' ) ) && isset( $woocommerce->cart ) ) {
51
  foreach( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {
52
  $_product = $values['data'];
53
  if( get_the_ID() == wcj_get_product_id_or_variation_parent_id( $_product ) ) {
57
  }
58
 
59
  // Not in stock
60
+ if ( '' != ( $text_on_not_in_stock = wcj_get_option( 'wcj_add_to_cart_text_on_' . $single_or_archive . '_not_in_stock_' . $product_type, '' ) ) && ! $product->is_in_stock() ) {
61
  return do_shortcode( $text_on_not_in_stock );
62
  }
63
 
64
  // On sale
65
+ if ( '' != ( $text_on_sale = wcj_get_option( 'wcj_add_to_cart_text_on_' . $single_or_archive . '_sale_' . $product_type, '' ) ) && $product->is_on_sale() ) {
66
  return do_shortcode( $text_on_sale );
67
  }
68
 
69
  // Empty price
70
+ if ( '' != ( $text_on_no_price = wcj_get_option( 'wcj_add_to_cart_text_on_' . $single_or_archive . '_no_price_' . $product_type, '' ) ) && '' === $product->get_price() ) {
71
  return do_shortcode( $text_on_no_price );
72
  }
73
 
74
  // Free (i.e. zero price)
75
+ if ( '' != ( $text_on_zero_price = wcj_get_option( 'wcj_add_to_cart_text_on_' . $single_or_archive . '_zero_price_' . $product_type, '' ) ) && 0 == $product->get_price() ) {
76
  return do_shortcode( $text_on_zero_price );
77
  }
78
 
79
  // General
80
+ if ( '' != ( $text_general = wcj_get_option( 'wcj_add_to_cart_text_on_' . $single_or_archive . '_' . $product_type, '' ) ) ) {
81
  return do_shortcode( $text_general );
82
  }
83
 
includes/add-to-cart/class-wcj-add-to-cart-per-product.php CHANGED
@@ -16,7 +16,7 @@ class WCJ_Add_To_Cart_Per_Product {
16
  * Constructor.
17
  */
18
  function __construct() {
19
- if ( 'yes' === get_option( 'wcj_add_to_cart_per_product_enabled' ) ) {
20
  add_filter( 'woocommerce_product_single_add_to_cart_text', array( $this, 'change_add_to_cart_button_text_single' ), PHP_INT_MAX );
21
  add_filter( 'woocommerce_product_add_to_cart_text', array( $this, 'change_add_to_cart_button_text_archive' ), PHP_INT_MAX );
22
  add_action( 'add_meta_boxes', array( $this, 'add_custom_add_to_cart_meta_box' ) );
16
  * Constructor.
17
  */
18
  function __construct() {
19
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_per_product_enabled' ) ) {
20
  add_filter( 'woocommerce_product_single_add_to_cart_text', array( $this, 'change_add_to_cart_button_text_single' ), PHP_INT_MAX );
21
  add_filter( 'woocommerce_product_add_to_cart_text', array( $this, 'change_add_to_cart_button_text_archive' ), PHP_INT_MAX );
22
  add_action( 'add_meta_boxes', array( $this, 'add_custom_add_to_cart_meta_box' ) );
includes/admin/class-wc-settings-jetpack.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Settings
4
  *
5
- * @version 5.3.1
6
  * @since 1.0.0
7
  * @author Pluggabl LLC.
8
  */
@@ -246,7 +246,7 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
246
  $active = 0;
247
  foreach ( $this->module_statuses as $module_status ) {
248
  if ( isset( $module_status['id'] ) && isset( $module_status['default'] ) ) {
249
- if ( 'yes' === get_option( $module_status['id'], $module_status['default'] ) ) {
250
  $active++;
251
  } elseif ( wcj_is_module_deprecated( $module_status['id'], true ) ) {
252
  continue;
@@ -384,7 +384,7 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
384
  echo '</div>';
385
  }
386
 
387
- if ( 'yes' === get_option( 'wcj_debug_tools_enabled', 'no' ) && 'yes' === get_option( 'wcj_debuging_enabled', 'no' ) ) {
388
  // Breadcrumbs
389
  $breadcrumbs_html = '';
390
  $breadcrumbs_html .= '<p>';
@@ -492,7 +492,7 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
492
  $table_data[] = array(
493
  '<label for="' . $manager_settings_field['id'] . '">' .
494
  '<input name="' . $manager_settings_field['id'] . '" id="' . $manager_settings_field['id'] . '" type="' . $manager_settings_field['type'] . '"' .
495
- ' class="" value="1" ' . checked( get_option( $manager_settings_field['id'], $manager_settings_field['default'] ), 'yes', false ) . '>' .
496
  ' ' . '<strong>' . $manager_settings_field['title'] . '</strong>' .
497
  '</label>',
498
  '<em>' . $manager_settings_field['desc'] . '</em>',
@@ -511,7 +511,7 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
511
  '" id="' . $_settings['id'] .
512
  '" type="' . $_settings['type'] .
513
  '" class="' . $_settings['class'] .
514
- '" value="' . get_option( $_settings['id'], $_settings['default'] )
515
  . '">' . ' ' . '<em>' . $_settings['desc'] . '</em>' .
516
  '</label>',
517
  );
@@ -522,7 +522,7 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
522
  $plugin_data = get_plugin_data( WCJ_PLUGIN_FILE );
523
  $plugin_title = ( isset( $plugin_data['Name'] ) ? '[' . $plugin_data['Name'] . '] ' : '' );
524
  echo '<p style="text-align:right;color:gray;font-size:x-small;font-style:italic;">' . $plugin_title .
525
- __( 'Version', 'woocommerce-jetpack' ) . ': ' . get_option( WCJ_VERSION_OPTION, 'N/A' ) . '</p>';
526
 
527
  }
528
 
@@ -571,7 +571,7 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
571
  }
572
  if ( '' != $cat_id ) {
573
  if ( 'active_modules_only' === $cat_id ) {
574
- if ( 'no' === get_option( $the_feature['id'], 'no' ) ) {
575
  continue;
576
  }
577
  } elseif ( $cat_id != $this->get_cat_by_section( $section ) ) {
@@ -579,10 +579,10 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
579
  }
580
  }
581
  $total_modules++;
582
- $html .= '<tr id="' . $the_feature['id'] . '" ' . 'class="' . $this->active( get_option( $the_feature['id'] ) ) . '">';
583
  $html .= '<th scope="row" class="check-column">';
584
  $html .= '<label class="screen-reader-text" for="' . $the_feature['id'] . '">' . $the_feature['desc'] . '</label>';
585
- $html .= '<input type="checkbox" name="' . $the_feature['id'] . '" value="1" id="' . $the_feature['id'] . '" ' . checked( get_option( $the_feature['id'] ), 'yes', false ) . '>';
586
  $html .= '</th>';
587
  $html .= '<td class="plugin-title">' . '<strong>' . $the_feature['title'] . '</strong>';
588
  $html .= '<div class="row-actions visible">';
@@ -608,16 +608,39 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
608
  /**
609
  * Save settings.
610
  *
611
- * @version 3.6.0
612
  */
613
  function save() {
614
  global $current_section;
615
  $settings = $this->get_settings( $current_section );
616
  WC_Admin_Settings::save_fields( $settings );
 
617
  add_action( 'admin_notices', array( $this, 'booster_message_global' ) );
618
  do_action( 'woojetpack_after_settings_save', $this->get_sections(), $current_section );
619
  }
620
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
621
  /**
622
  * booster_message_global.
623
  *
2
  /**
3
  * Booster for WooCommerce - Settings
4
  *
5
+ * @version 5.3.3
6
  * @since 1.0.0
7
  * @author Pluggabl LLC.
8
  */
246
  $active = 0;
247
  foreach ( $this->module_statuses as $module_status ) {
248
  if ( isset( $module_status['id'] ) && isset( $module_status['default'] ) ) {
249
+ if ( 'yes' === wcj_get_option( $module_status['id'], $module_status['default'] ) ) {
250
  $active++;
251
  } elseif ( wcj_is_module_deprecated( $module_status['id'], true ) ) {
252
  continue;
384
  echo '</div>';
385
  }
386
 
387
+ if ( 'yes' === wcj_get_option( 'wcj_debug_tools_enabled', 'no' ) && 'yes' === wcj_get_option( 'wcj_debuging_enabled', 'no' ) ) {
388
  // Breadcrumbs
389
  $breadcrumbs_html = '';
390
  $breadcrumbs_html .= '<p>';
492
  $table_data[] = array(
493
  '<label for="' . $manager_settings_field['id'] . '">' .
494
  '<input name="' . $manager_settings_field['id'] . '" id="' . $manager_settings_field['id'] . '" type="' . $manager_settings_field['type'] . '"' .
495
+ ' class="" value="1" ' . checked( wcj_get_option( $manager_settings_field['id'], $manager_settings_field['default'] ), 'yes', false ) . '>' .
496
  ' ' . '<strong>' . $manager_settings_field['title'] . '</strong>' .
497
  '</label>',
498
  '<em>' . $manager_settings_field['desc'] . '</em>',
511
  '" id="' . $_settings['id'] .
512
  '" type="' . $_settings['type'] .
513
  '" class="' . $_settings['class'] .
514
+ '" value="' . wcj_get_option( $_settings['id'], $_settings['default'] )
515
  . '">' . ' ' . '<em>' . $_settings['desc'] . '</em>' .
516
  '</label>',
517
  );
522
  $plugin_data = get_plugin_data( WCJ_PLUGIN_FILE );
523
  $plugin_title = ( isset( $plugin_data['Name'] ) ? '[' . $plugin_data['Name'] . '] ' : '' );
524
  echo '<p style="text-align:right;color:gray;font-size:x-small;font-style:italic;">' . $plugin_title .
525
+ __( 'Version', 'woocommerce-jetpack' ) . ': ' . wcj_get_option( WCJ_VERSION_OPTION, 'N/A' ) . '</p>';
526
 
527
  }
528
 
571
  }
572
  if ( '' != $cat_id ) {
573
  if ( 'active_modules_only' === $cat_id ) {
574
+ if ( 'no' === wcj_get_option( $the_feature['id'], 'no' ) ) {
575
  continue;
576
  }
577
  } elseif ( $cat_id != $this->get_cat_by_section( $section ) ) {
579
  }
580
  }
581
  $total_modules++;
582
+ $html .= '<tr id="' . $the_feature['id'] . '" ' . 'class="' . $this->active( wcj_get_option( $the_feature['id'] ) ) . '">';
583
  $html .= '<th scope="row" class="check-column">';
584
  $html .= '<label class="screen-reader-text" for="' . $the_feature['id'] . '">' . $the_feature['desc'] . '</label>';
585
+ $html .= '<input type="checkbox" name="' . $the_feature['id'] . '" value="1" id="' . $the_feature['id'] . '" ' . checked( wcj_get_option( $the_feature['id'] ), 'yes', false ) . '>';
586
  $html .= '</th>';
587
  $html .= '<td class="plugin-title">' . '<strong>' . $the_feature['title'] . '</strong>';
588
  $html .= '<div class="row-actions visible">';
608
  /**
609
  * Save settings.
610
  *
611
+ * @version 5.3.3
612
  */
613
  function save() {
614
  global $current_section;
615
  $settings = $this->get_settings( $current_section );
616
  WC_Admin_Settings::save_fields( $settings );
617
+ $this->disable_autoload_options_from_section( $settings );
618
  add_action( 'admin_notices', array( $this, 'booster_message_global' ) );
619
  do_action( 'woojetpack_after_settings_save', $this->get_sections(), $current_section );
620
  }
621
 
622
+ /**
623
+ * disable_autoload_options.
624
+ *
625
+ * @version 5.3.3
626
+ * @since 5.3.3
627
+ *
628
+ * @param $settings
629
+ */
630
+ function disable_autoload_options_from_section( $settings ) {
631
+ $fields = wp_list_filter( $settings, array( 'autoload' => false ) );
632
+ $fields = wp_list_filter( $fields, array( 'type' => 'title' ), 'NOT' );
633
+ $fields = wp_list_filter( $fields, array( 'type' => 'sectionend' ), 'NOT' );
634
+ $field_ids = wp_list_pluck( $fields, 'id' );
635
+ $fields_ids_str = '\'' . implode( '\',\'', $field_ids ) . '\'';
636
+ global $wpdb;
637
+ $sql = "
638
+ UPDATE {$wpdb->options} SET autoload = 'no'
639
+ WHERE option_name IN ({$fields_ids_str}) AND autoload != 'no'
640
+ ";
641
+ $wpdb->query( $sql );
642
+ }
643
+
644
  /**
645
  * booster_message_global.
646
  *
includes/admin/class-wcj-settings-custom-fields.php CHANGED
@@ -42,7 +42,7 @@ class WCJ_Settings_Custom_Fields {
42
 
43
  $value['type'] = 'number';
44
 
45
- $option_value = get_option( $value['id'], $value['default'] );
46
 
47
  // Custom attribute handling
48
  $custom_attributes = array();
@@ -53,7 +53,7 @@ class WCJ_Settings_Custom_Fields {
53
  } else {
54
  if (
55
  ! WCJ()->modules['currency_exchange_rates']->is_enabled()
56
- || 'yes' !== get_option( 'wcj_currency_exchange_rates_point_decimal_separator', 'no' )
57
  ) {
58
  $custom_attributes = array( 'step="' . sprintf( "%.12f", 1 / pow( 10, 12 ) ) . '"', 'min="0"' );
59
  } else {
@@ -227,7 +227,7 @@ class WCJ_Settings_Custom_Fields {
227
  * @since 2.2.6
228
  */
229
  function output_custom_textarea( $value ) {
230
- $option_value = get_option( $value['id'], $value['default'] );
231
  $custom_attributes = ( isset( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) ?
232
  $value['custom_attributes'] : array();
233
  $description = ' <p class="description">' . $value['desc'] . '</p>';
@@ -298,7 +298,7 @@ class WCJ_Settings_Custom_Fields {
298
  */
299
  function output_custom_number( $value ) {
300
  $type = 'number';
301
- $option_value = get_option( $value['id'], $value['default'] );
302
  $tooltip_html = ( isset( $value['desc_tip'] ) && '' != $value['desc_tip'] ) ?
303
  '<span class="woocommerce-help-tip" data-tip="' . $value['desc_tip'] . '"></span>' : '';
304
  $description = ' <span class="description">' . $value['desc'] . '</span>';
42
 
43
  $value['type'] = 'number';
44
 
45
+ $option_value = wcj_get_option( $value['id'], $value['default'] );
46
 
47
  // Custom attribute handling
48
  $custom_attributes = array();
53
  } else {
54
  if (
55
  ! WCJ()->modules['currency_exchange_rates']->is_enabled()
56
+ || 'yes' !== wcj_get_option( 'wcj_currency_exchange_rates_point_decimal_separator', 'no' )
57
  ) {
58
  $custom_attributes = array( 'step="' . sprintf( "%.12f", 1 / pow( 10, 12 ) ) . '"', 'min="0"' );
59
  } else {
227
  * @since 2.2.6
228
  */
229
  function output_custom_textarea( $value ) {
230
+ $option_value = wcj_get_option( $value['id'], $value['default'] );
231
  $custom_attributes = ( isset( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) ?
232
  $value['custom_attributes'] : array();
233
  $description = ' <p class="description">' . $value['desc'] . '</p>';
298
  */
299
  function output_custom_number( $value ) {
300
  $type = 'number';
301
+ $option_value = wcj_get_option( $value['id'], $value['default'] );
302
  $tooltip_html = ( isset( $value['desc_tip'] ) && '' != $value['desc_tip'] ) ?
303
  '<span class="woocommerce-help-tip" data-tip="' . $value['desc_tip'] . '"></span>' : '';
304
  $description = ' <span class="description">' . $value['desc'] . '</span>';
includes/admin/class-wcj-settings-manager.php CHANGED
@@ -104,7 +104,7 @@ class WCJ_Settings_Manager {
104
  foreach ( $values as $value ) {
105
  if ( isset( $value['default'] ) && isset( $value['id'] ) ) {
106
  if ( isset ( $_POST['booster_export_settings'] ) ) {
107
- $export_settings[ $value['id'] ] = get_option( $value['id'], $value['default'] );
108
  if ( ! isset( $export_counter[ $module->short_desc ] ) ) {
109
  $export_counter[ $module->short_desc ] = 0;
110
  }
@@ -114,7 +114,7 @@ class WCJ_Settings_Manager {
114
  }
115
  }
116
  $export_settings = json_encode( $export_settings );
117
- $export_settings = 'Booster for WooCommerce v' . get_option( WCJ_VERSION_OPTION, 'NA' ) . PHP_EOL . $export_settings;
118
  header( "Content-Type: application/download" );
119
  header( "Content-Disposition: attachment; filename=booster_settings.txt" );
120
  echo $export_settings;
104
  foreach ( $values as $value ) {
105
  if ( isset( $value['default'] ) && isset( $value['id'] ) ) {
106
  if ( isset ( $_POST['booster_export_settings'] ) ) {
107
+ $export_settings[ $value['id'] ] = wcj_get_option( $value['id'], $value['default'] );
108
  if ( ! isset( $export_counter[ $module->short_desc ] ) ) {
109
  $export_counter[ $module->short_desc ] = 0;
110
  }
114
  }
115
  }
116
  $export_settings = json_encode( $export_settings );
117
+ $export_settings = 'Booster for WooCommerce v' . wcj_get_option( WCJ_VERSION_OPTION, 'NA' ) . PHP_EOL . $export_settings;
118
  header( "Content-Type: application/download" );
119
  header( "Content-Disposition: attachment; filename=booster_settings.txt" );
120
  echo $export_settings;
includes/admin/class-wcj-tools.php CHANGED
@@ -34,7 +34,7 @@ class WCJ_Tools {
34
  'woocommerce',
35
  __( 'Booster for WooCommerce Tools', 'woocommerce-jetpack' ),
36
  __( 'Booster Tools', 'woocommerce-jetpack' ),
37
- ( 'yes' === get_option( 'wcj_' . 'admin_tools' . '_enabled', 'no' ) && 'yes' === get_option( 'wcj_admin_tools_show_menus_to_admin_only', 'no' ) ? 'manage_options' : 'manage_woocommerce' ),
38
  'wcj-tools',
39
  array( $this, 'create_tools_page' )
40
  );
34
  'woocommerce',
35
  __( 'Booster for WooCommerce Tools', 'woocommerce-jetpack' ),
36
  __( 'Booster Tools', 'woocommerce-jetpack' ),
37
+ ( 'yes' === wcj_get_option( 'wcj_' . 'admin_tools' . '_enabled', 'no' ) && 'yes' === wcj_get_option( 'wcj_admin_tools_show_menus_to_admin_only', 'no' ) ? 'manage_options' : 'manage_woocommerce' ),
38
  'wcj-tools',
39
  array( $this, 'create_tools_page' )
40
  );
includes/class-wcj-add-to-cart-button-visibility.php CHANGED
@@ -35,10 +35,10 @@ class WCJ_Add_To_Cart_Button_Visibility extends WCJ_Module {
35
 
36
  if ( $this->is_enabled() ) {
37
  // All products
38
- if ( 'yes' === get_option( 'wcj_add_to_cart_button_global_enabled', 'no' ) ) {
39
  // Archives
40
- if ( 'yes' === get_option( 'wcj_add_to_cart_button_disable_archives', 'no' ) ) {
41
- if ( 'remove_action' === get_option( 'wcj_add_to_cart_button_disable_archives_method', 'remove_action' ) ) {
42
  add_action( 'init', array( $this, 'add_to_cart_button_disable_archives' ), PHP_INT_MAX );
43
  add_action( 'woocommerce_after_shop_loop_item', array( $this, 'add_to_cart_button_archives_content' ), 10 );
44
  } else { // 'add_filter'
@@ -46,8 +46,8 @@ class WCJ_Add_To_Cart_Button_Visibility extends WCJ_Module {
46
  }
47
  }
48
  // Single Product
49
- if ( 'yes' === get_option( 'wcj_add_to_cart_button_disable_single', 'no' ) ) {
50
- if ( 'remove_action' === get_option( 'wcj_add_to_cart_button_disable_single_method', 'remove_action' ) ) {
51
  add_action( 'init', array( $this, 'add_to_cart_button_disable_single' ), PHP_INT_MAX );
52
  add_action( 'woocommerce_single_product_summary', array( $this, 'add_to_cart_button_single_content' ), 30 );
53
  } else { // 'add_action'
@@ -58,7 +58,7 @@ class WCJ_Add_To_Cart_Button_Visibility extends WCJ_Module {
58
  }
59
  }
60
  // Per category
61
- if ( 'yes' === get_option( 'wcj_add_to_cart_button_per_category_enabled', 'no' ) ) {
62
  // Single Product
63
  add_action( 'woocommerce_before_add_to_cart_button', array( $this, 'add_to_cart_button_disable_start_per_category' ), PHP_INT_MAX, 0 );
64
  add_action( 'woocommerce_after_add_to_cart_button', array( $this, 'add_to_cart_button_disable_end_per_category' ), PHP_INT_MAX, 0 );
@@ -66,7 +66,7 @@ class WCJ_Add_To_Cart_Button_Visibility extends WCJ_Module {
66
  add_filter( 'woocommerce_loop_add_to_cart_link', array( $this, 'add_to_cart_button_loop_disable_per_category' ), PHP_INT_MAX, 2 );
67
  }
68
  // Per product
69
- if ( 'yes' === get_option( 'wcj_add_to_cart_button_per_product_enabled', 'no' ) ) {
70
  // Single Product
71
  add_action( 'woocommerce_before_add_to_cart_button', array( $this, 'add_to_cart_button_disable_start' ), PHP_INT_MAX, 0 );
72
  add_action( 'woocommerce_after_add_to_cart_button', array( $this, 'add_to_cart_button_disable_end' ), PHP_INT_MAX, 0 );
@@ -87,7 +87,7 @@ class WCJ_Add_To_Cart_Button_Visibility extends WCJ_Module {
87
  * @since 3.9.0
88
  */
89
  function add_to_cart_button_loop_disable_all_products( $link, $_product ) {
90
- return do_shortcode( get_option( 'wcj_add_to_cart_button_archives_content', '' ) );
91
  }
92
 
93
  /**
@@ -97,7 +97,7 @@ class WCJ_Add_To_Cart_Button_Visibility extends WCJ_Module {
97
  * @since 3.4.0
98
  */
99
  function add_to_cart_button_archives_content() {
100
- if ( '' != ( $content = get_option( 'wcj_add_to_cart_button_archives_content', '' ) ) ) {
101
  echo do_shortcode( $content );
102
  }
103
  }
@@ -109,7 +109,7 @@ class WCJ_Add_To_Cart_Button_Visibility extends WCJ_Module {
109
  * @since 3.4.0
110
  */
111
  function add_to_cart_button_single_content() {
112
- if ( '' != ( $content = get_option( 'wcj_add_to_cart_button_single_content', '' ) ) ) {
113
  echo do_shortcode( $content );
114
  }
115
  }
@@ -121,10 +121,10 @@ class WCJ_Add_To_Cart_Button_Visibility extends WCJ_Module {
121
  * @since 3.3.0
122
  */
123
  function add_to_cart_button_disable_end_per_category() {
124
- $cats_to_hide = get_option( 'wcj_add_to_cart_button_per_category_disable_single', '' );
125
  if ( ! empty( $cats_to_hide ) && 0 != get_the_ID() && wcj_is_product_term( get_the_ID(), $cats_to_hide, 'product_cat' ) ) {
126
  ob_end_clean();
127
- echo do_shortcode( get_option( 'wcj_add_to_cart_button_per_category_content_single', '' ) );
128
  }
129
  }
130
 
@@ -135,7 +135,7 @@ class WCJ_Add_To_Cart_Button_Visibility extends WCJ_Module {
135
  * @since 3.3.0
136
  */
137
  function add_to_cart_button_disable_start_per_category() {
138
- $cats_to_hide = get_option( 'wcj_add_to_cart_button_per_category_disable_single', '' );
139
  if ( ! empty( $cats_to_hide ) && 0 != get_the_ID() && wcj_is_product_term( get_the_ID(), $cats_to_hide, 'product_cat' ) ) {
140
  ob_start();
141
  }
@@ -148,9 +148,9 @@ class WCJ_Add_To_Cart_Button_Visibility extends WCJ_Module {
148
  * @since 3.3.0
149
  */
150
  function add_to_cart_button_loop_disable_per_category( $link, $_product ) {
151
- $cats_to_hide = get_option( 'wcj_add_to_cart_button_per_category_disable_loop', '' );
152
  if ( ! empty( $cats_to_hide ) && wcj_is_product_term( wcj_get_product_id_or_variation_parent_id( $_product ), $cats_to_hide, 'product_cat' ) ) {
153
- return do_shortcode( get_option( 'wcj_add_to_cart_button_per_category_content_loop', '' ) );
154
  }
155
  return $link;
156
  }
35
 
36
  if ( $this->is_enabled() ) {
37
  // All products
38
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_button_global_enabled', 'no' ) ) {
39
  // Archives
40
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_button_disable_archives', 'no' ) ) {
41
+ if ( 'remove_action' === wcj_get_option( 'wcj_add_to_cart_button_disable_archives_method', 'remove_action' ) ) {
42
  add_action( 'init', array( $this, 'add_to_cart_button_disable_archives' ), PHP_INT_MAX );
43
  add_action( 'woocommerce_after_shop_loop_item', array( $this, 'add_to_cart_button_archives_content' ), 10 );
44
  } else { // 'add_filter'
46
  }
47
  }
48
  // Single Product
49
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_button_disable_single', 'no' ) ) {
50
+ if ( 'remove_action' === wcj_get_option( 'wcj_add_to_cart_button_disable_single_method', 'remove_action' ) ) {
51
  add_action( 'init', array( $this, 'add_to_cart_button_disable_single' ), PHP_INT_MAX );
52
  add_action( 'woocommerce_single_product_summary', array( $this, 'add_to_cart_button_single_content' ), 30 );
53
  } else { // 'add_action'
58
  }
59
  }
60
  // Per category
61
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_button_per_category_enabled', 'no' ) ) {
62
  // Single Product
63
  add_action( 'woocommerce_before_add_to_cart_button', array( $this, 'add_to_cart_button_disable_start_per_category' ), PHP_INT_MAX, 0 );
64
  add_action( 'woocommerce_after_add_to_cart_button', array( $this, 'add_to_cart_button_disable_end_per_category' ), PHP_INT_MAX, 0 );
66
  add_filter( 'woocommerce_loop_add_to_cart_link', array( $this, 'add_to_cart_button_loop_disable_per_category' ), PHP_INT_MAX, 2 );
67
  }
68
  // Per product
69
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_button_per_product_enabled', 'no' ) ) {
70
  // Single Product
71
  add_action( 'woocommerce_before_add_to_cart_button', array( $this, 'add_to_cart_button_disable_start' ), PHP_INT_MAX, 0 );
72
  add_action( 'woocommerce_after_add_to_cart_button', array( $this, 'add_to_cart_button_disable_end' ), PHP_INT_MAX, 0 );
87
  * @since 3.9.0
88
  */
89
  function add_to_cart_button_loop_disable_all_products( $link, $_product ) {
90
+ return do_shortcode( wcj_get_option( 'wcj_add_to_cart_button_archives_content', '' ) );
91
  }
92
 
93
  /**
97
  * @since 3.4.0
98
  */
99
  function add_to_cart_button_archives_content() {
100
+ if ( '' != ( $content = wcj_get_option( 'wcj_add_to_cart_button_archives_content', '' ) ) ) {
101
  echo do_shortcode( $content );
102
  }
103
  }
109
  * @since 3.4.0
110
  */
111
  function add_to_cart_button_single_content() {
112
+ if ( '' != ( $content = wcj_get_option( 'wcj_add_to_cart_button_single_content', '' ) ) ) {
113
  echo do_shortcode( $content );
114
  }
115
  }
121
  * @since 3.3.0
122
  */
123
  function add_to_cart_button_disable_end_per_category() {
124
+ $cats_to_hide = wcj_get_option( 'wcj_add_to_cart_button_per_category_disable_single', '' );
125
  if ( ! empty( $cats_to_hide ) && 0 != get_the_ID() && wcj_is_product_term( get_the_ID(), $cats_to_hide, 'product_cat' ) ) {
126
  ob_end_clean();
127
+ echo do_shortcode( wcj_get_option( 'wcj_add_to_cart_button_per_category_content_single', '' ) );
128
  }
129
  }
130
 
135
  * @since 3.3.0
136
  */
137
  function add_to_cart_button_disable_start_per_category() {
138
+ $cats_to_hide = wcj_get_option( 'wcj_add_to_cart_button_per_category_disable_single', '' );
139
  if ( ! empty( $cats_to_hide ) && 0 != get_the_ID() && wcj_is_product_term( get_the_ID(), $cats_to_hide, 'product_cat' ) ) {
140
  ob_start();
141
  }
148
  * @since 3.3.0
149
  */
150
  function add_to_cart_button_loop_disable_per_category( $link, $_product ) {
151
+ $cats_to_hide = wcj_get_option( 'wcj_add_to_cart_button_per_category_disable_loop', '' );
152
  if ( ! empty( $cats_to_hide ) && wcj_is_product_term( wcj_get_product_id_or_variation_parent_id( $_product ), $cats_to_hide, 'product_cat' ) ) {
153
+ return do_shortcode( wcj_get_option( 'wcj_add_to_cart_button_per_category_content_loop', '' ) );
154
  }
155
  return $link;
156
  }
includes/class-wcj-address-formats.php CHANGED
@@ -38,7 +38,7 @@ class WCJ_Address_Formats extends WCJ_Module {
38
  * @version 2.7.0
39
  */
40
  function customize_force_country_display( $display ) {
41
- return ( 'yes' === get_option( 'wcj_address_formats_force_country_display', 'no' ) );
42
  }
43
 
44
  /**
@@ -49,7 +49,7 @@ class WCJ_Address_Formats extends WCJ_Module {
49
  $default_formats = $this->get_default_address_formats();
50
  foreach ( $default_formats as $country_code => $format ) {
51
  $default_format = isset( $formats[ $country_code ] ) ? $formats[ $country_code ] : $format;
52
- $format = get_option( 'wcj_address_formats_country_' . $country_code, $default_format );
53
  $modified_formats[ $country_code ] = $format;
54
  }
55
  return $modified_formats;
38
  * @version 2.7.0
39
  */
40
  function customize_force_country_display( $display ) {
41
+ return ( 'yes' === wcj_get_option( 'wcj_address_formats_force_country_display', 'no' ) );
42
  }
43
 
44
  /**
49
  $default_formats = $this->get_default_address_formats();
50
  foreach ( $default_formats as $country_code => $format ) {
51
  $default_format = isset( $formats[ $country_code ] ) ? $formats[ $country_code ] : $format;
52
+ $format = wcj_get_option( 'wcj_address_formats_country_' . $country_code, $default_format );
53
  $modified_formats[ $country_code ] = $format;
54
  }
55
  return $modified_formats;
includes/class-wcj-admin-bar.php CHANGED
@@ -33,16 +33,16 @@ class WCJ_Admin_Bar extends WCJ_Module {
33
  parent::__construct();
34
 
35
  if ( $this->is_enabled() ) {
36
- if ( 'yes' === get_option( 'wcj_admin_bar_wc_enabled', 'yes' ) ) {
37
  add_action( 'admin_bar_menu', array( $this, 'add_woocommerce_admin_bar' ), PHP_INT_MAX );
38
  add_action( 'wp_head', array( $this, 'add_woocommerce_admin_bar_icon_style' ) );
39
  add_action( 'admin_head', array( $this, 'add_woocommerce_admin_bar_icon_style' ) );
40
  }
41
- if ( 'yes' === get_option( 'wcj_admin_bar_booster_enabled', 'yes' ) || 'yes' === get_option( 'wcj_admin_bar_booster_active_enabled', 'yes' ) ) {
42
- if ( 'yes' === get_option( 'wcj_admin_bar_booster_enabled', 'yes' ) ) {
43
  add_action( 'admin_bar_menu', array( $this, 'add_booster_admin_bar' ), PHP_INT_MAX );
44
  }
45
- if ( 'yes' === get_option( 'wcj_admin_bar_booster_active_enabled', 'yes' ) ) {
46
  add_action( 'admin_bar_menu', array( $this, 'add_booster_active_admin_bar' ), PHP_INT_MAX );
47
  }
48
  add_action( 'wp_head', array( $this, 'add_booster_admin_bar_icon_style' ) );
@@ -237,7 +237,7 @@ class WCJ_Admin_Bar extends WCJ_Module {
237
  if ( ! current_user_can( 'manage_woocommerce' ) ) {
238
  return;
239
  }
240
- if ( 'no' === get_option( 'wcj_admin_bar_booster_enabled', 'yes' ) ) {
241
  $this->get_nodes_booster_modules();
242
  }
243
  $tools = array(
@@ -477,12 +477,12 @@ class WCJ_Admin_Bar extends WCJ_Module {
477
  'categories' => array(
478
  'title' => __( 'Categories', 'woocommerce' ),
479
  'href' => admin_url( 'edit-tags.php?taxonomy=product_cat&post_type=product' ),
480
- 'nodes' => ( 'no' === get_option( 'wcj_admin_bar_wc_list_cats', 'no' ) ? array() : $this->get_nodes_product_taxonomy( 'product_cat' ) ),
481
  ),
482
  'tags' => array(
483
  'title' => __( 'Tags', 'woocommerce' ),
484
  'href' => admin_url( 'edit-tags.php?taxonomy=product_tag&post_type=product' ),
485
- 'nodes' => ( 'no' === get_option( 'wcj_admin_bar_wc_list_tags', 'no' ) ? array() : $this->get_nodes_product_taxonomy( 'product_tag' ) ),
486
  ),
487
  'attributes' => array(
488
  'title' => __( 'Attributes', 'woocommerce' ),
33
  parent::__construct();
34
 
35
  if ( $this->is_enabled() ) {
36
+ if ( 'yes' === wcj_get_option( 'wcj_admin_bar_wc_enabled', 'yes' ) ) {
37
  add_action( 'admin_bar_menu', array( $this, 'add_woocommerce_admin_bar' ), PHP_INT_MAX );
38
  add_action( 'wp_head', array( $this, 'add_woocommerce_admin_bar_icon_style' ) );
39
  add_action( 'admin_head', array( $this, 'add_woocommerce_admin_bar_icon_style' ) );
40
  }
41
+ if ( 'yes' === wcj_get_option( 'wcj_admin_bar_booster_enabled', 'yes' ) || 'yes' === wcj_get_option( 'wcj_admin_bar_booster_active_enabled', 'yes' ) ) {
42
+ if ( 'yes' === wcj_get_option( 'wcj_admin_bar_booster_enabled', 'yes' ) ) {
43
  add_action( 'admin_bar_menu', array( $this, 'add_booster_admin_bar' ), PHP_INT_MAX );
44
  }
45
+ if ( 'yes' === wcj_get_option( 'wcj_admin_bar_booster_active_enabled', 'yes' ) ) {
46
  add_action( 'admin_bar_menu', array( $this, 'add_booster_active_admin_bar' ), PHP_INT_MAX );
47
  }
48
  add_action( 'wp_head', array( $this, 'add_booster_admin_bar_icon_style' ) );
237
  if ( ! current_user_can( 'manage_woocommerce' ) ) {
238
  return;
239
  }
240
+ if ( 'no' === wcj_get_option( 'wcj_admin_bar_booster_enabled', 'yes' ) ) {
241
  $this->get_nodes_booster_modules();
242
  }
243
  $tools = array(
477
  'categories' => array(
478
  'title' => __( 'Categories', 'woocommerce' ),
479
  'href' => admin_url( 'edit-tags.php?taxonomy=product_cat&post_type=product' ),
480
+ 'nodes' => ( 'no' === wcj_get_option( 'wcj_admin_bar_wc_list_cats', 'no' ) ? array() : $this->get_nodes_product_taxonomy( 'product_cat' ) ),
481
  ),
482
  'tags' => array(
483
  'title' => __( 'Tags', 'woocommerce' ),
484
  'href' => admin_url( 'edit-tags.php?taxonomy=product_tag&post_type=product' ),
485
+ 'nodes' => ( 'no' === wcj_get_option( 'wcj_admin_bar_wc_list_tags', 'no' ) ? array() : $this->get_nodes_product_taxonomy( 'product_tag' ) ),
486
  ),
487
  'attributes' => array(
488
  'title' => __( 'Attributes', 'woocommerce' ),
includes/class-wcj-admin-orders-list.php CHANGED
@@ -31,10 +31,10 @@ class WCJ_Admin_Orders_List extends WCJ_Module {
31
  if ( $this->is_enabled() ) {
32
 
33
  // Custom columns
34
- if ( 'yes' === get_option( 'wcj_order_admin_list_custom_columns_enabled', 'no' ) ) {
35
  add_filter( 'manage_edit-shop_order_columns', array( $this, 'add_order_columns' ), PHP_INT_MAX - 1 );
36
  add_action( 'manage_shop_order_posts_custom_column', array( $this, 'render_order_column' ), PHP_INT_MAX );
37
- if ( 'yes' === get_option( 'wcj_orders_list_custom_columns_country', 'no' ) || 'yes' === get_option( 'wcj_orders_list_custom_columns_currency', 'no' ) ) {
38
  // Billing country or Currency filtering
39
  add_action( 'restrict_manage_posts', array( $this, 'restrict_manage_posts' ) );
40
  add_filter( 'parse_query', array( $this, 'parse_query' ) );
@@ -45,25 +45,25 @@ class WCJ_Admin_Orders_List extends WCJ_Module {
45
  }
46
 
47
  // Multiple status
48
- if ( 'yes' === get_option( 'wcj_order_admin_list_multiple_status_enabled', 'no' ) ) {
49
- if ( 'yes' === get_option( 'wcj_order_admin_list_multiple_status_not_completed_link', 'no' ) ) {
50
  add_filter( 'views_edit-shop_order', array( $this, 'add_shop_order_multiple_statuses_not_completed_link' ) );
51
  add_action( 'pre_get_posts', array( $this, 'filter_shop_order_multiple_statuses_not_completed_link' ), PHP_INT_MAX, 1 );
52
  }
53
- if ( 'no' != get_option( 'wcj_order_admin_list_multiple_status_filter', 'no' ) ) {
54
  add_action( 'restrict_manage_posts', array( $this, 'add_shop_order_multiple_statuses' ), PHP_INT_MAX, 2 );
55
  add_action( 'pre_get_posts', array( $this, 'filter_shop_order_multiple_statuses' ), PHP_INT_MAX, 1 );
56
  }
57
- if ( 'yes' === get_option( 'wcj_order_admin_list_hide_default_statuses_menu', 'no' ) ) {
58
  add_action( 'admin_head', array( $this, 'hide_default_statuses_menu' ), PHP_INT_MAX );
59
  }
60
- if ( 'yes' === get_option( 'wcj_order_admin_list_multiple_status_admin_menu', 'no' ) ) {
61
  add_action( 'admin_menu', array( $this, 'admin_menu_multiple_status' ) );
62
  }
63
  }
64
 
65
  // Columns Order
66
- if ( 'yes' === get_option( 'wcj_order_admin_list_columns_order_enabled', 'no' ) ) {
67
  add_filter( 'manage_edit-shop_order_columns', array( $this, 'rearange_order_columns' ), PHP_INT_MAX - 1 );
68
  }
69
 
@@ -82,13 +82,13 @@ class WCJ_Admin_Orders_List extends WCJ_Module {
82
  // Remove "Coupons" menu (to get "Orders" menus on top)
83
  $coupons_menu = remove_submenu_page( 'woocommerce', 'edit.php?post_type=shop_coupon' );
84
  // Maybe remove original "Orders" menu
85
- if ( 'yes' === get_option( 'wcj_order_admin_list_multiple_status_admin_menu_remove_original', 'no' ) ) {
86
  remove_submenu_page( 'woocommerce', 'edit.php?post_type=shop_order' );
87
  }
88
  // Add presets
89
- $titles = get_option( 'wcj_order_admin_list_multiple_status_presets_titles', array() );
90
- $statuses = get_option( 'wcj_order_admin_list_multiple_status_presets_statuses', array() );
91
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_order_admin_list_multiple_status_presets_total_number', 1 ) );
92
  for ( $i = 1; $i <= $total_number; $i++ ) {
93
  if ( ! empty( $titles[ $i ] ) && ! empty( $statuses[ $i ] ) ) {
94
  $menu_slug = 'edit.php?post_type=shop_order';
@@ -96,7 +96,7 @@ class WCJ_Admin_Orders_List extends WCJ_Module {
96
  $menu_slug .= "&wcj_admin_filter_statuses[{$x}]={$status}";
97
  }
98
  $orders_count_html = '';
99
- if ( 'yes' === get_option( 'wcj_order_admin_list_multiple_status_admin_menu_counter', 'no' ) ) {
100
  $order_count = 0;
101
  foreach ( $statuses[ $i ] as $x => $status ) {
102
  $order_count += wc_orders_count( substr( $status, 3 ) );
@@ -128,8 +128,8 @@ class WCJ_Admin_Orders_List extends WCJ_Module {
128
  ) {
129
  if ( 'wcj_orders_custom_column_' === substr( $orderby, 0, 25 ) ) {
130
  $index = substr( $orderby, 25 );
131
- $query->set( 'orderby', get_option( 'wcj_orders_list_custom_columns_sortable_' . $index, 'no' ) ); // 'meta_value' or 'meta_value_num'
132
- $query->set( 'meta_key', get_option( 'wcj_orders_list_custom_columns_sortable_key_' . $index, '' ) );
133
  }
134
  }
135
  }
@@ -144,10 +144,10 @@ class WCJ_Admin_Orders_List extends WCJ_Module {
144
  */
145
  function shop_order_sortable_columns( $columns ) {
146
  $custom = array();
147
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_orders_list_custom_columns_total_number', 1 ) );
148
  for ( $i = 1; $i <= $total_number; $i++ ) {
149
- if ( 'yes' === get_option( 'wcj_orders_list_custom_columns_enabled_' . $i, 'no' ) ) {
150
- if ( 'no' != get_option( 'wcj_orders_list_custom_columns_sortable_' . $i, 'no' ) && '' != get_option( 'wcj_orders_list_custom_columns_sortable_key_' . $i, '' ) ) {
151
  $custom[ 'wcj_orders_custom_column_' . $i ] = 'wcj_orders_custom_column_' . $i;
152
  }
153
  }
@@ -265,7 +265,7 @@ class WCJ_Admin_Orders_List extends WCJ_Module {
265
  */
266
  function add_shop_order_multiple_statuses( $post_type, $which ) {
267
  if ( 'shop_order' === $post_type ) {
268
- echo $this->multiple_shop_order_statuses( get_option( 'wcj_order_admin_list_multiple_status_filter', 'no' ) );
269
  }
270
  }
271
 
@@ -300,13 +300,13 @@ class WCJ_Admin_Orders_List extends WCJ_Module {
300
  if ( $typenow != 'shop_order' ) {
301
  return;
302
  }
303
- if ( 'yes' === get_option( 'wcj_orders_list_custom_columns_country', 'no' ) && isset( $_GET['country'] ) && 'all' != $_GET['country'] ) {
304
  $query->query_vars['meta_query'][] = array(
305
  'key' => '_billing_country',
306
  'value' => $_GET['country'],
307
  );
308
  }
309
- if ( 'yes' === get_option( 'wcj_orders_list_custom_columns_currency', 'no' ) && isset( $_GET['currency'] ) && 'all' != $_GET['currency'] ) {
310
  $query->query_vars['meta_query'][] = array(
311
  'key' => '_order_currency',
312
  'value' => $_GET['currency'],
@@ -322,7 +322,7 @@ class WCJ_Admin_Orders_List extends WCJ_Module {
322
  function restrict_manage_posts() {
323
  global $typenow, $wp_query;
324
  if ( in_array( $typenow, wc_get_order_types( 'order-meta-boxes' ) ) ) {
325
- if ( 'yes' === get_option( 'wcj_orders_list_custom_columns_country', 'no' ) ) {
326
  $selected_coutry = isset( $_GET['country'] ) ? $_GET['country'] : 'all';
327
  $countries = array_merge( array( 'all' => __( 'All countries', 'woocommerce-jetpack' ) ), wcj_get_countries() );
328
  echo '<select id="country" name="country">';
@@ -331,7 +331,7 @@ class WCJ_Admin_Orders_List extends WCJ_Module {
331
  }
332
  echo '</select>';
333
  }
334
- if ( 'yes' === get_option( 'wcj_orders_list_custom_columns_currency', 'no' ) ) {
335
  $selected_currency = isset( $_GET['currency'] ) ? $_GET['currency'] : 'all';
336
  $currencies = array_merge( array( 'all' => __( 'All currencies', 'woocommerce-jetpack' ) ), wcj_get_woocommerce_currencies_and_symbols() );
337
  echo '<select id="currency" name="currency">';
@@ -350,7 +350,7 @@ class WCJ_Admin_Orders_List extends WCJ_Module {
350
  * @version 2.5.7
351
  */
352
  function rearange_order_columns( $columns ) {
353
- $reordered_columns = get_option( 'wcj_order_admin_list_columns_order', $this->get_orders_default_columns_in_order() );
354
  $reordered_columns = explode( PHP_EOL, $reordered_columns );
355
  $reordered_columns_result = array();
356
  if ( ! empty( $reordered_columns ) ) {
@@ -372,16 +372,16 @@ class WCJ_Admin_Orders_List extends WCJ_Module {
372
  * @version 2.8.0
373
  */
374
  function add_order_columns( $columns ) {
375
- if ( 'yes' === get_option( 'wcj_orders_list_custom_columns_country', 'no' ) ) {
376
  $columns['country'] = __( 'Billing Country', 'woocommerce-jetpack' );
377
  }
378
- if ( 'yes' === get_option( 'wcj_orders_list_custom_columns_currency', 'no' ) ) {
379
  $columns['currency'] = __( 'Currency Code', 'woocommerce-jetpack' );
380
  }
381
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_orders_list_custom_columns_total_number', 1 ) );
382
  for ( $i = 1; $i <= $total_number; $i++ ) {
383
- if ( 'yes' === get_option( 'wcj_orders_list_custom_columns_enabled_' . $i, 'no' ) ) {
384
- $columns[ 'wcj_orders_custom_column_' . $i ] = get_option( 'wcj_orders_list_custom_columns_label_' . $i, '' );
385
  }
386
  }
387
  return $columns;
@@ -394,19 +394,19 @@ class WCJ_Admin_Orders_List extends WCJ_Module {
394
  * @param string $column
395
  */
396
  function render_order_column( $column ) {
397
- if ( 'country' === $column && 'yes' === get_option( 'wcj_orders_list_custom_columns_country', 'no' ) ) {
398
  $country_code = do_shortcode( '[wcj_order_checkout_field field_id="billing_country"]' );
399
  echo ( 2 == strlen( $country_code ) )
400
  ? wcj_get_country_flag_by_code( $country_code ) . ' ' . wcj_get_country_name_by_code( $country_code )
401
  : wcj_get_country_name_by_code( $country_code );
402
- } elseif ( 'currency' === $column && 'yes' === get_option( 'wcj_orders_list_custom_columns_currency', 'no' ) ) {
403
  echo do_shortcode( '[wcj_order_currency]' );
404
  } else {
405
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_orders_list_custom_columns_total_number', 1 ) );
406
  for ( $i = 1; $i <= $total_number; $i++ ) {
407
- if ( 'yes' === get_option( 'wcj_orders_list_custom_columns_enabled_' . $i, 'no' ) ) {
408
  if ( 'wcj_orders_custom_column_' . $i === $column ) {
409
- echo do_shortcode( get_option( 'wcj_orders_list_custom_columns_value_' . $i, '' ) );
410
  }
411
  }
412
  }
31
  if ( $this->is_enabled() ) {
32
 
33
  // Custom columns
34
+ if ( 'yes' === wcj_get_option( 'wcj_order_admin_list_custom_columns_enabled', 'no' ) ) {
35
  add_filter( 'manage_edit-shop_order_columns', array( $this, 'add_order_columns' ), PHP_INT_MAX - 1 );
36
  add_action( 'manage_shop_order_posts_custom_column', array( $this, 'render_order_column' ), PHP_INT_MAX );
37
+ if ( 'yes' === wcj_get_option( 'wcj_orders_list_custom_columns_country', 'no' ) || 'yes' === wcj_get_option( 'wcj_orders_list_custom_columns_currency', 'no' ) ) {
38
  // Billing country or Currency filtering
39
  add_action( 'restrict_manage_posts', array( $this, 'restrict_manage_posts' ) );
40
  add_filter( 'parse_query', array( $this, 'parse_query' ) );
45
  }
46
 
47
  // Multiple status
48
+ if ( 'yes' === wcj_get_option( 'wcj_order_admin_list_multiple_status_enabled', 'no' ) ) {
49
+ if ( 'yes' === wcj_get_option( 'wcj_order_admin_list_multiple_status_not_completed_link', 'no' ) ) {
50
  add_filter( 'views_edit-shop_order', array( $this, 'add_shop_order_multiple_statuses_not_completed_link' ) );
51
  add_action( 'pre_get_posts', array( $this, 'filter_shop_order_multiple_statuses_not_completed_link' ), PHP_INT_MAX, 1 );
52
  }
53
+ if ( 'no' != wcj_get_option( 'wcj_order_admin_list_multiple_status_filter', 'no' ) ) {
54
  add_action( 'restrict_manage_posts', array( $this, 'add_shop_order_multiple_statuses' ), PHP_INT_MAX, 2 );
55
  add_action( 'pre_get_posts', array( $this, 'filter_shop_order_multiple_statuses' ), PHP_INT_MAX, 1 );
56
  }
57
+ if ( 'yes' === wcj_get_option( 'wcj_order_admin_list_hide_default_statuses_menu', 'no' ) ) {
58
  add_action( 'admin_head', array( $this, 'hide_default_statuses_menu' ), PHP_INT_MAX );
59
  }
60
+ if ( 'yes' === wcj_get_option( 'wcj_order_admin_list_multiple_status_admin_menu', 'no' ) ) {
61
  add_action( 'admin_menu', array( $this, 'admin_menu_multiple_status' ) );
62
  }
63
  }
64
 
65
  // Columns Order
66
+ if ( 'yes' === wcj_get_option( 'wcj_order_admin_list_columns_order_enabled', 'no' ) ) {
67
  add_filter( 'manage_edit-shop_order_columns', array( $this, 'rearange_order_columns' ), PHP_INT_MAX - 1 );
68
  }
69
 
82
  // Remove "Coupons" menu (to get "Orders" menus on top)
83
  $coupons_menu = remove_submenu_page( 'woocommerce', 'edit.php?post_type=shop_coupon' );
84
  // Maybe remove original "Orders" menu
85
+ if ( 'yes' === wcj_get_option( 'wcj_order_admin_list_multiple_status_admin_menu_remove_original', 'no' ) ) {
86
  remove_submenu_page( 'woocommerce', 'edit.php?post_type=shop_order' );
87
  }
88
  // Add presets
89
+ $titles = wcj_get_option( 'wcj_order_admin_list_multiple_status_presets_titles', array() );
90
+ $statuses = wcj_get_option( 'wcj_order_admin_list_multiple_status_presets_statuses', array() );
91
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_order_admin_list_multiple_status_presets_total_number', 1 ) );
92
  for ( $i = 1; $i <= $total_number; $i++ ) {
93
  if ( ! empty( $titles[ $i ] ) && ! empty( $statuses[ $i ] ) ) {
94
  $menu_slug = 'edit.php?post_type=shop_order';
96
  $menu_slug .= "&wcj_admin_filter_statuses[{$x}]={$status}";
97
  }
98
  $orders_count_html = '';
99
+ if ( 'yes' === wcj_get_option( 'wcj_order_admin_list_multiple_status_admin_menu_counter', 'no' ) ) {
100
  $order_count = 0;
101
  foreach ( $statuses[ $i ] as $x => $status ) {
102
  $order_count += wc_orders_count( substr( $status, 3 ) );
128
  ) {
129
  if ( 'wcj_orders_custom_column_' === substr( $orderby, 0, 25 ) ) {
130
  $index = substr( $orderby, 25 );
131
+ $query->set( 'orderby', wcj_get_option( 'wcj_orders_list_custom_columns_sortable_' . $index, 'no' ) ); // 'meta_value' or 'meta_value_num'
132
+ $query->set( 'meta_key', wcj_get_option( 'wcj_orders_list_custom_columns_sortable_key_' . $index, '' ) );
133
  }
134
  }
135
  }
144
  */
145
  function shop_order_sortable_columns( $columns ) {
146
  $custom = array();
147
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_orders_list_custom_columns_total_number', 1 ) );
148
  for ( $i = 1; $i <= $total_number; $i++ ) {
149
+ if ( 'yes' === wcj_get_option( 'wcj_orders_list_custom_columns_enabled_' . $i, 'no' ) ) {
150
+ if ( 'no' != wcj_get_option( 'wcj_orders_list_custom_columns_sortable_' . $i, 'no' ) && '' != wcj_get_option( 'wcj_orders_list_custom_columns_sortable_key_' . $i, '' ) ) {
151
  $custom[ 'wcj_orders_custom_column_' . $i ] = 'wcj_orders_custom_column_' . $i;
152
  }
153
  }
265
  */
266
  function add_shop_order_multiple_statuses( $post_type, $which ) {
267
  if ( 'shop_order' === $post_type ) {
268
+ echo $this->multiple_shop_order_statuses( wcj_get_option( 'wcj_order_admin_list_multiple_status_filter', 'no' ) );
269
  }
270
  }
271
 
300
  if ( $typenow != 'shop_order' ) {
301
  return;
302
  }
303
+ if ( 'yes' === wcj_get_option( 'wcj_orders_list_custom_columns_country', 'no' ) && isset( $_GET['country'] ) && 'all' != $_GET['country'] ) {
304
  $query->query_vars['meta_query'][] = array(
305
  'key' => '_billing_country',
306
  'value' => $_GET['country'],
307
  );
308
  }
309
+ if ( 'yes' === wcj_get_option( 'wcj_orders_list_custom_columns_currency', 'no' ) && isset( $_GET['currency'] ) && 'all' != $_GET['currency'] ) {
310
  $query->query_vars['meta_query'][] = array(
311
  'key' => '_order_currency',
312
  'value' => $_GET['currency'],
322
  function restrict_manage_posts() {
323
  global $typenow, $wp_query;
324
  if ( in_array( $typenow, wc_get_order_types( 'order-meta-boxes' ) ) ) {
325
+ if ( 'yes' === wcj_get_option( 'wcj_orders_list_custom_columns_country', 'no' ) ) {
326
  $selected_coutry = isset( $_GET['country'] ) ? $_GET['country'] : 'all';
327
  $countries = array_merge( array( 'all' => __( 'All countries', 'woocommerce-jetpack' ) ), wcj_get_countries() );
328
  echo '<select id="country" name="country">';
331
  }
332
  echo '</select>';
333
  }
334
+ if ( 'yes' === wcj_get_option( 'wcj_orders_list_custom_columns_currency', 'no' ) ) {
335
  $selected_currency = isset( $_GET['currency'] ) ? $_GET['currency'] : 'all';
336
  $currencies = array_merge( array( 'all' => __( 'All currencies', 'woocommerce-jetpack' ) ), wcj_get_woocommerce_currencies_and_symbols() );
337
  echo '<select id="currency" name="currency">';
350
  * @version 2.5.7
351
  */
352
  function rearange_order_columns( $columns ) {
353
+ $reordered_columns = wcj_get_option( 'wcj_order_admin_list_columns_order', $this->get_orders_default_columns_in_order() );
354
  $reordered_columns = explode( PHP_EOL, $reordered_columns );
355
  $reordered_columns_result = array();
356
  if ( ! empty( $reordered_columns ) ) {
372
  * @version 2.8.0
373
  */
374
  function add_order_columns( $columns ) {
375
+ if ( 'yes' === wcj_get_option( 'wcj_orders_list_custom_columns_country', 'no' ) ) {
376
  $columns['country'] = __( 'Billing Country', 'woocommerce-jetpack' );
377
  }
378
+ if ( 'yes' === wcj_get_option( 'wcj_orders_list_custom_columns_currency', 'no' ) ) {
379
  $columns['currency'] = __( 'Currency Code', 'woocommerce-jetpack' );
380
  }
381
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_orders_list_custom_columns_total_number', 1 ) );
382
  for ( $i = 1; $i <= $total_number; $i++ ) {
383
+ if ( 'yes' === wcj_get_option( 'wcj_orders_list_custom_columns_enabled_' . $i, 'no' ) ) {
384
+ $columns[ 'wcj_orders_custom_column_' . $i ] = wcj_get_option( 'wcj_orders_list_custom_columns_label_' . $i, '' );
385
  }
386
  }
387
  return $columns;
394
  * @param string $column
395
  */
396
  function render_order_column( $column ) {
397
+ if ( 'country' === $column && 'yes' === wcj_get_option( 'wcj_orders_list_custom_columns_country', 'no' ) ) {
398
  $country_code = do_shortcode( '[wcj_order_checkout_field field_id="billing_country"]' );
399
  echo ( 2 == strlen( $country_code ) )
400
  ? wcj_get_country_flag_by_code( $country_code ) . ' ' . wcj_get_country_name_by_code( $country_code )
401
  : wcj_get_country_name_by_code( $country_code );
402
+ } elseif ( 'currency' === $column && 'yes' === wcj_get_option( 'wcj_orders_list_custom_columns_currency', 'no' ) ) {
403
  echo do_shortcode( '[wcj_order_currency]' );
404
  } else {
405
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_orders_list_custom_columns_total_number', 1 ) );
406
  for ( $i = 1; $i <= $total_number; $i++ ) {
407
+ if ( 'yes' === wcj_get_option( 'wcj_orders_list_custom_columns_enabled_' . $i, 'no' ) ) {
408
  if ( 'wcj_orders_custom_column_' . $i === $column ) {
409
+ echo do_shortcode( wcj_get_option( 'wcj_orders_list_custom_columns_value_' . $i, '' ) );
410
  }
411
  }
412
  }
includes/class-wcj-admin-products-list.php CHANGED
@@ -30,13 +30,13 @@ class WCJ_Admin_Products_List extends WCJ_Module {
30
 
31
  if ( $this->is_enabled() ) {
32
  // Admin list - custom columns
33
- if ( 'yes' === get_option( 'wcj_products_admin_list_custom_columns_enabled', 'no' ) ) {
34
  add_filter( 'manage_edit-product_columns', array( $this, 'add_product_columns' ), PHP_INT_MAX );
35
  add_action( 'manage_product_posts_custom_column', array( $this, 'render_product_column' ), PHP_INT_MAX );
36
  }
37
 
38
  // Admin list - columns order
39
- if ( 'yes' === get_option( 'wcj_products_admin_list_columns_order_enabled', 'no' ) ) {
40
  add_filter( 'manage_edit-product_columns', array( $this, 'rearange_product_columns' ), PHP_INT_MAX );
41
  }
42
  }
@@ -49,7 +49,7 @@ class WCJ_Admin_Products_List extends WCJ_Module {
49
  * @since 2.9.0
50
  */
51
  function rearange_product_columns( $columns ) {
52
- $reordered_columns = get_option( 'wcj_products_admin_list_columns_order', $this->get_products_default_columns_in_order() );
53
  $reordered_columns = explode( PHP_EOL, $reordered_columns );
54
  $reordered_columns_result = array();
55
  if ( ! empty( $reordered_columns ) ) {
@@ -95,10 +95,10 @@ class WCJ_Admin_Products_List extends WCJ_Module {
95
  * @since 2.9.0
96
  */
97
  function add_product_columns( $columns ) {
98
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_products_admin_list_custom_columns_total_number', 1 ) );
99
  for ( $i = 1; $i <= $total_number; $i++ ) {
100
- if ( 'yes' === get_option( 'wcj_products_admin_list_custom_columns_enabled_' . $i, 'no' ) ) {
101
- $columns[ 'wcj_products_custom_column_' . $i ] = get_option( 'wcj_products_admin_list_custom_columns_label_' . $i, '' );
102
  }
103
  }
104
  return $columns;
@@ -111,11 +111,11 @@ class WCJ_Admin_Products_List extends WCJ_Module {
111
  * @since 2.9.0
112
  */
113
  function render_product_column( $column ) {
114
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_products_admin_list_custom_columns_total_number', 1 ) );
115
  for ( $i = 1; $i <= $total_number; $i++ ) {
116
- if ( 'yes' === get_option( 'wcj_products_admin_list_custom_columns_enabled_' . $i, 'no' ) ) {
117
  if ( 'wcj_products_custom_column_' . $i === $column ) {
118
- echo do_shortcode( get_option( 'wcj_products_admin_list_custom_columns_value_' . $i, '' ) );
119
  }
120
  }
121
  }
30
 
31
  if ( $this->is_enabled() ) {
32
  // Admin list - custom columns
33
+ if ( 'yes' === wcj_get_option( 'wcj_products_admin_list_custom_columns_enabled', 'no' ) ) {
34
  add_filter( 'manage_edit-product_columns', array( $this, 'add_product_columns' ), PHP_INT_MAX );
35
  add_action( 'manage_product_posts_custom_column', array( $this, 'render_product_column' ), PHP_INT_MAX );
36
  }
37
 
38
  // Admin list - columns order
39
+ if ( 'yes' === wcj_get_option( 'wcj_products_admin_list_columns_order_enabled', 'no' ) ) {
40
  add_filter( 'manage_edit-product_columns', array( $this, 'rearange_product_columns' ), PHP_INT_MAX );
41
  }
42
  }
49
  * @since 2.9.0
50
  */
51
  function rearange_product_columns( $columns ) {
52
+ $reordered_columns = wcj_get_option( 'wcj_products_admin_list_columns_order', $this->get_products_default_columns_in_order() );
53
  $reordered_columns = explode( PHP_EOL, $reordered_columns );
54
  $reordered_columns_result = array();
55
  if ( ! empty( $reordered_columns ) ) {
95
  * @since 2.9.0
96
  */
97
  function add_product_columns( $columns ) {
98
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_products_admin_list_custom_columns_total_number', 1 ) );
99
  for ( $i = 1; $i <= $total_number; $i++ ) {
100
+ if ( 'yes' === wcj_get_option( 'wcj_products_admin_list_custom_columns_enabled_' . $i, 'no' ) ) {
101
+ $columns[ 'wcj_products_custom_column_' . $i ] = wcj_get_option( 'wcj_products_admin_list_custom_columns_label_' . $i, '' );
102
  }
103
  }
104
  return $columns;
111
  * @since 2.9.0
112
  */
113
  function render_product_column( $column ) {
114
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_products_admin_list_custom_columns_total_number', 1 ) );
115
  for ( $i = 1; $i <= $total_number; $i++ ) {
116
+ if ( 'yes' === wcj_get_option( 'wcj_products_admin_list_custom_columns_enabled_' . $i, 'no' ) ) {
117
  if ( 'wcj_products_custom_column_' . $i === $column ) {
118
+ echo do_shortcode( wcj_get_option( 'wcj_products_admin_list_custom_columns_value_' . $i, '' ) );
119
  }
120
  }
121
  }
includes/class-wcj-admin-tools.php CHANGED
@@ -36,32 +36,32 @@ class WCJ_Admin_Tools extends WCJ_Module {
36
 
37
  if ( $this->is_enabled() ) {
38
  // Order Meta
39
- if ( 'yes' === get_option( 'wcj_admin_tools_show_order_meta_enabled', 'no' ) ) {
40
  add_action( 'add_meta_boxes', array( $this, 'add_order_meta_meta_box' ) );
41
  }
42
  // Product Meta
43
- if ( 'yes' === get_option( 'wcj_admin_tools_show_product_meta_enabled', 'no' ) ) {
44
  add_action( 'add_meta_boxes', array( $this, 'add_product_meta_meta_box' ) );
45
  }
46
  // Variable Product Pricing
47
- if ( 'yes' === get_option( 'wcj_admin_tools_variable_product_pricing_table_enabled', 'no' ) ) {
48
  add_action( 'admin_head', array( $this, 'make_original_variable_product_pricing_readonly' ) );
49
  add_action( 'add_meta_boxes', array( $this, 'maybe_add_variable_product_pricing_meta_box' ) );
50
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
51
  }
52
  // Product revisions
53
- if ( 'yes' === get_option( 'wcj_product_revisions_enabled', 'no' ) ) {
54
  add_filter( 'woocommerce_register_post_type_product', array( $this, 'enable_product_revisions' ) );
55
  }
56
  // Admin Notices
57
- if ( 'yes' === get_option( 'wcj_admin_tools_suppress_connect_notice', 'no' ) ) {
58
  add_filter( 'woocommerce_helper_suppress_connect_notice', '__return_true' );
59
  }
60
- if ( 'yes' === get_option( 'wcj_admin_tools_suppress_admin_notices', 'no' ) ) {
61
  add_filter( 'woocommerce_helper_suppress_admin_notices', '__return_true' );
62
  }
63
  // JSON product search limit
64
- if ( 0 != get_option( 'wcj_product_json_search_limit', 0 ) ) {
65
  add_filter( 'woocommerce_json_search_limit', array( $this, 'set_json_search_limit' ) );
66
  }
67
  // Enable interface by user role
@@ -85,7 +85,7 @@ class WCJ_Admin_Tools extends WCJ_Module {
85
  */
86
  function change_shop_manager_editable_roles( $roles ) {
87
  remove_filter( 'woocommerce_shop_manager_editable_roles', array( $this, 'change_shop_manager_editable_roles' ) );
88
- $roles = get_option( 'wcj_admin_tools_shop_manager_editable_roles', apply_filters( 'woocommerce_shop_manager_editable_roles', array( 'customer' ) ) );
89
  return $roles;
90
  }
91
 
@@ -100,7 +100,7 @@ class WCJ_Admin_Tools extends WCJ_Module {
100
  * @return bool
101
  */
102
  function enable_interface_by_user_roles( $allowed ) {
103
- if ( empty( $disabled_roles = get_option( 'wcj_admin_tools_enable_interface_by_role', array() ) ) ) {
104
  return $allowed;
105
  }
106
  $current_user_roles = wcj_get_current_user_all_roles();
@@ -120,7 +120,7 @@ class WCJ_Admin_Tools extends WCJ_Module {
120
  * @since 4.1.0
121
  */
122
  function set_json_search_limit( $limit ) {
123
- return get_option( 'wcj_product_json_search_limit', 0 );
124
  }
125
 
126
  /**
36
 
37
  if ( $this->is_enabled() ) {
38
  // Order Meta
39
+ if ( 'yes' === wcj_get_option( 'wcj_admin_tools_show_order_meta_enabled', 'no' ) ) {
40
  add_action( 'add_meta_boxes', array( $this, 'add_order_meta_meta_box' ) );
41
  }
42
  // Product Meta
43
+ if ( 'yes' === wcj_get_option( 'wcj_admin_tools_show_product_meta_enabled', 'no' ) ) {
44
  add_action( 'add_meta_boxes', array( $this, 'add_product_meta_meta_box' ) );
45
  }
46
  // Variable Product Pricing
47
+ if ( 'yes' === wcj_get_option( 'wcj_admin_tools_variable_product_pricing_table_enabled', 'no' ) ) {
48
  add_action( 'admin_head', array( $this, 'make_original_variable_product_pricing_readonly' ) );
49
  add_action( 'add_meta_boxes', array( $this, 'maybe_add_variable_product_pricing_meta_box' ) );
50
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
51
  }
52
  // Product revisions
53
+ if ( 'yes' === wcj_get_option( 'wcj_product_revisions_enabled', 'no' ) ) {
54
  add_filter( 'woocommerce_register_post_type_product', array( $this, 'enable_product_revisions' ) );
55
  }
56
  // Admin Notices
57
+ if ( 'yes' === wcj_get_option( 'wcj_admin_tools_suppress_connect_notice', 'no' ) ) {
58
  add_filter( 'woocommerce_helper_suppress_connect_notice', '__return_true' );
59
  }
60
+ if ( 'yes' === wcj_get_option( 'wcj_admin_tools_suppress_admin_notices', 'no' ) ) {
61
  add_filter( 'woocommerce_helper_suppress_admin_notices', '__return_true' );
62
  }
63
  // JSON product search limit
64
+ if ( 0 != wcj_get_option( 'wcj_product_json_search_limit', 0 ) ) {
65
  add_filter( 'woocommerce_json_search_limit', array( $this, 'set_json_search_limit' ) );
66
  }
67
  // Enable interface by user role
85
  */
86
  function change_shop_manager_editable_roles( $roles ) {
87
  remove_filter( 'woocommerce_shop_manager_editable_roles', array( $this, 'change_shop_manager_editable_roles' ) );
88
+ $roles = wcj_get_option( 'wcj_admin_tools_shop_manager_editable_roles', apply_filters( 'woocommerce_shop_manager_editable_roles', array( 'customer' ) ) );
89
  return $roles;
90
  }
91
 
100
  * @return bool
101
  */
102
  function enable_interface_by_user_roles( $allowed ) {
103
+ if ( empty( $disabled_roles = wcj_get_option( 'wcj_admin_tools_enable_interface_by_role', array() ) ) ) {
104
  return $allowed;
105
  }
106
  $current_user_roles = wcj_get_current_user_all_roles();
120
  * @since 4.1.0
121
  */
122
  function set_json_search_limit( $limit ) {
123
+ return wcj_get_option( 'wcj_product_json_search_limit', 0 );
124
  }
125
 
126
  /**
includes/class-wcj-breadcrumbs.php CHANGED
@@ -33,13 +33,13 @@ class WCJ_Breadcrumbs extends WCJ_Module {
33
 
34
  if ( $this->is_enabled() ) {
35
  // Hide Breadcrumbs
36
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_breadcrumbs_hide', 'no' ) ) ) {
37
  add_filter( 'woocommerce_get_breadcrumb', '__return_false', PHP_INT_MAX );
38
  add_action( 'wp_head', array( $this, 'hide_breadcrumbs_with_css' ) );
39
  add_action( 'wp_loaded', array( $this, 'hide_breadcrumbs_by_removing_action' ), PHP_INT_MAX );
40
  }
41
  // Home URL
42
- if ( 'yes' === get_option( 'wcj_breadcrumbs_change_home_url_enabled', 'no' ) ) {
43
  add_filter( 'woocommerce_breadcrumb_home_url', array( $this, 'change_home_url' ), PHP_INT_MAX );
44
  }
45
  }
@@ -52,7 +52,7 @@ class WCJ_Breadcrumbs extends WCJ_Module {
52
  * @since 2.9.0
53
  */
54
  function change_home_url( $_url ) {
55
- return get_option( 'wcj_breadcrumbs_home_url', home_url() );
56
  }
57
 
58
  /**
33
 
34
  if ( $this->is_enabled() ) {
35
  // Hide Breadcrumbs
36
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_breadcrumbs_hide', 'no' ) ) ) {
37
  add_filter( 'woocommerce_get_breadcrumb', '__return_false', PHP_INT_MAX );
38
  add_action( 'wp_head', array( $this, 'hide_breadcrumbs_with_css' ) );
39
  add_action( 'wp_loaded', array( $this, 'hide_breadcrumbs_by_removing_action' ), PHP_INT_MAX );
40
  }
41
  // Home URL
42
+ if ( 'yes' === wcj_get_option( 'wcj_breadcrumbs_change_home_url_enabled', 'no' ) ) {
43
  add_filter( 'woocommerce_breadcrumb_home_url', array( $this, 'change_home_url' ), PHP_INT_MAX );
44
  }
45
  }
52
  * @since 2.9.0
53
  */
54
  function change_home_url( $_url ) {
55
+ return wcj_get_option( 'wcj_breadcrumbs_home_url', home_url() );
56
  }
57
 
58
  /**
includes/class-wcj-call-for-price.php CHANGED
@@ -35,7 +35,7 @@ class WCJ_Call_For_Price extends WCJ_module {
35
  add_action( 'admin_head', array( $this, 'hide_variation_price_required_placeholder' ), PHP_INT_MAX );
36
  add_filter( 'woocommerce_variation_is_visible', array( $this, 'make_variation_visible_with_empty_price' ), PHP_INT_MAX, 4 );
37
  add_action( 'wp_head', array( $this, 'hide_disabled_variation_add_to_cart_button' ) );
38
- if ( 'yes' === get_option( 'wcj_call_for_price_make_all_empty', 'no' ) ) {
39
  add_filter( WCJ_PRODUCT_GET_PRICE_FILTER, array( $this, 'make_empty_price' ), PHP_INT_MAX, 2 );
40
  add_filter( 'woocommerce_variation_prices_price', array( $this, 'make_empty_price' ), PHP_INT_MAX, 2 );
41
  if ( ! WCJ_IS_WC_VERSION_BELOW_3 ) {
@@ -139,7 +139,7 @@ class WCJ_Call_For_Price extends WCJ_module {
139
  * @todo recheck if we really need this
140
  */
141
  function hide_sales_flash( $onsale_html, $post, $product ) {
142
- if ( 'yes' === get_option( 'wcj_call_for_price_hide_sale_sign', 'yes' ) && '' === $product->get_price() ) {
143
  return '';
144
  }
145
  return $onsale_html;
@@ -152,16 +152,16 @@ class WCJ_Call_For_Price extends WCJ_module {
152
  * @todo `is_page()`
153
  */
154
  function on_empty_price( $price, $_product ) {
155
- if ( '' !== get_option( 'wcj_call_for_price_text_variation' ) && $_product->is_type( 'variation' ) ) {
156
- return do_shortcode( apply_filters( 'booster_option', '<strong>Call for price</strong>', get_option( 'wcj_call_for_price_text_variation' ) ) );
157
- } elseif ( '' !== get_option( 'wcj_call_for_price_text' ) && is_single( get_the_ID() ) ) {
158
- return do_shortcode( apply_filters( 'booster_option', '<strong>Call for price</strong>', get_option( 'wcj_call_for_price_text' ) ) );
159
- } elseif ( '' !== get_option( 'wcj_call_for_price_text_on_related' ) && is_single() && ! is_single( get_the_ID() ) ) {
160
- return do_shortcode( apply_filters( 'booster_option', '<strong>Call for price</strong>', get_option( 'wcj_call_for_price_text_on_related' ) ) );
161
- } elseif ( '' !== get_option( 'wcj_call_for_price_text_on_archive' ) && is_archive() ) {
162
- return do_shortcode( apply_filters( 'booster_option', '<strong>Call for price</strong>', get_option( 'wcj_call_for_price_text_on_archive' ) ) );
163
- } elseif ( '' !== get_option( 'wcj_call_for_price_text_on_home' ) && is_front_page() ) {
164
- return do_shortcode( apply_filters( 'booster_option', '<strong>Call for price</strong>', get_option( 'wcj_call_for_price_text_on_home' ) ) );
165
  } else {
166
  return $price;
167
  }
35
  add_action( 'admin_head', array( $this, 'hide_variation_price_required_placeholder' ), PHP_INT_MAX );
36
  add_filter( 'woocommerce_variation_is_visible', array( $this, 'make_variation_visible_with_empty_price' ), PHP_INT_MAX, 4 );
37
  add_action( 'wp_head', array( $this, 'hide_disabled_variation_add_to_cart_button' ) );
38
+ if ( 'yes' === wcj_get_option( 'wcj_call_for_price_make_all_empty', 'no' ) ) {
39
  add_filter( WCJ_PRODUCT_GET_PRICE_FILTER, array( $this, 'make_empty_price' ), PHP_INT_MAX, 2 );
40
  add_filter( 'woocommerce_variation_prices_price', array( $this, 'make_empty_price' ), PHP_INT_MAX, 2 );
41
  if ( ! WCJ_IS_WC_VERSION_BELOW_3 ) {
139
  * @todo recheck if we really need this
140
  */
141
  function hide_sales_flash( $onsale_html, $post, $product ) {
142
+ if ( 'yes' === wcj_get_option( 'wcj_call_for_price_hide_sale_sign', 'yes' ) && '' === $product->get_price() ) {
143
  return '';
144
  }
145
  return $onsale_html;
152
  * @todo `is_page()`
153
  */
154
  function on_empty_price( $price, $_product ) {
155
+ if ( '' !== wcj_get_option( 'wcj_call_for_price_text_variation' ) && $_product->is_type( 'variation' ) ) {
156
+ return do_shortcode( apply_filters( 'booster_option', '<strong>Call for price</strong>', wcj_get_option( 'wcj_call_for_price_text_variation' ) ) );
157
+ } elseif ( '' !== wcj_get_option( 'wcj_call_for_price_text' ) && is_single( get_the_ID() ) ) {
158
+ return do_shortcode( apply_filters( 'booster_option', '<strong>Call for price</strong>', wcj_get_option( 'wcj_call_for_price_text' ) ) );
159
+ } elseif ( '' !== wcj_get_option( 'wcj_call_for_price_text_on_related' ) && is_single() && ! is_single( get_the_ID() ) ) {
160
+ return do_shortcode( apply_filters( 'booster_option', '<strong>Call for price</strong>', wcj_get_option( 'wcj_call_for_price_text_on_related' ) ) );
161
+ } elseif ( '' !== wcj_get_option( 'wcj_call_for_price_text_on_archive' ) && is_archive() ) {
162
+ return do_shortcode( apply_filters( 'booster_option', '<strong>Call for price</strong>', wcj_get_option( 'wcj_call_for_price_text_on_archive' ) ) );
163
+ } elseif ( '' !== wcj_get_option( 'wcj_call_for_price_text_on_home' ) && is_front_page() ) {
164
+ return do_shortcode( apply_filters( 'booster_option', '<strong>Call for price</strong>', wcj_get_option( 'wcj_call_for_price_text_on_home' ) ) );
165
  } else {
166
  return $price;
167
  }
includes/class-wcj-cart-customization.php CHANGED
@@ -29,16 +29,16 @@ class WCJ_Cart_Customization extends WCJ_Module {
29
 
30
  if ( $this->is_enabled() ) {
31
  // Hide coupon
32
- if ( 'yes' === get_option( 'wcj_cart_hide_coupon', 'no' ) ) {
33
  add_filter( 'woocommerce_coupons_enabled', array( $this, 'hide_coupon_field_on_cart' ), PHP_INT_MAX );
34
  }
35
  // Hide item remove link
36
- if ( 'yes' === get_option( 'wcj_cart_hide_item_remove_link', 'no' ) ) {
37
  add_filter( 'woocommerce_cart_item_remove_link', '__return_empty_string', PHP_INT_MAX );
38
  }
39
  // Customize "Return to shop" button text
40
- if ( 'yes' === get_option( 'wcj_cart_customization_return_to_shop_button_enabled', 'no' ) ) {
41
- if ( 'js' === get_option( 'wcj_cart_customization_return_to_shop_button_text_method', 'js' ) ) {
42
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
43
  } else { // 'template'
44
  add_filter( 'wc_get_template', array( $this, 'replace_empty_cart_template' ), PHP_INT_MAX, 5 );
@@ -46,7 +46,7 @@ class WCJ_Cart_Customization extends WCJ_Module {
46
  }
47
  }
48
  // Customize "Return to shop" button link
49
- if ( 'yes' === get_option( 'wcj_cart_customization_return_to_shop_button_link_enabled', 'no' ) ) {
50
  add_action( 'woocommerce_return_to_shop_redirect', array( $this, 'change_empty_cart_return_to_shop_link' ) );
51
  }
52
  }
@@ -59,7 +59,7 @@ class WCJ_Cart_Customization extends WCJ_Module {
59
  * @since 3.1.0
60
  */
61
  function change_empty_cart_button_text( $text ) {
62
- return get_option( 'wcj_cart_customization_return_to_shop_button_text', __( 'Return to shop', 'woocommerce' ) );
63
  }
64
 
65
  /**
@@ -84,7 +84,7 @@ class WCJ_Cart_Customization extends WCJ_Module {
84
  * @todo [dev] (maybe) check if link is not empty
85
  */
86
  function change_empty_cart_return_to_shop_link( $link ) {
87
- return ( is_cart() ? get_option( 'wcj_cart_customization_return_to_shop_button_link', '' ) : $link );
88
  }
89
 
90
  /**
@@ -97,7 +97,7 @@ class WCJ_Cart_Customization extends WCJ_Module {
97
  function enqueue_scripts() {
98
  wp_enqueue_script( 'wcj-cart-customization', wcj_plugin_url() . '/includes/js/wcj-cart-customization.js', array( 'jquery' ), WCJ()->version, false );
99
  wp_localize_script( 'wcj-cart-customization', 'wcj_cart_customization', array(
100
- 'return_to_shop_button_text' => get_option( 'wcj_cart_customization_return_to_shop_button_text', __( 'Return to shop', 'woocommerce' ) ),
101
  ) );
102
  }
103
 
29
 
30
  if ( $this->is_enabled() ) {
31
  // Hide coupon
32
+ if ( 'yes' === wcj_get_option( 'wcj_cart_hide_coupon', 'no' ) ) {
33
  add_filter( 'woocommerce_coupons_enabled', array( $this, 'hide_coupon_field_on_cart' ), PHP_INT_MAX );
34
  }
35
  // Hide item remove link
36
+ if ( 'yes' === wcj_get_option( 'wcj_cart_hide_item_remove_link', 'no' ) ) {
37
  add_filter( 'woocommerce_cart_item_remove_link', '__return_empty_string', PHP_INT_MAX );
38
  }
39
  // Customize "Return to shop" button text
40
+ if ( 'yes' === wcj_get_option( 'wcj_cart_customization_return_to_shop_button_enabled', 'no' ) ) {
41
+ if ( 'js' === wcj_get_option( 'wcj_cart_customization_return_to_shop_button_text_method', 'js' ) ) {
42
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
43
  } else { // 'template'
44
  add_filter( 'wc_get_template', array( $this, 'replace_empty_cart_template' ), PHP_INT_MAX, 5 );
46
  }
47
  }
48
  // Customize "Return to shop" button link
49
+ if ( 'yes' === wcj_get_option( 'wcj_cart_customization_return_to_shop_button_link_enabled', 'no' ) ) {
50
  add_action( 'woocommerce_return_to_shop_redirect', array( $this, 'change_empty_cart_return_to_shop_link' ) );
51
  }
52
  }
59
  * @since 3.1.0
60
  */
61
  function change_empty_cart_button_text( $text ) {
62
+ return wcj_get_option( 'wcj_cart_customization_return_to_shop_button_text', __( 'Return to shop', 'woocommerce' ) );
63
  }
64
 
65
  /**
84
  * @todo [dev] (maybe) check if link is not empty
85
  */
86
  function change_empty_cart_return_to_shop_link( $link ) {
87
+ return ( is_cart() ? wcj_get_option( 'wcj_cart_customization_return_to_shop_button_link', '' ) : $link );
88
  }
89
 
90
  /**
97
  function enqueue_scripts() {
98
  wp_enqueue_script( 'wcj-cart-customization', wcj_plugin_url() . '/includes/js/wcj-cart-customization.js', array( 'jquery' ), WCJ()->version, false );
99
  wp_localize_script( 'wcj-cart-customization', 'wcj_cart_customization', array(
100
+ 'return_to_shop_button_text' => wcj_get_option( 'wcj_cart_customization_return_to_shop_button_text', __( 'Return to shop', 'woocommerce' ) ),
101
  ) );
102
  }
103
 
includes/class-wcj-cart.php CHANGED
@@ -30,7 +30,7 @@ class WCJ_Cart extends WCJ_Module {
30
  // Cart items table custom info
31
  add_filter( 'woocommerce_cart_item_name', array( $this, 'add_custom_info_to_cart_item_name' ), PHP_INT_MAX, 3 );
32
  // Cart custom info
33
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_cart_custom_info_total_number', 1 ) );
34
  for ( $i = 1; $i <= $total_number; $i++) {
35
  add_action(
36
  get_option( 'wcj_cart_custom_info_hook_' . $i, 'woocommerce_after_cart_totals' ),
@@ -49,7 +49,7 @@ class WCJ_Cart extends WCJ_Module {
49
  * @todo (maybe) `wc_setup_product_data( $post );`
50
  */
51
  function add_custom_info_to_cart_item_name( $product_title, $cart_item, $cart_item_key ) {
52
- $custom_content = get_option( 'wcj_cart_custom_info_item' );
53
  if ( '' != $custom_content ) {
54
  global $post;
55
  $product_id = ( ! empty( $cart_item['variation_id'] ) ? $cart_item['variation_id'] : $cart_item['product_id'] );
@@ -69,14 +69,14 @@ class WCJ_Cart extends WCJ_Module {
69
  function add_cart_custom_info() {
70
  $current_filter = current_filter();
71
  $current_filter_priority = wcj_current_filter_priority();
72
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_cart_custom_info_total_number', 1 ) );
73
  for ( $i = 1; $i <= $total_number; $i++ ) {
74
  if (
75
- '' != get_option( 'wcj_cart_custom_info_content_' . $i ) &&
76
- $current_filter === get_option( 'wcj_cart_custom_info_hook_' . $i, 'woocommerce_after_cart_totals' ) &&
77
- $current_filter_priority == get_option( 'wcj_cart_custom_info_priority_' . $i, 10 )
78
  ) {
79
- echo do_shortcode( get_option( 'wcj_cart_custom_info_content_' . $i ) );
80
  }
81
  }
82
  }
30
  // Cart items table custom info
31
  add_filter( 'woocommerce_cart_item_name', array( $this, 'add_custom_info_to_cart_item_name' ), PHP_INT_MAX, 3 );
32
  // Cart custom info
33
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_cart_custom_info_total_number', 1 ) );
34
  for ( $i = 1; $i <= $total_number; $i++) {
35
  add_action(
36
  get_option( 'wcj_cart_custom_info_hook_' . $i, 'woocommerce_after_cart_totals' ),
49
  * @todo (maybe) `wc_setup_product_data( $post );`
50
  */
51
  function add_custom_info_to_cart_item_name( $product_title, $cart_item, $cart_item_key ) {
52
+ $custom_content = wcj_get_option( 'wcj_cart_custom_info_item' );
53
  if ( '' != $custom_content ) {
54
  global $post;
55
  $product_id = ( ! empty( $cart_item['variation_id'] ) ? $cart_item['variation_id'] : $cart_item['product_id'] );
69
  function add_cart_custom_info() {
70
  $current_filter = current_filter();
71
  $current_filter_priority = wcj_current_filter_priority();
72
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_cart_custom_info_total_number', 1 ) );
73
  for ( $i = 1; $i <= $total_number; $i++ ) {
74
  if (
75
+ '' != wcj_get_option( 'wcj_cart_custom_info_content_' . $i ) &&
76
+ $current_filter === wcj_get_option( 'wcj_cart_custom_info_hook_' . $i, 'woocommerce_after_cart_totals' ) &&
77
+ $current_filter_priority == wcj_get_option( 'wcj_cart_custom_info_priority_' . $i, 10 )
78
  ) {
79
+ echo do_shortcode( wcj_get_option( 'wcj_cart_custom_info_content_' . $i ) );
80
  }
81
  }
82
  }
includes/class-wcj-checkout-core-fields.php CHANGED
@@ -57,10 +57,10 @@ class WCJ_Checkout_Core_Fields extends WCJ_Module {
57
 
58
  if ( $this->is_enabled() ) {
59
  add_filter( 'woocommerce_checkout_fields' , array( $this, 'custom_override_checkout_fields' ), PHP_INT_MAX );
60
- if ( 'disable' != ( $this->country_locale_override = get_option( 'wcj_checkout_core_fields_override_country_locale_fields', 'billing' ) ) ) {
61
  add_filter( 'woocommerce_get_country_locale', array( $this, 'custom_override_country_locale_fields' ), PHP_INT_MAX );
62
  }
63
- if ( 'disable' != ( $this->default_address_override = get_option( 'wcj_checkout_core_fields_override_default_address_fields', 'billing' ) ) ) {
64
  add_filter( 'woocommerce_default_address_fields', array( $this, 'custom_override_default_address_fields' ), PHP_INT_MAX );
65
  }
66
  }
@@ -103,7 +103,7 @@ class WCJ_Checkout_Core_Fields extends WCJ_Module {
103
  $default_value = $option_data['default'];
104
  $option_id = ( isset( $option_data['option_id'] ) ? $option_data['option_id'] : $option );
105
  $option_id = 'wcj_checkout_fields_' . $field . '_' . $option_id;
106
- if ( $default_value != ( $value = get_option( $option_id, $default_value ) ) ) {
107
  $value = ( isset( $option_data['values'][ $value ] ) ? $option_data['values'][ $value ] : $value );
108
  $fields[ $field_key ][ $option ] = $value;
109
  }
@@ -148,7 +148,7 @@ class WCJ_Checkout_Core_Fields extends WCJ_Module {
148
  $field_parts = explode( '_', $field, 2 );
149
  $section = ( ! empty( $field_parts ) && is_array( $field_parts ) ? $field_parts[0] : '' ); // billing or shipping
150
  // enabled
151
- if ( 'no' === ( $is_enabled = get_option( 'wcj_checkout_fields_' . $field . '_' . 'is_enabled', 'default' ) ) ) {
152
  if ( isset( $checkout_fields[ $section ][ $field ] ) ) {
153
  unset( $checkout_fields[ $section ][ $field ] ); // e.g. unset( $checkout_fields['billing']['billing_country'] );
154
  continue;
@@ -158,43 +158,43 @@ class WCJ_Checkout_Core_Fields extends WCJ_Module {
158
  if ( ! $this->is_visible( array(
159
  'include_products' => '',
160
  'exclude_products' => '',
161
- 'include_categories' => apply_filters( 'booster_option', '', get_option( 'wcj_checkout_fields_' . $field . '_' . 'cats_incl', '' ) ),
162
- 'exclude_categories' => apply_filters( 'booster_option', '', get_option( 'wcj_checkout_fields_' . $field . '_' . 'cats_excl', '' ) ),
163
  'include_tags' => '',
164
  'exclude_tags' => '',
165
- ), get_option( 'wcj_checkout_core_fields_checking_relation', 'all' ) )
166
  ) {
167
  unset( $checkout_fields[ $section ][ $field ] );
168
  continue;
169
  }
170
  if ( isset( $checkout_fields[ $section ][ $field ] ) ) {
171
  // required
172
- if ( 'default' != ( $is_required = get_option( 'wcj_checkout_fields_' . $field . '_' . 'is_required', 'default' ) ) ) {
173
  $checkout_fields[ $section ][ $field ]['required'] = ( 'yes' === $is_required );
174
  }
175
  // label
176
- if ( '' != ( $label = get_option( 'wcj_checkout_fields_' . $field . '_' . 'label', '' ) ) ) {
177
  $checkout_fields[ $section ][ $field ]['label'] = $label;
178
  }
179
  // placeholder
180
- if ( '' != ( $placeholder = get_option( 'wcj_checkout_fields_' . $field . '_' . 'placeholder', '' ) ) ) {
181
  $checkout_fields[ $section ][ $field ]['placeholder'] = $placeholder;
182
  }
183
  // description
184
- if ( '' != ( $description = get_option( 'wcj_checkout_fields_' . $field . '_' . 'description', '' ) ) ) {
185
  $checkout_fields[ $section ][ $field ]['description'] = $description;
186
  }
187
  // class
188
- if ( 'default' != ( $class = get_option( 'wcj_checkout_fields_' . $field . '_' . 'class', 'default' ) ) ) {
189
  $checkout_fields[ $section ][ $field ]['class'] = array( $class );
190
  }
191
  // priority
192
- if ( 0 != ( $priority = apply_filters( 'booster_option', 0, get_option( 'wcj_checkout_fields_' . $field . '_' . 'priority', 0 ) ) ) ) {
193
  $checkout_fields[ $section ][ $field ]['priority'] = $priority;
194
  }
195
  }
196
  }
197
- if ( 'yes' === get_option( 'wcj_checkout_core_fields_force_sort_by_priority', 'no' ) ) {
198
  $field_sets = array( 'billing', 'shipping', 'account', 'order' );
199
  foreach ( $field_sets as $field_set ) {
200
  if ( isset( $checkout_fields[ $field_set ] ) ) {
57
 
58
  if ( $this->is_enabled() ) {
59
  add_filter( 'woocommerce_checkout_fields' , array( $this, 'custom_override_checkout_fields' ), PHP_INT_MAX );
60
+ if ( 'disable' != ( $this->country_locale_override = wcj_get_option( 'wcj_checkout_core_fields_override_country_locale_fields', 'billing' ) ) ) {
61
  add_filter( 'woocommerce_get_country_locale', array( $this, 'custom_override_country_locale_fields' ), PHP_INT_MAX );
62
  }
63
+ if ( 'disable' != ( $this->default_address_override = wcj_get_option( 'wcj_checkout_core_fields_override_default_address_fields', 'billing' ) ) ) {
64
  add_filter( 'woocommerce_default_address_fields', array( $this, 'custom_override_default_address_fields' ), PHP_INT_MAX );
65
  }
66
  }
103
  $default_value = $option_data['default'];
104
  $option_id = ( isset( $option_data['option_id'] ) ? $option_data['option_id'] : $option );
105
  $option_id = 'wcj_checkout_fields_' . $field . '_' . $option_id;
106
+ if ( $default_value != ( $value = wcj_get_option( $option_id, $default_value ) ) ) {
107
  $value = ( isset( $option_data['values'][ $value ] ) ? $option_data['values'][ $value ] : $value );
108
  $fields[ $field_key ][ $option ] = $value;
109
  }
148
  $field_parts = explode( '_', $field, 2 );
149
  $section = ( ! empty( $field_parts ) && is_array( $field_parts ) ? $field_parts[0] : '' ); // billing or shipping
150
  // enabled
151
+ if ( 'no' === ( $is_enabled = wcj_get_option( 'wcj_checkout_fields_' . $field . '_' . 'is_enabled', 'default' ) ) ) {
152
  if ( isset( $checkout_fields[ $section ][ $field ] ) ) {
153
  unset( $checkout_fields[ $section ][ $field ] ); // e.g. unset( $checkout_fields['billing']['billing_country'] );
154
  continue;
158
  if ( ! $this->is_visible( array(
159
  'include_products' => '',
160
  'exclude_products' => '',
161
+ 'include_categories' => apply_filters( 'booster_option', '', wcj_get_option( 'wcj_checkout_fields_' . $field . '_' . 'cats_incl', '' ) ),
162
+ 'exclude_categories' => apply_filters( 'booster_option', '', wcj_get_option( 'wcj_checkout_fields_' . $field . '_' . 'cats_excl', '' ) ),
163
  'include_tags' => '',
164
  'exclude_tags' => '',
165
+ ), wcj_get_option( 'wcj_checkout_core_fields_checking_relation', 'all' ) )
166
  ) {
167
  unset( $checkout_fields[ $section ][ $field ] );
168
  continue;
169
  }
170
  if ( isset( $checkout_fields[ $section ][ $field ] ) ) {
171
  // required
172
+ if ( 'default' != ( $is_required = wcj_get_option( 'wcj_checkout_fields_' . $field . '_' . 'is_required', 'default' ) ) ) {
173
  $checkout_fields[ $section ][ $field ]['required'] = ( 'yes' === $is_required );
174
  }
175
  // label
176
+ if ( '' != ( $label = wcj_get_option( 'wcj_checkout_fields_' . $field . '_' . 'label', '' ) ) ) {
177
  $checkout_fields[ $section ][ $field ]['label'] = $label;
178
  }
179
  // placeholder
180
+ if ( '' != ( $placeholder = wcj_get_option( 'wcj_checkout_fields_' . $field . '_' . 'placeholder', '' ) ) ) {
181
  $checkout_fields[ $section ][ $field ]['placeholder'] = $placeholder;
182
  }
183
  // description
184
+ if ( '' != ( $description = wcj_get_option( 'wcj_checkout_fields_' . $field . '_' . 'description', '' ) ) ) {
185
  $checkout_fields[ $section ][ $field ]['description'] = $description;
186
  }
187
  // class
188
+ if ( 'default' != ( $class = wcj_get_option( 'wcj_checkout_fields_' . $field . '_' . 'class', 'default' ) ) ) {
189
  $checkout_fields[ $section ][ $field ]['class'] = array( $class );
190
  }
191
  // priority
192
+ if ( 0 != ( $priority = apply_filters( 'booster_option', 0, wcj_get_option( 'wcj_checkout_fields_' . $field . '_' . 'priority', 0 ) ) ) ) {
193
  $checkout_fields[ $section ][ $field ]['priority'] = $priority;
194
  }
195
  }
196
  }
197
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_core_fields_force_sort_by_priority', 'no' ) ) {
198
  $field_sets = array( 'billing', 'shipping', 'account', 'order' );
199
  foreach ( $field_sets as $field_set ) {
200
  if ( isset( $checkout_fields[ $field_set ] ) ) {
includes/class-wcj-checkout-custom-fields.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Module - Checkout Custom Fields
4
  *
5
- * @version 5.2.0
6
  * @author Pluggabl LLC.
7
  */
8
 
@@ -32,7 +32,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
32
  add_filter( 'woocommerce_admin_billing_fields', array( $this, 'add_custom_billing_fields_to_admin_order_display' ), PHP_INT_MAX );
33
  add_filter( 'woocommerce_admin_shipping_fields', array( $this, 'add_custom_shipping_fields_to_admin_order_display' ), PHP_INT_MAX );
34
  add_action( 'woocommerce_admin_order_data_after_shipping_address', array( $this, 'add_custom_order_and_account_fields_to_admin_order_display' ), PHP_INT_MAX );
35
- if ( 'yes' === get_option( 'wcj_checkout_custom_fields_add_to_order_received', 'yes' ) ) {
36
  add_action( 'woocommerce_order_details_after_order_table', array( $this, 'add_custom_fields_to_view_order_and_thankyou_pages' ), PHP_INT_MAX );
37
  }
38
  add_action( 'woocommerce_email_after_order_table', array( $this, 'add_custom_fields_to_emails' ), PHP_INT_MAX, 2 );
@@ -41,9 +41,9 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
41
  add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'update_custom_checkout_fields_order_meta' ) );
42
  add_filter( 'woocommerce_form_field_' . 'text', array( $this, 'woocommerce_form_field_type_number' ), PHP_INT_MAX, 4 );
43
  add_filter( 'woocommerce_customer_meta_fields', array( $this, 'add_checkout_custom_fields_customer_meta_fields' ) );
44
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
45
- if ( 'yes' === get_option( 'wcj_checkout_custom_field_enabled_' . $i ) ) {
46
- $the_section = get_option( 'wcj_checkout_custom_field_section_' . $i );
47
  $the_key = 'wcj_checkout_field_' . $i;
48
  $the_name = $the_section . '_' . $the_key;
49
  add_filter( 'default_checkout_' . $the_name, array( $this, 'add_default_checkout_custom_fields' ), PHP_INT_MAX, 2 );
@@ -69,14 +69,14 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
69
  function maybe_enqueue_scripts( $fields ) {
70
  if ( is_checkout() ) {
71
  $select2_fields = array();
72
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
73
- if ( 'yes' === get_option( 'wcj_checkout_custom_field_enabled_' . $i, 'no' ) ) {
74
- if ( 'select' === get_option( 'wcj_checkout_custom_field_type_' . $i, 'text' ) ) {
75
- if ( 'yes' === get_option( 'wcj_checkout_custom_field_select_select2_' . $i, 'no' ) ) {
76
  $select2_fields[] = array(
77
- 'field_id' => get_option( 'wcj_checkout_custom_field_section_' . $i, 'billing' ) . '_' . 'wcj_checkout_field_' . $i,
78
- 'minimumInputLength' => get_option( 'wcj_checkout_custom_field_select_select2_min_input_length' . $i, 0 ),
79
- 'maximumInputLength' => get_option( 'wcj_checkout_custom_field_select_select2_max_input_length' . $i, 0 ),
80
  );
81
  }
82
  }
@@ -108,16 +108,16 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
108
  * @since 2.4.5
109
  */
110
  function add_checkout_custom_fields_customer_meta_fields( $fields ) {
111
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
112
- if ( 'yes' === get_option( 'wcj_checkout_custom_field_enabled_' . $i ) ) {
113
- if ( 'no' === get_option( 'wcj_checkout_custom_field_customer_meta_fields_' . $i, 'yes' ) ) {
114
  continue;
115
  }
116
- $the_section = get_option( 'wcj_checkout_custom_field_section_' . $i );
117
  $the_key = 'wcj_checkout_field_' . $i;
118
  $the_name = $the_section . '_' . $the_key;
119
  $fields[ $the_section ]['fields'][ $the_name ] = array(
120
- 'label' => get_option( 'wcj_checkout_custom_field_label_' . $i ),
121
  'description' => '',
122
  );
123
  }
@@ -178,13 +178,13 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
178
  * add_custom_fields_to_store_exporter.
179
  */
180
  function add_custom_fields_to_store_exporter( $fields ) {
181
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
182
- if ( 'yes' === get_option( 'wcj_checkout_custom_field_enabled_' . $i ) ) {
183
- $the_section = get_option( 'wcj_checkout_custom_field_section_' . $i );
184
  $the_key = 'wcj_checkout_field_' . $i;
185
  $fields[] = array(
186
  'name' => $the_section . '_' . $the_key,
187
- 'label' => get_option( 'wcj_checkout_custom_field_label_' . $i ),
188
  );
189
  }
190
  }
@@ -197,20 +197,20 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
197
  * @version 4.6.1
198
  */
199
  function update_custom_checkout_fields_order_meta( $order_id ) {
200
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
201
- if ( 'yes' === get_option( 'wcj_checkout_custom_field_enabled_' . $i ) ) {
202
  if ( 'woocommerce_checkout_update_order_meta' === current_filter() && ! $this->is_visible( $i ) ) {
203
  continue;
204
  }
205
- $the_section = get_option( 'wcj_checkout_custom_field_section_' . $i );
206
- $the_type = get_option( 'wcj_checkout_custom_field_type_' . $i );
207
  $option_name = $the_section . '_' . 'wcj_checkout_field_' . $i;
208
  $option_name_label = $the_section . '_' . 'wcj_checkout_field_label_' . $i;
209
  $option_name_type = $the_section . '_' . 'wcj_checkout_field_type_' . $i;
210
  $post_value = isset( $_POST[ $option_name ] ) ? $_POST[ $option_name ] : ( isset( $_POST[ '_' . $option_name ] ) ? $_POST[ '_' . $option_name ] : get_post_meta( $order_id, '_' . $option_name, true ) );
211
  if ( ! empty( $post_value ) || 'checkbox' === $the_type ) {
212
  update_post_meta( $order_id, '_' . $option_name_type, $the_type );
213
- update_post_meta( $order_id, '_' . $option_name_label, get_option( 'wcj_checkout_custom_field_label_' . $i ) );
214
  if ( 'checkbox' === $the_type ) {
215
  $the_value = ! empty( $post_value ) ? 1 : 0;
216
  update_post_meta( $order_id, '_' . $option_name, $the_value );
@@ -222,9 +222,9 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
222
  } elseif ( 'radio' === $the_type || 'select' === $the_type ) {
223
  update_post_meta( $order_id, '_' . $option_name, wc_clean( urldecode( $post_value ) ) );
224
  $option_name_values = $the_section . '_' . 'wcj_checkout_field_select_options_' . $i;
225
- $the_values = get_option( 'wcj_checkout_custom_field_select_options_' . $i );
226
  update_post_meta( $order_id, '_' . $option_name_values, $the_values );
227
- } elseif ( 'textarea' === $the_type && 'no' === get_option( 'wcj_checkout_custom_fields_textarea_clean', 'yes' ) ) {
228
  update_post_meta( $order_id, '_' . $option_name, urldecode( $post_value ) );
229
  } else {
230
  update_post_meta( $order_id, '_' . $option_name, wc_clean( urldecode( $post_value ) ) );
@@ -241,13 +241,13 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
241
  */
242
  function add_custom_fields_to_emails( $order, $sent_to_admin ) {
243
  if (
244
- ( $sent_to_admin && 'yes' === get_option( 'wcj_checkout_custom_fields_email_all_to_admin' ) ) ||
245
- ( ! $sent_to_admin && 'yes' === get_option( 'wcj_checkout_custom_fields_email_all_to_customer' ) )
246
  ) {
247
  $templates = array(
248
- 'before' => get_option( 'wcj_checkout_custom_fields_emails_template_before', '' ),
249
- 'field' => get_option( 'wcj_checkout_custom_fields_emails_template_field', '<p><strong>%label%:</strong> %value%</p>' ),
250
- 'after' => get_option( 'wcj_checkout_custom_fields_emails_template_after', '' ),
251
  );
252
  $this->add_custom_fields_to_order_display( $order, '', $templates );
253
  }
@@ -261,9 +261,9 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
261
  */
262
  function add_custom_fields_to_view_order_and_thankyou_pages( $order ) {
263
  $templates = array(
264
- 'before' => get_option( 'wcj_checkout_custom_fields_order_received_template_before', '' ),
265
- 'field' => get_option( 'wcj_checkout_custom_fields_order_received_template_field', '<p><strong>%label%:</strong> %value%</p>' ),
266
- 'after' => get_option( 'wcj_checkout_custom_fields_order_received_template_after', '' ),
267
  );
268
  $this->add_custom_fields_to_order_display( $order, '', $templates );
269
  }
@@ -320,7 +320,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
320
  } else {
321
  $value = $_value;
322
  }
323
- } elseif ( isset( $post_meta[ $type_key ][0] ) && 'textarea' === $post_meta[ $type_key ][0] && 'yes' === get_option( 'wcj_checkout_custom_fields_textarea_replace_line_breaks', 'no' ) ) {
324
  $value = str_replace( PHP_EOL, '<br>', $_value );
325
  } else {
326
  $value = $_value;
@@ -349,16 +349,16 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
349
  * @todo add alternative way of displaying fields (e.g. new meta box), so we have more control over displaying fields' values (e.g. line breaks)
350
  */
351
  function add_woocommerce_admin_fields( $fields, $section ) {
352
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
353
- if ( 'yes' === get_option( 'wcj_checkout_custom_field_enabled_' . $i ) ) {
354
- $the_section = get_option( 'wcj_checkout_custom_field_section_' . $i );
355
  if ( $section != $the_section ) {
356
  continue;
357
  }
358
- $the_type = get_option( 'wcj_checkout_custom_field_type_' . $i );
359
  if ( 'select' === $the_type ) {
360
  $the_class = 'first';
361
- $options = wcj_get_select_options( get_option( 'wcj_checkout_custom_field_select_options_' . $i ) );
362
  } elseif ( 'radio' === $the_type ) {
363
  $the_options = get_post_meta( get_the_ID(), '_' . $section . '_' . 'wcj_checkout_field_select_options_' . $i, true );
364
  if ( ! empty( $the_options ) ) {
@@ -366,7 +366,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
366
  $the_class = 'first';
367
  $options = wcj_get_select_options( $the_options );
368
  } else {
369
- $the_options = wcj_get_select_options( get_option( 'wcj_checkout_custom_field_select_options_' . $i ) );
370
  if ( ! empty( $the_options ) ) {
371
  $the_type = 'select';
372
  $the_class = 'first';
@@ -468,7 +468,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
468
  }
469
 
470
  // Checking categories
471
- $categories_ex = get_option( 'wcj_checkout_custom_field_categories_ex_' . $i );
472
  if ( ! empty( $categories_ex ) ) {
473
  foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
474
  $product_categories = get_the_terms( $values['product_id'], 'product_cat' );
@@ -482,7 +482,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
482
  }
483
  }
484
  }
485
- $categories_in = get_option( 'wcj_checkout_custom_field_categories_in_' . $i );
486
  if ( ! empty( $categories_in ) ) {
487
  $categories_in_cart = array();
488
  foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
@@ -495,7 +495,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
495
  }
496
 
497
  // Checking products
498
- $products_ex = get_option( 'wcj_checkout_custom_field_products_ex_' . $i );
499
  if ( ! empty( $products_ex ) ) {
500
  foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
501
  if ( in_array( $values['product_id'], $products_ex ) ) {
@@ -503,7 +503,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
503
  }
504
  }
505
  }
506
- $products_in = get_option( 'wcj_checkout_custom_field_products_in_' . $i );
507
  if ( ! empty( $products_in ) ) {
508
  foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
509
  if ( in_array( $values['product_id'], $products_in ) ) {
@@ -515,14 +515,14 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
515
 
516
  // Checking min/max cart amount
517
  $cart_total = false;
518
- if ( ( $min_cart_amount = get_option( 'wcj_checkout_custom_field_min_cart_amount_' . $i, 0 ) ) > 0 ) {
519
  WC()->cart->calculate_totals();
520
  $cart_total = WC()->cart->total;
521
  if ( $cart_total < $min_cart_amount ) {
522
  return false;
523
  }
524
  }
525
- if ( ( $max_cart_amount = get_option( 'wcj_checkout_custom_field_max_cart_amount_' . $i, 0 ) ) > 0 ) {
526
  if ( false === $cart_total ) {
527
  WC()->cart->calculate_totals();
528
  $cart_total = WC()->cart->total;
@@ -539,76 +539,81 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
539
  /**
540
  * add_custom_checkout_fields.
541
  *
542
- * @version 5.2.0
543
  * @todo (maybe) fix - priority seems to not affect tab order (same in Checkout Core Fields module)
544
  * @todo (dev) (maybe) add `do_shortcode` for e.g. `description` etc.
545
  */
546
  function add_custom_checkout_fields( $fields ) {
547
 
548
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
549
 
550
- if ( 'yes' === get_option( 'wcj_checkout_custom_field_enabled_' . $i ) ) {
551
 
552
  if ( ! $this->is_visible( $i ) ) {
553
  continue;
554
  }
555
 
556
- $the_type = get_option( 'wcj_checkout_custom_field_type_' . $i );
557
  $custom_attributes = array();
558
  if ( 'datepicker' === $the_type || 'weekpicker' === $the_type || 'timepicker' === $the_type || 'number' === $the_type ) {
559
  if ( 'datepicker' === $the_type || 'weekpicker' === $the_type ) {
560
- $datepicker_format_option = get_option( 'wcj_checkout_custom_field_datepicker_format_' . $i, '' );
561
- $datepicker_format = ( '' == $datepicker_format_option ) ? get_option( 'date_format' ) : $datepicker_format_option;
562
  $datepicker_format = wcj_date_format_php_to_js( $datepicker_format );
563
  $custom_attributes['dateformat'] = $datepicker_format;
564
- $custom_attributes['mindate'] = get_option( 'wcj_checkout_custom_field_datepicker_mindate_' . $i, -365 );
565
  if ( 0 == $custom_attributes['mindate'] ) {
566
  $custom_attributes['mindate'] = 'zero';
 
 
 
 
 
567
  }
568
- $custom_attributes['maxdate'] = get_option( 'wcj_checkout_custom_field_datepicker_maxdate_' . $i, 365 );
569
  if ( 0 == $custom_attributes['maxdate'] ) {
570
  $custom_attributes['maxdate'] = 'zero';
571
  }
572
- $custom_attributes['firstday'] = get_option( 'wcj_checkout_custom_field_datepicker_firstday_' . $i, 0 );
573
- if ( 'yes' === get_option( 'wcj_checkout_custom_field_datepicker_changeyear_' . $i, 'yes' ) ) {
574
  $custom_attributes['changeyear'] = 1;
575
- $custom_attributes['yearrange'] = get_option( 'wcj_checkout_custom_field_datepicker_yearrange_' . $i, 'c-10:c+10' );
576
  }
577
  $custom_attributes['display'] = ( 'datepicker' === $the_type ) ? 'date' : 'week';
578
  //Blocked Dates
579
- $blocked_dates_format = get_option( 'wcj_checkout_custom_field_datepicker_blockeddates_format_' . $i, 'mm-dd' );
580
  $custom_attributes['data-blocked_dates_format']=$blocked_dates_format;
581
- $blocked_dates_textarea = get_option( 'wcj_checkout_custom_field_datepicker_blockeddates_' . $i, '' );
582
  $custom_attributes['data-blocked_dates'] = implode( ' ', array_map( 'trim', explode( PHP_EOL, $blocked_dates_textarea ) ) );
583
  } elseif ( 'timepicker' === $the_type ) {
584
- $custom_attributes['timeformat'] = get_option( 'wcj_checkout_custom_field_timepicker_format_' . $i, 'hh:mm p' );
585
- $custom_attributes['interval'] = get_option( 'wcj_checkout_custom_field_timepicker_interval_' . $i, 15 );
586
  $custom_attributes['display'] = 'time';
587
  } else { // 'number'
588
  $custom_attributes['display'] = $the_type;
589
  }
590
  $the_type = 'text';
591
  }
592
- $the_section = get_option( 'wcj_checkout_custom_field_section_' . $i );
593
  $the_key = 'wcj_checkout_field_' . $i;
594
 
595
  $the_field = array(
596
  'type' => $the_type,
597
- 'label' => get_option( 'wcj_checkout_custom_field_label_' . $i ),
598
- 'placeholder' => get_option( 'wcj_checkout_custom_field_placeholder_' . $i ),
599
- 'required' => ( 'yes' === get_option( 'wcj_checkout_custom_field_required_' . $i ) ),
600
  'custom_attributes' => $custom_attributes,
601
- 'clear' => ( 'yes' === get_option( 'wcj_checkout_custom_field_clear_' . $i ) ),
602
- 'class' => array( get_option( 'wcj_checkout_custom_field_class_' . $i ) ),
603
- 'priority' => get_option( 'wcj_checkout_custom_field_priority_' . $i, '' ),
604
- 'description' => get_option( 'wcj_checkout_custom_field_description_' . $i, '' ),
605
  );
606
 
607
  if ( 'select' === $the_type || 'radio' === $the_type ) {
608
- $select_options_raw = get_option( 'wcj_checkout_custom_field_select_options_' . $i );
609
  $select_options = wcj_get_select_options( $select_options_raw );
610
  if ( 'select' === $the_type ) {
611
- $placeholder = get_option( 'wcj_checkout_custom_field_placeholder_' . $i );
612
  if ( '' != $placeholder ) {
613
  $select_options = array_replace( array( '' => $placeholder ), $select_options );
614
  }
@@ -621,7 +626,7 @@ class WCJ_Checkout_Custom_Fields extends WCJ_Module {
621
  }
622
 
623
  if ( 'checkbox' === $the_type ) {
624
- $the_field['default'] = ( 'yes' === get_option( 'wcj_checkout_custom_field_checkbox_default_' . $i ) ) ? 1 : 0;
625
  }
626
 
627
  $fields[ $the_section ][ $the_section . '_' . $the_key ] = $the_field;
2
  /**
3
  * Booster for WooCommerce - Module - Checkout Custom Fields
4
  *
5
+ * @version 5.3.3
6
  * @author Pluggabl LLC.
7
  */
8
 
32
  add_filter( 'woocommerce_admin_billing_fields', array( $this, 'add_custom_billing_fields_to_admin_order_display' ), PHP_INT_MAX );
33
  add_filter( 'woocommerce_admin_shipping_fields', array( $this, 'add_custom_shipping_fields_to_admin_order_display' ), PHP_INT_MAX );
34
  add_action( 'woocommerce_admin_order_data_after_shipping_address', array( $this, 'add_custom_order_and_account_fields_to_admin_order_display' ), PHP_INT_MAX );
35
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_custom_fields_add_to_order_received', 'yes' ) ) {
36
  add_action( 'woocommerce_order_details_after_order_table', array( $this, 'add_custom_fields_to_view_order_and_thankyou_pages' ), PHP_INT_MAX );
37
  }
38
  add_action( 'woocommerce_email_after_order_table', array( $this, 'add_custom_fields_to_emails' ), PHP_INT_MAX, 2 );
41
  add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'update_custom_checkout_fields_order_meta' ) );
42
  add_filter( 'woocommerce_form_field_' . 'text', array( $this, 'woocommerce_form_field_type_number' ), PHP_INT_MAX, 4 );
43
  add_filter( 'woocommerce_customer_meta_fields', array( $this, 'add_checkout_custom_fields_customer_meta_fields' ) );
44
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
45
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_custom_field_enabled_' . $i ) ) {
46
+ $the_section = wcj_get_option( 'wcj_checkout_custom_field_section_' . $i );
47
  $the_key = 'wcj_checkout_field_' . $i;
48
  $the_name = $the_section . '_' . $the_key;
49
  add_filter( 'default_checkout_' . $the_name, array( $this, 'add_default_checkout_custom_fields' ), PHP_INT_MAX, 2 );
69
  function maybe_enqueue_scripts( $fields ) {
70
  if ( is_checkout() ) {
71
  $select2_fields = array();
72
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
73
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_custom_field_enabled_' . $i, 'no' ) ) {
74
+ if ( 'select' === wcj_get_option( 'wcj_checkout_custom_field_type_' . $i, 'text' ) ) {
75
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_custom_field_select_select2_' . $i, 'no' ) ) {
76
  $select2_fields[] = array(
77
+ 'field_id' => wcj_get_option( 'wcj_checkout_custom_field_section_' . $i, 'billing' ) . '_' . 'wcj_checkout_field_' . $i,
78
+ 'minimumInputLength' => wcj_get_option( 'wcj_checkout_custom_field_select_select2_min_input_length' . $i, 0 ),
79
+ 'maximumInputLength' => wcj_get_option( 'wcj_checkout_custom_field_select_select2_max_input_length' . $i, 0 ),
80
  );
81
  }
82
  }
108
  * @since 2.4.5
109
  */
110
  function add_checkout_custom_fields_customer_meta_fields( $fields ) {
111
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
112
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_custom_field_enabled_' . $i ) ) {
113
+ if ( 'no' === wcj_get_option( 'wcj_checkout_custom_field_customer_meta_fields_' . $i, 'yes' ) ) {
114
  continue;
115
  }
116
+ $the_section = wcj_get_option( 'wcj_checkout_custom_field_section_' . $i );
117
  $the_key = 'wcj_checkout_field_' . $i;
118
  $the_name = $the_section . '_' . $the_key;
119
  $fields[ $the_section ]['fields'][ $the_name ] = array(
120
+ 'label' => wcj_get_option( 'wcj_checkout_custom_field_label_' . $i ),
121
  'description' => '',
122
  );
123
  }
178
  * add_custom_fields_to_store_exporter.
179
  */
180
  function add_custom_fields_to_store_exporter( $fields ) {
181
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
182
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_custom_field_enabled_' . $i ) ) {
183
+ $the_section = wcj_get_option( 'wcj_checkout_custom_field_section_' . $i );
184
  $the_key = 'wcj_checkout_field_' . $i;
185
  $fields[] = array(
186
  'name' => $the_section . '_' . $the_key,
187
+ 'label' => wcj_get_option( 'wcj_checkout_custom_field_label_' . $i ),
188
  );
189
  }
190
  }
197
  * @version 4.6.1
198
  */
199
  function update_custom_checkout_fields_order_meta( $order_id ) {
200
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
201
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_custom_field_enabled_' . $i ) ) {
202
  if ( 'woocommerce_checkout_update_order_meta' === current_filter() && ! $this->is_visible( $i ) ) {
203
  continue;
204
  }
205
+ $the_section = wcj_get_option( 'wcj_checkout_custom_field_section_' . $i );
206
+ $the_type = wcj_get_option( 'wcj_checkout_custom_field_type_' . $i );
207
  $option_name = $the_section . '_' . 'wcj_checkout_field_' . $i;
208
  $option_name_label = $the_section . '_' . 'wcj_checkout_field_label_' . $i;
209
  $option_name_type = $the_section . '_' . 'wcj_checkout_field_type_' . $i;
210
  $post_value = isset( $_POST[ $option_name ] ) ? $_POST[ $option_name ] : ( isset( $_POST[ '_' . $option_name ] ) ? $_POST[ '_' . $option_name ] : get_post_meta( $order_id, '_' . $option_name, true ) );
211
  if ( ! empty( $post_value ) || 'checkbox' === $the_type ) {
212
  update_post_meta( $order_id, '_' . $option_name_type, $the_type );
213
+ update_post_meta( $order_id, '_' . $option_name_label, wcj_get_option( 'wcj_checkout_custom_field_label_' . $i ) );
214
  if ( 'checkbox' === $the_type ) {
215
  $the_value = ! empty( $post_value ) ? 1 : 0;
216
  update_post_meta( $order_id, '_' . $option_name, $the_value );
222
  } elseif ( 'radio' === $the_type || 'select' === $the_type ) {
223
  update_post_meta( $order_id, '_' . $option_name, wc_clean( urldecode( $post_value ) ) );
224
  $option_name_values = $the_section . '_' . 'wcj_checkout_field_select_options_' . $i;
225
+ $the_values = wcj_get_option( 'wcj_checkout_custom_field_select_options_' . $i );
226
  update_post_meta( $order_id, '_' . $option_name_values, $the_values );
227
+ } elseif ( 'textarea' === $the_type && 'no' === wcj_get_option( 'wcj_checkout_custom_fields_textarea_clean', 'yes' ) ) {
228
  update_post_meta( $order_id, '_' . $option_name, urldecode( $post_value ) );
229
  } else {
230
  update_post_meta( $order_id, '_' . $option_name, wc_clean( urldecode( $post_value ) ) );
241
  */
242
  function add_custom_fields_to_emails( $order, $sent_to_admin ) {
243
  if (
244
+ ( $sent_to_admin && 'yes' === wcj_get_option( 'wcj_checkout_custom_fields_email_all_to_admin' ) ) ||
245
+ ( ! $sent_to_admin && 'yes' === wcj_get_option( 'wcj_checkout_custom_fields_email_all_to_customer' ) )
246
  ) {
247
  $templates = array(
248
+ 'before' => wcj_get_option( 'wcj_checkout_custom_fields_emails_template_before', '' ),
249
+ 'field' => wcj_get_option( 'wcj_checkout_custom_fields_emails_template_field', '<p><strong>%label%:</strong> %value%</p>' ),
250
+ 'after' => wcj_get_option( 'wcj_checkout_custom_fields_emails_template_after', '' ),
251
  );
252
  $this->add_custom_fields_to_order_display( $order, '', $templates );
253
  }
261
  */
262
  function add_custom_fields_to_view_order_and_thankyou_pages( $order ) {
263
  $templates = array(
264
+ 'before' => wcj_get_option( 'wcj_checkout_custom_fields_order_received_template_before', '' ),
265
+ 'field' => wcj_get_option( 'wcj_checkout_custom_fields_order_received_template_field', '<p><strong>%label%:</strong> %value%</p>' ),
266
+ 'after' => wcj_get_option( 'wcj_checkout_custom_fields_order_received_template_after', '' ),
267
  );
268
  $this->add_custom_fields_to_order_display( $order, '', $templates );
269
  }
320
  } else {
321
  $value = $_value;
322
  }
323
+ } elseif ( isset( $post_meta[ $type_key ][0] ) && 'textarea' === $post_meta[ $type_key ][0] && 'yes' === wcj_get_option( 'wcj_checkout_custom_fields_textarea_replace_line_breaks', 'no' ) ) {
324
  $value = str_replace( PHP_EOL, '<br>', $_value );
325
  } else {
326
  $value = $_value;
349
  * @todo add alternative way of displaying fields (e.g. new meta box), so we have more control over displaying fields' values (e.g. line breaks)
350
  */
351
  function add_woocommerce_admin_fields( $fields, $section ) {
352
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
353
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_custom_field_enabled_' . $i ) ) {
354
+ $the_section = wcj_get_option( 'wcj_checkout_custom_field_section_' . $i );
355
  if ( $section != $the_section ) {
356
  continue;
357
  }
358
+ $the_type = wcj_get_option( 'wcj_checkout_custom_field_type_' . $i );
359
  if ( 'select' === $the_type ) {
360
  $the_class = 'first';
361
+ $options = wcj_get_select_options( wcj_get_option( 'wcj_checkout_custom_field_select_options_' . $i ) );
362
  } elseif ( 'radio' === $the_type ) {
363
  $the_options = get_post_meta( get_the_ID(), '_' . $section . '_' . 'wcj_checkout_field_select_options_' . $i, true );
364
  if ( ! empty( $the_options ) ) {
366
  $the_class = 'first';
367
  $options = wcj_get_select_options( $the_options );
368
  } else {
369
+ $the_options = wcj_get_select_options( wcj_get_option( 'wcj_checkout_custom_field_select_options_' . $i ) );
370
  if ( ! empty( $the_options ) ) {
371
  $the_type = 'select';
372
  $the_class = 'first';
468
  }
469
 
470
  // Checking categories
471
+ $categories_ex = wcj_get_option( 'wcj_checkout_custom_field_categories_ex_' . $i );
472
  if ( ! empty( $categories_ex ) ) {
473
  foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
474
  $product_categories = get_the_terms( $values['product_id'], 'product_cat' );
482
  }
483
  }
484
  }
485
+ $categories_in = wcj_get_option( 'wcj_checkout_custom_field_categories_in_' . $i );
486
  if ( ! empty( $categories_in ) ) {
487
  $categories_in_cart = array();
488
  foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
495
  }
496
 
497
  // Checking products
498
+ $products_ex = wcj_get_option( 'wcj_checkout_custom_field_products_ex_' . $i );
499
  if ( ! empty( $products_ex ) ) {
500
  foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
501
  if ( in_array( $values['product_id'], $products_ex ) ) {
503
  }
504
  }
505
  }
506
+ $products_in = wcj_get_option( 'wcj_checkout_custom_field_products_in_' . $i );
507
  if ( ! empty( $products_in ) ) {
508
  foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
509
  if ( in_array( $values['product_id'], $products_in ) ) {
515
 
516
  // Checking min/max cart amount
517
  $cart_total = false;
518
+ if ( ( $min_cart_amount = wcj_get_option( 'wcj_checkout_custom_field_min_cart_amount_' . $i, 0 ) ) > 0 ) {
519
  WC()->cart->calculate_totals();
520
  $cart_total = WC()->cart->total;
521
  if ( $cart_total < $min_cart_amount ) {
522
  return false;
523
  }
524
  }
525
+ if ( ( $max_cart_amount = wcj_get_option( 'wcj_checkout_custom_field_max_cart_amount_' . $i, 0 ) ) > 0 ) {
526
  if ( false === $cart_total ) {
527
  WC()->cart->calculate_totals();
528
  $cart_total = WC()->cart->total;
539
  /**
540
  * add_custom_checkout_fields.
541
  *
542
+ * @version 5.3.3
543
  * @todo (maybe) fix - priority seems to not affect tab order (same in Checkout Core Fields module)
544
  * @todo (dev) (maybe) add `do_shortcode` for e.g. `description` etc.
545
  */
546
  function add_custom_checkout_fields( $fields ) {
547
 
548
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
549
 
550
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_custom_field_enabled_' . $i ) ) {
551
 
552
  if ( ! $this->is_visible( $i ) ) {
553
  continue;
554
  }
555
 
556
+ $the_type = wcj_get_option( 'wcj_checkout_custom_field_type_' . $i );
557
  $custom_attributes = array();
558
  if ( 'datepicker' === $the_type || 'weekpicker' === $the_type || 'timepicker' === $the_type || 'number' === $the_type ) {
559
  if ( 'datepicker' === $the_type || 'weekpicker' === $the_type ) {
560
+ $datepicker_format_option = wcj_get_option( 'wcj_checkout_custom_field_datepicker_format_' . $i, '' );
561
+ $datepicker_format = ( '' == $datepicker_format_option ) ? wcj_get_option( 'date_format' ) : $datepicker_format_option;
562
  $datepicker_format = wcj_date_format_php_to_js( $datepicker_format );
563
  $custom_attributes['dateformat'] = $datepicker_format;
564
+ $custom_attributes['mindate'] = wcj_get_option( 'wcj_checkout_custom_field_datepicker_mindate_' . $i, -365 );
565
  if ( 0 == $custom_attributes['mindate'] ) {
566
  $custom_attributes['mindate'] = 'zero';
567
+
568
+ $custom_attributes['currentday_time_limit'] = wcj_get_option( 'wcj_checkout_custom_field_datepicker_current_day_time_limit_' . $i, 0 );
569
+ if( date( 'H:i',strtotime( $custom_attributes[ 'currentday_time_limit' ] ) ) < date( "H:i" ) ) {
570
+ $custom_attributes[ 'mindate' ] = 1;
571
+ }
572
  }
573
+ $custom_attributes['maxdate'] = wcj_get_option( 'wcj_checkout_custom_field_datepicker_maxdate_' . $i, 365 );
574
  if ( 0 == $custom_attributes['maxdate'] ) {
575
  $custom_attributes['maxdate'] = 'zero';
576
  }
577
+ $custom_attributes['firstday'] = wcj_get_option( 'wcj_checkout_custom_field_datepicker_firstday_' . $i, 0 );
578
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_custom_field_datepicker_changeyear_' . $i, 'yes' ) ) {
579
  $custom_attributes['changeyear'] = 1;
580
+ $custom_attributes['yearrange'] = wcj_get_option( 'wcj_checkout_custom_field_datepicker_yearrange_' . $i, 'c-10:c+10' );
581
  }
582
  $custom_attributes['display'] = ( 'datepicker' === $the_type ) ? 'date' : 'week';
583
  //Blocked Dates
584
+ $blocked_dates_format = wcj_get_option( 'wcj_checkout_custom_field_datepicker_blockeddates_format_' . $i, 'mm-dd' );
585
  $custom_attributes['data-blocked_dates_format']=$blocked_dates_format;
586
+ $blocked_dates_textarea = wcj_get_option( 'wcj_checkout_custom_field_datepicker_blockeddates_' . $i, '' );
587
  $custom_attributes['data-blocked_dates'] = implode( ' ', array_map( 'trim', explode( PHP_EOL, $blocked_dates_textarea ) ) );
588
  } elseif ( 'timepicker' === $the_type ) {
589
+ $custom_attributes['timeformat'] = wcj_get_option( 'wcj_checkout_custom_field_timepicker_format_' . $i, 'hh:mm p' );
590
+ $custom_attributes['interval'] = wcj_get_option( 'wcj_checkout_custom_field_timepicker_interval_' . $i, 15 );
591
  $custom_attributes['display'] = 'time';
592
  } else { // 'number'
593
  $custom_attributes['display'] = $the_type;
594
  }
595
  $the_type = 'text';
596
  }
597
+ $the_section = wcj_get_option( 'wcj_checkout_custom_field_section_' . $i );
598
  $the_key = 'wcj_checkout_field_' . $i;
599
 
600
  $the_field = array(
601
  'type' => $the_type,
602
+ 'label' => wcj_get_option( 'wcj_checkout_custom_field_label_' . $i ),
603
+ 'placeholder' => wcj_get_option( 'wcj_checkout_custom_field_placeholder_' . $i ),
604
+ 'required' => ( 'yes' === wcj_get_option( 'wcj_checkout_custom_field_required_' . $i ) ),
605
  'custom_attributes' => $custom_attributes,
606
+ 'clear' => ( 'yes' === wcj_get_option( 'wcj_checkout_custom_field_clear_' . $i ) ),
607
+ 'class' => array( wcj_get_option( 'wcj_checkout_custom_field_class_' . $i ) ),
608
+ 'priority' => wcj_get_option( 'wcj_checkout_custom_field_priority_' . $i, '' ),
609
+ 'description' => wcj_get_option( 'wcj_checkout_custom_field_description_' . $i, '' ),
610
  );
611
 
612
  if ( 'select' === $the_type || 'radio' === $the_type ) {
613
+ $select_options_raw = wcj_get_option( 'wcj_checkout_custom_field_select_options_' . $i );
614
  $select_options = wcj_get_select_options( $select_options_raw );
615
  if ( 'select' === $the_type ) {
616
+ $placeholder = wcj_get_option( 'wcj_checkout_custom_field_placeholder_' . $i );
617
  if ( '' != $placeholder ) {
618
  $select_options = array_replace( array( '' => $placeholder ), $select_options );
619
  }
626
  }
627
 
628
  if ( 'checkbox' === $the_type ) {
629
+ $the_field['default'] = ( 'yes' === wcj_get_option( 'wcj_checkout_custom_field_checkbox_default_' . $i ) ) ? 1 : 0;
630
  }
631
 
632
  $fields[ $the_section ][ $the_section . '_' . $the_key ] = $the_field;
includes/class-wcj-checkout-custom-info.php CHANGED
@@ -28,7 +28,7 @@ class WCJ_Checkout_Custom_Info extends WCJ_Module {
28
  parent::__construct();
29
 
30
  if ( $this->is_enabled() ) {
31
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_custom_info_total_number', 1 ) ); $i++) {
32
  add_action(
33
  get_option( 'wcj_checkout_custom_info_hook_' . $i, 'woocommerce_checkout_after_order_review' ),
34
  array( $this, 'add_checkout_custom_info' ),
@@ -46,14 +46,14 @@ class WCJ_Checkout_Custom_Info extends WCJ_Module {
46
  function add_checkout_custom_info() {
47
  $current_filter = current_filter();
48
  $current_filter_priority = wcj_current_filter_priority();
49
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_custom_info_total_number', 1 ) );
50
  for ( $i = 1; $i <= $total_number; $i++ ) {
51
  if (
52
- '' != get_option( 'wcj_checkout_custom_info_content_' . $i ) &&
53
- $current_filter === get_option( 'wcj_checkout_custom_info_hook_' . $i ) &&
54
- $current_filter_priority == get_option( 'wcj_checkout_custom_info_priority_' . $i, 10 )
55
  ) {
56
- echo do_shortcode( get_option( 'wcj_checkout_custom_info_content_' . $i ) );
57
  }
58
  }
59
  }
28
  parent::__construct();
29
 
30
  if ( $this->is_enabled() ) {
31
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_custom_info_total_number', 1 ) ); $i++) {
32
  add_action(
33
  get_option( 'wcj_checkout_custom_info_hook_' . $i, 'woocommerce_checkout_after_order_review' ),
34
  array( $this, 'add_checkout_custom_info' ),
46
  function add_checkout_custom_info() {
47
  $current_filter = current_filter();
48
  $current_filter_priority = wcj_current_filter_priority();
49
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_custom_info_total_number', 1 ) );
50
  for ( $i = 1; $i <= $total_number; $i++ ) {
51
  if (
52
+ '' != wcj_get_option( 'wcj_checkout_custom_info_content_' . $i ) &&
53
+ $current_filter === wcj_get_option( 'wcj_checkout_custom_info_hook_' . $i ) &&
54
+ $current_filter_priority == wcj_get_option( 'wcj_checkout_custom_info_priority_' . $i, 10 )
55
  ) {
56
+ echo do_shortcode( wcj_get_option( 'wcj_checkout_custom_info_content_' . $i ) );
57
  }
58
  }
59
  }
includes/class-wcj-checkout-customization.php CHANGED
@@ -30,7 +30,7 @@ class WCJ_Checkout_Customization extends WCJ_Module {
30
 
31
  if ( $this->is_enabled() ) {
32
  // "Create an account?" Checkbox
33
- if ( 'default' != ( $create_account_default = get_option( 'wcj_checkout_create_account_default_checked', 'default' ) ) ) {
34
  if ( 'checked' === $create_account_default ) {
35
  add_filter( 'woocommerce_create_account_default_checked', '__return_true' );
36
  } elseif ( 'not_checked' === $create_account_default ) {
@@ -38,7 +38,7 @@ class WCJ_Checkout_Customization extends WCJ_Module {
38
  }
39
  }
40
  // Hide "Order Again" button
41
- if ( 'yes' === get_option( 'wcj_checkout_hide_order_again', 'no' ) ) {
42
  add_action( 'init', array( $this, 'checkout_hide_order_again' ), PHP_INT_MAX );
43
  }
44
  // Disable Fields on Checkout for Logged Users
@@ -60,26 +60,26 @@ class WCJ_Checkout_Customization extends WCJ_Module {
60
  add_filter( 'woocommerce_form_field_' . $checkout_fields_type, array( $this, 'maybe_add_description' ), PHP_INT_MAX, 4 );
61
  }
62
  // Custom "order received" message text
63
- if ( 'yes' === get_option( 'wcj_checkout_customization_order_received_message_enabled', 'no' ) ) {
64
  add_filter( 'woocommerce_thankyou_order_received_text', array( $this, 'customize_order_received_message' ), PHP_INT_MAX, 2 );
65
  }
66
  // Custom checkout login message
67
- if ( 'yes' === get_option( 'wcj_checkout_customization_checkout_login_message_enabled', 'no' ) ) {
68
  add_filter( 'woocommerce_checkout_login_message', array( $this, 'checkout_login_message' ), PHP_INT_MAX );
69
  }
70
  // Restrict countries by customer's IP
71
- if ( 'yes' === get_option( 'wcj_checkout_restrict_countries_by_customer_ip_billing', 'no' ) ) {
72
  add_filter( 'woocommerce_countries_allowed_countries', array( $this, 'restrict_countries_by_customer_ip' ), PHP_INT_MAX );
73
  }
74
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_checkout_restrict_countries_by_customer_ip_shipping', 'no' ) ) ) {
75
  add_filter( 'woocommerce_countries_shipping_countries', array( $this, 'restrict_countries_by_customer_ip' ), PHP_INT_MAX );
76
  }
77
  // Recalculate Checkout
78
- if ( 'yes' === get_option( 'wcj_checkout_recalculate_checkout_update_enable', 'no' ) ) {
79
  add_action( 'wp_footer', array( $this, 'recalculate_checkout' ), 50 );
80
  }
81
  // Update Checkout
82
- if ( 'yes' === get_option( 'wcj_checkout_force_checkout_update_enable', 'no' ) ) {
83
  add_action( 'wp_footer', array( $this, 'update_checkout' ), 50 );
84
  }
85
  }
@@ -98,7 +98,7 @@ class WCJ_Checkout_Customization extends WCJ_Module {
98
  ?>
99
  <script type="text/javascript">
100
  jQuery(function ($) {
101
- var selector = <?php echo wp_json_encode( get_option( 'wcj_checkout_force_checkout_update_fields', '' ) ); ?>;
102
  jQuery(selector).on('change', function () {
103
  $('body').trigger('update_checkout');
104
  });
@@ -121,7 +121,7 @@ class WCJ_Checkout_Customization extends WCJ_Module {
121
  <script type="text/javascript">
122
  jQuery(function ($) {
123
  var old_values = [];
124
- var selector = <?php echo wp_json_encode( get_option( 'wcj_checkout_recalculate_checkout_update_fields', '#billing_country, #shipping_country' ) ); ?>;
125
  jQuery(document.body).on("updated_checkout", function () {
126
  jQuery(selector).each(function (index) {
127
  if (old_values[index] != $(this).val()) {
@@ -145,7 +145,7 @@ class WCJ_Checkout_Customization extends WCJ_Module {
145
  */
146
  function are_conditions_valid() {
147
  $valid = false;
148
- $conditions = $this->get_option( 'wcj_checkout_restrict_countries_by_customer_ip_conditions', array() );
149
  foreach ( $conditions as $key => $condition ) {
150
  $function = $condition;
151
  $valid = $function();
@@ -166,8 +166,8 @@ class WCJ_Checkout_Customization extends WCJ_Module {
166
  */
167
  function restrict_countries_by_customer_ip( $countries ) {
168
  if (
169
- ( 'yes' === $this->get_option( 'wcj_checkout_restrict_countries_by_customer_ip_ignore_admin', 'no' ) && is_admin() ) ||
170
- ( ! empty( $this->get_option( 'wcj_checkout_restrict_countries_by_customer_ip_conditions', array() ) ) && ! $this->are_conditions_valid() )
171
  ) {
172
  return $countries;
173
  }
@@ -175,14 +175,14 @@ class WCJ_Checkout_Customization extends WCJ_Module {
175
 
176
  // Get country from 'billing_country' user meta
177
  if (
178
- 'yes' === get_option( 'wcj_checkout_restrict_countries_by_user_billing_country', 'no' ) &&
179
  0 != ( $user_id = get_current_user_id() )
180
  ) {
181
  $user_country = ! empty( $user_billing_country = get_user_meta( $user_id, 'billing_country', true ) ) ? $user_billing_country : wcj_get_country_by_ip();
182
  }
183
 
184
  // Get country from a manual order ID created by YITH Request a Quote plugin
185
- if ( 'yes' === get_option( 'wcj_checkout_restrict_countries_based_on_yith_raq', 'no' ) && class_exists( 'YITH_Request_Quote' ) ) {
186
  $yith_order_id = WC()->session->get( 'order_awaiting_payment' );
187
  if ( ! empty( $yith_order_id ) ) {
188
  $user_country = ! empty( $order_billing_country = get_post_meta( $yith_order_id, '_billing_country', true ) ) ? $order_billing_country : wcj_get_country_by_ip();
@@ -198,7 +198,7 @@ class WCJ_Checkout_Customization extends WCJ_Module {
198
  * @since 3.3.0
199
  */
200
  function checkout_login_message( $message ) {
201
- return get_option( 'wcj_checkout_customization_checkout_login_message', __( 'Returning customer?', 'woocommerce' ) );
202
  }
203
 
204
  /**
@@ -213,7 +213,7 @@ class WCJ_Checkout_Customization extends WCJ_Module {
213
  $post = get_post( wcj_get_order_id( $_order ) );
214
  setup_postdata( $post );
215
  }
216
- $message = do_shortcode( get_option( 'wcj_checkout_customization_order_received_message', __( 'Thank you. Your order has been received.', 'woocommerce' ) ) );
217
  if ( null != $_order ) {
218
  wp_reset_postdata();
219
  }
@@ -228,16 +228,16 @@ class WCJ_Checkout_Customization extends WCJ_Module {
228
  */
229
  function maybe_add_description( $field, $key, $args, $value ) {
230
  if ( is_user_logged_in() ) {
231
- $fields_to_disable = get_option( 'wcj_checkout_customization_disable_fields_for_logged', array() );
232
  if ( empty( $fields_to_disable ) ) {
233
  $fields_to_disable = array();
234
  }
235
- $fields_to_disable_custom_r = array_map( 'trim', explode( ',', apply_filters( 'booster_option', '', get_option( 'wcj_checkout_customization_disable_fields_for_logged_custom_r', '' ) ) ) );
236
- $fields_to_disable_custom_d = array_map( 'trim', explode( ',', apply_filters( 'booster_option', '', get_option( 'wcj_checkout_customization_disable_fields_for_logged_custom_d', '' ) ) ) );
237
  $fields_to_disable = array_merge( $fields_to_disable, $fields_to_disable_custom_r, $fields_to_disable_custom_d );
238
  if ( ! empty( $fields_to_disable ) ) {
239
  if ( in_array( $key, $fields_to_disable ) ) {
240
- $desc = get_option( 'wcj_checkout_customization_disable_fields_for_logged_message',
241
  '<em>' . __( 'This field can not be changed', 'woocommerce-jetpack' ) . '</em>' );
242
  if ( '' != $desc ) {
243
  $field = str_replace( '__WCJ_TEMPORARY_VALUE_TO_REPLACE__', $desc, $field );
@@ -259,15 +259,15 @@ class WCJ_Checkout_Customization extends WCJ_Module {
259
  */
260
  function maybe_disable_fields( $checkout_fields ) {
261
  if ( is_user_logged_in() ) {
262
- $fields_to_disable = get_option( 'wcj_checkout_customization_disable_fields_for_logged', array() );
263
  if ( empty( $fields_to_disable ) ) {
264
  $fields_to_disable = array();
265
  }
266
- $fields_to_disable_custom_r = array_map( 'trim', explode( ',', apply_filters( 'booster_option', '', get_option( 'wcj_checkout_customization_disable_fields_for_logged_custom_r', '' ) ) ) );
267
- $fields_to_disable_custom_d = array_map( 'trim', explode( ',', apply_filters( 'booster_option', '', get_option( 'wcj_checkout_customization_disable_fields_for_logged_custom_d', '' ) ) ) );
268
  $fields_to_disable = array_merge( $fields_to_disable, $fields_to_disable_custom_r, $fields_to_disable_custom_d );
269
  $disable_type_fields = array_merge( array( 'billing_country', 'shipping_country' ), $fields_to_disable_custom_d );
270
- $do_add_desc_placeholder = ( '' != get_option( 'wcj_checkout_customization_disable_fields_for_logged_message',
271
  '<em>' . __( 'This field can not be changed', 'woocommerce-jetpack' ) . '</em>' ) );
272
  if ( ! empty( $fields_to_disable ) ) {
273
  foreach ( $fields_to_disable as $field_to_disable ) {
30
 
31
  if ( $this->is_enabled() ) {
32
  // "Create an account?" Checkbox
33
+ if ( 'default' != ( $create_account_default = wcj_get_option( 'wcj_checkout_create_account_default_checked', 'default' ) ) ) {
34
  if ( 'checked' === $create_account_default ) {
35
  add_filter( 'woocommerce_create_account_default_checked', '__return_true' );
36
  } elseif ( 'not_checked' === $create_account_default ) {
38
  }
39
  }
40
  // Hide "Order Again" button
41
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_hide_order_again', 'no' ) ) {
42
  add_action( 'init', array( $this, 'checkout_hide_order_again' ), PHP_INT_MAX );
43
  }
44
  // Disable Fields on Checkout for Logged Users
60
  add_filter( 'woocommerce_form_field_' . $checkout_fields_type, array( $this, 'maybe_add_description' ), PHP_INT_MAX, 4 );
61
  }
62
  // Custom "order received" message text
63
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_customization_order_received_message_enabled', 'no' ) ) {
64
  add_filter( 'woocommerce_thankyou_order_received_text', array( $this, 'customize_order_received_message' ), PHP_INT_MAX, 2 );
65
  }
66
  // Custom checkout login message
67
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_customization_checkout_login_message_enabled', 'no' ) ) {
68
  add_filter( 'woocommerce_checkout_login_message', array( $this, 'checkout_login_message' ), PHP_INT_MAX );
69
  }
70
  // Restrict countries by customer's IP
71
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_restrict_countries_by_customer_ip_billing', 'no' ) ) {
72
  add_filter( 'woocommerce_countries_allowed_countries', array( $this, 'restrict_countries_by_customer_ip' ), PHP_INT_MAX );
73
  }
74
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_checkout_restrict_countries_by_customer_ip_shipping', 'no' ) ) ) {
75
  add_filter( 'woocommerce_countries_shipping_countries', array( $this, 'restrict_countries_by_customer_ip' ), PHP_INT_MAX );
76
  }
77
  // Recalculate Checkout
78
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_recalculate_checkout_update_enable', 'no' ) ) {
79
  add_action( 'wp_footer', array( $this, 'recalculate_checkout' ), 50 );
80
  }
81
  // Update Checkout
82
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_force_checkout_update_enable', 'no' ) ) {
83
  add_action( 'wp_footer', array( $this, 'update_checkout' ), 50 );
84
  }
85
  }
98
  ?>
99
  <script type="text/javascript">
100
  jQuery(function ($) {
101
+ var selector = <?php echo wp_json_encode( wcj_get_option( 'wcj_checkout_force_checkout_update_fields', '' ) ); ?>;
102
  jQuery(selector).on('change', function () {
103
  $('body').trigger('update_checkout');
104
  });
121
  <script type="text/javascript">
122
  jQuery(function ($) {
123
  var old_values = [];
124
+ var selector = <?php echo wp_json_encode( wcj_get_option( 'wcj_checkout_recalculate_checkout_update_fields', '#billing_country, #shipping_country' ) ); ?>;
125
  jQuery(document.body).on("updated_checkout", function () {
126
  jQuery(selector).each(function (index) {
127
  if (old_values[index] != $(this).val()) {
145
  */
146
  function are_conditions_valid() {
147
  $valid = false;
148
+ $conditions = wcj_get_option( 'wcj_checkout_restrict_countries_by_customer_ip_conditions', array() );
149
  foreach ( $conditions as $key => $condition ) {
150
  $function = $condition;
151
  $valid = $function();
166
  */
167
  function restrict_countries_by_customer_ip( $countries ) {
168
  if (
169
+ ( 'yes' === wcj_get_option( 'wcj_checkout_restrict_countries_by_customer_ip_ignore_admin', 'no' ) && is_admin() ) ||
170
+ ( ! empty( wcj_get_option( 'wcj_checkout_restrict_countries_by_customer_ip_conditions', array() ) ) && ! $this->are_conditions_valid() )
171
  ) {
172
  return $countries;
173
  }
175
 
176
  // Get country from 'billing_country' user meta
177
  if (
178
+ 'yes' === wcj_get_option( 'wcj_checkout_restrict_countries_by_user_billing_country', 'no' ) &&
179
  0 != ( $user_id = get_current_user_id() )
180
  ) {
181
  $user_country = ! empty( $user_billing_country = get_user_meta( $user_id, 'billing_country', true ) ) ? $user_billing_country : wcj_get_country_by_ip();
182
  }
183
 
184
  // Get country from a manual order ID created by YITH Request a Quote plugin
185
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_restrict_countries_based_on_yith_raq', 'no' ) && class_exists( 'YITH_Request_Quote' ) ) {
186
  $yith_order_id = WC()->session->get( 'order_awaiting_payment' );
187
  if ( ! empty( $yith_order_id ) ) {
188
  $user_country = ! empty( $order_billing_country = get_post_meta( $yith_order_id, '_billing_country', true ) ) ? $order_billing_country : wcj_get_country_by_ip();
198
  * @since 3.3.0
199
  */
200
  function checkout_login_message( $message ) {
201
+ return wcj_get_option( 'wcj_checkout_customization_checkout_login_message', __( 'Returning customer?', 'woocommerce' ) );
202
  }
203
 
204
  /**
213
  $post = get_post( wcj_get_order_id( $_order ) );
214
  setup_postdata( $post );
215
  }
216
+ $message = do_shortcode( wcj_get_option( 'wcj_checkout_customization_order_received_message', __( 'Thank you. Your order has been received.', 'woocommerce' ) ) );
217
  if ( null != $_order ) {
218
  wp_reset_postdata();
219
  }
228
  */
229
  function maybe_add_description( $field, $key, $args, $value ) {
230
  if ( is_user_logged_in() ) {
231
+ $fields_to_disable = wcj_get_option( 'wcj_checkout_customization_disable_fields_for_logged', array() );
232
  if ( empty( $fields_to_disable ) ) {
233
  $fields_to_disable = array();
234
  }
235
+ $fields_to_disable_custom_r = array_map( 'trim', explode( ',', apply_filters( 'booster_option', '', wcj_get_option( 'wcj_checkout_customization_disable_fields_for_logged_custom_r', '' ) ) ) );
236
+ $fields_to_disable_custom_d = array_map( 'trim', explode( ',', apply_filters( 'booster_option', '', wcj_get_option( 'wcj_checkout_customization_disable_fields_for_logged_custom_d', '' ) ) ) );
237
  $fields_to_disable = array_merge( $fields_to_disable, $fields_to_disable_custom_r, $fields_to_disable_custom_d );
238
  if ( ! empty( $fields_to_disable ) ) {
239
  if ( in_array( $key, $fields_to_disable ) ) {
240
+ $desc = wcj_get_option( 'wcj_checkout_customization_disable_fields_for_logged_message',
241
  '<em>' . __( 'This field can not be changed', 'woocommerce-jetpack' ) . '</em>' );
242
  if ( '' != $desc ) {
243
  $field = str_replace( '__WCJ_TEMPORARY_VALUE_TO_REPLACE__', $desc, $field );
259
  */
260
  function maybe_disable_fields( $checkout_fields ) {
261
  if ( is_user_logged_in() ) {
262
+ $fields_to_disable = wcj_get_option( 'wcj_checkout_customization_disable_fields_for_logged', array() );
263
  if ( empty( $fields_to_disable ) ) {
264
  $fields_to_disable = array();
265
  }
266
+ $fields_to_disable_custom_r = array_map( 'trim', explode( ',', apply_filters( 'booster_option', '', wcj_get_option( 'wcj_checkout_customization_disable_fields_for_logged_custom_r', '' ) ) ) );
267
+ $fields_to_disable_custom_d = array_map( 'trim', explode( ',', apply_filters( 'booster_option', '', wcj_get_option( 'wcj_checkout_customization_disable_fields_for_logged_custom_d', '' ) ) ) );
268
  $fields_to_disable = array_merge( $fields_to_disable, $fields_to_disable_custom_r, $fields_to_disable_custom_d );
269
  $disable_type_fields = array_merge( array( 'billing_country', 'shipping_country' ), $fields_to_disable_custom_d );
270
+ $do_add_desc_placeholder = ( '' != wcj_get_option( 'wcj_checkout_customization_disable_fields_for_logged_message',
271
  '<em>' . __( 'This field can not be changed', 'woocommerce-jetpack' ) . '</em>' ) );
272
  if ( ! empty( $fields_to_disable ) ) {
273
  foreach ( $fields_to_disable as $field_to_disable ) {
includes/class-wcj-checkout-fees.php CHANGED
@@ -33,7 +33,7 @@ class WCJ_Checkout_Fees extends WCJ_Module {
33
  // Core function
34
  add_action( 'woocommerce_cart_calculate_fees', array( $this, 'add_fees' ), PHP_INT_MAX );
35
  // Checkout fields
36
- $this->checkout_fields = $this->get_option( 'wcj_checkout_fees_data_checkout_fields', array() );
37
  $this->checkout_fields = array_filter( $this->checkout_fields );
38
  if ( ! empty( $this->checkout_fields ) ) {
39
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
@@ -69,8 +69,8 @@ class WCJ_Checkout_Fees extends WCJ_Module {
69
  */
70
  function is_fee_valid( $fee_id, \WC_Cart $cart ) {
71
  $fees = $this->get_fees();
72
- $enabled = $this->get_option( 'wcj_checkout_fees_data_enabled', array() );
73
- $values = $this->get_option( 'wcj_checkout_fees_data_values', array() );
74
 
75
  // Check if is active and empty value
76
  if (
@@ -144,19 +144,19 @@ class WCJ_Checkout_Fees extends WCJ_Module {
144
  * @return array
145
  */
146
  function get_fees( $only_enabled = true, $adjust_priority = true ) {
147
- $total_number = apply_filters( 'booster_option', 1, $this->get_option( 'wcj_checkout_fees_total_number', 1 ) );
148
- $titles = $this->get_option( 'wcj_checkout_fees_data_titles', array() );
149
- $types = $this->get_option( 'wcj_checkout_fees_data_types', array() );
150
- $values = $this->get_option( 'wcj_checkout_fees_data_values', array() );
151
- $cart_min = $this->get_option( 'wcj_checkout_fees_cart_min_amount', array() );
152
- $cart_min_total = $this->get_option( 'wcj_checkout_fees_cart_min_total_amount', array() );
153
- $cart_max = $this->get_option( 'wcj_checkout_fees_cart_max_amount', array() );
154
- $cart_max_total = $this->get_option( 'wcj_checkout_fees_cart_max_total_amount', array() );
155
- $taxable = $this->get_option( 'wcj_checkout_fees_data_taxable', array() );
156
- $checkout_fields = $this->get_option( 'wcj_checkout_fees_data_values', array() );
157
- $enabled = $this->get_option( 'wcj_checkout_fees_data_enabled', array() );
158
- $overlap_opt = $this->get_option( 'wcj_checkout_fees_overlap', array() );
159
- $priorities = $this->get_option( 'wcj_checkout_fees_priority', array() );
160
 
161
  $fees = array();
162
  for ( $i = 1; $i <= $total_number; $i ++ ) {
@@ -202,12 +202,12 @@ class WCJ_Checkout_Fees extends WCJ_Module {
202
  * @return array
203
  */
204
  function get_valid_fees( $cart, $ignore_overlapped = true ) {
205
- $titles = $this->get_option( 'wcj_checkout_fees_data_titles', array() );
206
- $types = $this->get_option( 'wcj_checkout_fees_data_types', array() );
207
- $values = $this->get_option( 'wcj_checkout_fees_data_values', array() );
208
- $taxable = $this->get_option( 'wcj_checkout_fees_data_taxable', array() );
209
 
210
- //$total_number = apply_filters( 'booster_option', 1, $this->get_option( 'wcj_checkout_fees_total_number', 1 ) );
211
  $fees = $this->get_fees();
212
 
213
  $fees_to_add = array();
33
  // Core function
34
  add_action( 'woocommerce_cart_calculate_fees', array( $this, 'add_fees' ), PHP_INT_MAX );
35
  // Checkout fields
36
+ $this->checkout_fields = wcj_get_option( 'wcj_checkout_fees_data_checkout_fields', array() );
37
  $this->checkout_fields = array_filter( $this->checkout_fields );
38
  if ( ! empty( $this->checkout_fields ) ) {
39
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
69
  */
70
  function is_fee_valid( $fee_id, \WC_Cart $cart ) {
71
  $fees = $this->get_fees();
72
+ $enabled = wcj_get_option( 'wcj_checkout_fees_data_enabled', array() );
73
+ $values = wcj_get_option( 'wcj_checkout_fees_data_values', array() );
74
 
75
  // Check if is active and empty value
76
  if (
144
  * @return array
145
  */
146
  function get_fees( $only_enabled = true, $adjust_priority = true ) {
147
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_fees_total_number', 1 ) );
148
+ $titles = wcj_get_option( 'wcj_checkout_fees_data_titles', array() );
149
+ $types = wcj_get_option( 'wcj_checkout_fees_data_types', array() );
150
+ $values = wcj_get_option( 'wcj_checkout_fees_data_values', array() );
151
+ $cart_min = wcj_get_option( 'wcj_checkout_fees_cart_min_amount', array() );
152
+ $cart_min_total = wcj_get_option( 'wcj_checkout_fees_cart_min_total_amount', array() );
153
+ $cart_max = wcj_get_option( 'wcj_checkout_fees_cart_max_amount', array() );
154
+ $cart_max_total = wcj_get_option( 'wcj_checkout_fees_cart_max_total_amount', array() );
155
+ $taxable = wcj_get_option( 'wcj_checkout_fees_data_taxable', array() );
156
+ $checkout_fields = wcj_get_option( 'wcj_checkout_fees_data_values', array() );
157
+ $enabled = wcj_get_option( 'wcj_checkout_fees_data_enabled', array() );
158
+ $overlap_opt = wcj_get_option( 'wcj_checkout_fees_overlap', array() );
159
+ $priorities = wcj_get_option( 'wcj_checkout_fees_priority', array() );
160
 
161
  $fees = array();
162
  for ( $i = 1; $i <= $total_number; $i ++ ) {
202
  * @return array
203
  */
204
  function get_valid_fees( $cart, $ignore_overlapped = true ) {
205
+ $titles = wcj_get_option( 'wcj_checkout_fees_data_titles', array() );
206
+ $types = wcj_get_option( 'wcj_checkout_fees_data_types', array() );
207
+ $values = wcj_get_option( 'wcj_checkout_fees_data_values', array() );
208
+ $taxable = wcj_get_option( 'wcj_checkout_fees_data_taxable', array() );
209
 
210
+ //$total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_fees_total_number', 1 ) );
211
  $fees = $this->get_fees();
212
 
213
  $fees_to_add = array();
includes/class-wcj-checkout-files-upload.php CHANGED
@@ -33,18 +33,18 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
33
  $this->init_settings();
34
  add_action( 'add_meta_boxes', array( $this, 'add_file_admin_order_meta_box' ) );
35
  add_action( 'init', array( $this, 'process_checkout_files_upload' ) );
36
- if ( 'yes' === get_option( 'wcj_checkout_files_upload_remove_on_empty_cart', 'no' ) ) {
37
  add_action( 'woocommerce_cart_item_removed', array( $this, 'remove_files_on_empty_cart' ), PHP_INT_MAX, 2 );
38
  }
39
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_files_upload_total_number', 1 ) );
40
  for ( $i = 1; $i <= $total_number; $i++ ) {
41
- if ( 'disable' != ( $the_hook = get_option( 'wcj_checkout_files_upload_hook_' . $i, 'woocommerce_before_checkout_form' ) ) ) {
42
- add_action( $the_hook, array( $this, 'add_files_upload_form_to_checkout_frontend' ), get_option( 'wcj_checkout_files_upload_hook_priority_' . $i, 10 ) );
43
  }
44
- if ( 'yes' === get_option( 'wcj_checkout_files_upload_add_to_thankyou_' . $i, 'no' ) ) {
45
  add_action( 'woocommerce_thankyou', array( $this, 'add_files_upload_form_to_thankyou_and_myaccount_page' ), PHP_INT_MAX, 1 );
46
  }
47
- if ( 'yes' === get_option( 'wcj_checkout_files_upload_add_to_myaccount_' . $i, 'no' ) ) {
48
  add_action( 'woocommerce_view_order', array( $this, 'add_files_upload_form_to_thankyou_and_myaccount_page' ), PHP_INT_MAX, 1 );
49
  }
50
  }
@@ -64,7 +64,7 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
64
  * @todo (dev) (maybe) init settings on demand only
65
  */
66
  function init_settings() {
67
- $this->templates_settings = get_option( 'wcj_checkout_files_upload_templates', array() );
68
  $this->templates_settings = wp_parse_args( $this->templates_settings, array(
69
  'order_before' => '',
70
  'order_item' => sprintf( __( 'File: %s', 'woocommerce-jetpack' ), '%file_name%' ) . '<br>',
@@ -74,12 +74,12 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
74
  'email_item' => sprintf( __( 'File: %s', 'woocommerce-jetpack' ), '%file_name%' ) . '<br>',
75
  'email_after' => '',
76
  ) );
77
- $this->additional_admin_emails_settings = get_option( 'wcj_checkout_files_upload_additional_admin_emails', array() );
78
  $this->additional_admin_emails_settings = wp_parse_args( $this->additional_admin_emails_settings, array(
79
  'actions' => array(),
80
  'do_attach' => 'yes',
81
  ) );
82
- $this->checkout_files_upload_notice_type = get_option( 'wcj_checkout_files_upload_notice_type', 'wc_add_notice' );
83
  }
84
 
85
  /**
@@ -90,8 +90,8 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
90
  */
91
  function add_files_to_email_attachments( $attachments, $status, $order ) {
92
  if (
93
- ( 'new_order' === $status && 'yes' === get_option( 'wcj_checkout_files_upload_attach_to_admin_new_order', 'yes' ) ) ||
94
- ( 'customer_processing_order' === $status && 'yes' === get_option( 'wcj_checkout_files_upload_attach_to_customer_processing_order', 'yes' ) )
95
  ) {
96
  $total_files = get_post_meta( wcj_get_order_id( $order ), '_' . 'wcj_checkout_files_total_files', true );
97
  for ( $i = 1; $i <= $total_files; $i++ ) {
@@ -169,16 +169,16 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
169
  * @since 2.4.5
170
  */
171
  function validate_on_checkout( $posted ) {
172
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_files_upload_total_number', 1 ) );
173
  for ( $i = 1; $i <= $total_number; $i++ ) {
174
  if (
175
- 'yes' === get_option( 'wcj_checkout_files_upload_enabled_' . $i, 'yes' ) &&
176
  $this->is_visible( $i ) &&
177
- 'disable' != get_option( 'wcj_checkout_files_upload_hook_' . $i, 'woocommerce_before_checkout_form' )
178
  ) {
179
- if ( 'yes' === get_option( 'wcj_checkout_files_upload_required_' . $i, 'no' ) && null === wcj_session_get( 'wcj_checkout_files_upload_' . $i ) ) {
180
  // Is required
181
- $this->add_notice( get_option( 'wcj_checkout_files_upload_notice_required_' . $i, __( 'File is required!', 'woocommerce-jetpack' ) ), 'error' );
182
  }
183
  if ( null === wcj_session_get( 'wcj_checkout_files_upload_' . $i ) ) {
184
  continue;
@@ -186,18 +186,18 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
186
  $file_name = wcj_session_get( 'wcj_checkout_files_upload_' . $i );
187
  $file_name = $file_name['name'];
188
  $file_type = '.' . pathinfo( $file_name, PATHINFO_EXTENSION );
189
- if ( '' != ( $file_accept = get_option( 'wcj_checkout_files_upload_file_accept_' . $i, '' ) ) ) {
190
  // Validate file type
191
  $file_accept = explode( ',', $file_accept );
192
  if ( is_array( $file_accept ) && ! empty( $file_accept ) ) {
193
  if ( ! in_array( $file_type, $file_accept ) ) {
194
- $this->add_notice( sprintf( get_option( 'wcj_checkout_files_upload_notice_wrong_file_type_' . $i,
195
  __( 'Wrong file type: "%s"!', 'woocommerce-jetpack' ) ), $file_name ), 'error' );
196
  }
197
  }
198
  }
199
  if ( $this->is_extension_blocked( $file_type ) ) {
200
- $this->add_notice( sprintf( get_option( 'wcj_checkout_files_upload_notice_wrong_file_type_' . $i,
201
  __( 'Wrong file type: "%s"!', 'woocommerce-jetpack' ) ), $file_name ), 'error' );
202
  }
203
  }
@@ -263,14 +263,14 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
263
  * @since 3.2.3
264
  */
265
  function is_extension_blocked( $ext ) {
266
- if ( 'no' === get_option( 'wcj_checkout_files_upload_block_files_enabled', 'yes' ) ) {
267
  return false;
268
  }
269
  $ext = strtolower( $ext );
270
  if ( strlen( $ext ) > 0 && '.' === $ext[0] ) {
271
  $ext = substr( $ext, 1 );
272
  }
273
- $blocked_file_exts = get_option( 'wcj_checkout_files_upload_block_files_exts',
274
  'bat|exe|cmd|sh|php|php0|php1|php2|php3|php4|php5|php6|php7|php8|php9|ph|ph0|ph1|ph2|ph3|ph4|ph5|ph6|ph7|ph8|ph9|pl|cgi|386|dll|com|torrent|js|app|jar|pif|vb|vbscript|wsf|asp|cer|csr|jsp|drv|sys|ade|adp|bas|chm|cpl|crt|csh|fxp|hlp|hta|inf|ins|isp|jse|htaccess|htpasswd|ksh|lnk|mdb|mde|mdt|mdw|msc|msi|msp|mst|ops|pcd|prg|reg|scr|sct|shb|shs|url|vbe|vbs|wsc|wsf|wsh|html|htm'
275
  );
276
  $blocked_file_exts = explode( '|', $blocked_file_exts );
@@ -288,7 +288,7 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
288
  if ( ! file_exists( $upload_dir ) ) {
289
  mkdir( $upload_dir, 0755, true );
290
  }
291
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_files_upload_total_number', 1 ) );
292
  for ( $i = 1; $i <= $total_number; $i++ ) {
293
  if ( null !== wcj_session_get( 'wcj_checkout_files_upload_' . $i ) ) {
294
  $session_data = wcj_session_get( 'wcj_checkout_files_upload_' . $i );
@@ -320,7 +320,7 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
320
  if ( $cart->is_empty() ) {
321
  wcj_session_maybe_start();
322
  $any_files_removed = false;
323
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_files_upload_total_number', 1 ) ); $i++ ) {
324
  if ( null != ( $session_data = wcj_session_get( 'wcj_checkout_files_upload_' . $i ) ) ) {
325
  $any_files_removed = true;
326
  if ( isset( $session_data['tmp_name'] ) ) {
@@ -329,8 +329,8 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
329
  wcj_session_set( 'wcj_checkout_files_upload_' . $i, null );
330
  }
331
  }
332
- if ( $any_files_removed && 'yes' === get_option( 'wcj_checkout_files_upload_remove_on_empty_cart_add_notice', 'no' ) ) {
333
- $this->add_notice( get_option( 'wcj_checkout_files_upload_notice_remove_on_empty_cart', __( 'Files were successfully removed.', 'woocommerce-jetpack' ) ) );
334
  }
335
  }
336
  }
@@ -356,10 +356,10 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
356
  */
357
  function process_checkout_files_upload() {
358
  wcj_session_maybe_start();
359
- $admin_email = get_option( 'admin_email' );
360
  $admin_email_subject = __( 'Booster for WooCommerce: Checkout Files Upload: %action%', 'woocommerce-jetpack' );
361
  $admin_email_content = __( 'Order ID: %order_id%; File name: %file_name%', 'woocommerce-jetpack' );
362
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_files_upload_total_number', 1 ) );
363
  // Remove file
364
  for ( $i = 1; $i <= $total_number; $i++ ) {
365
  if ( isset( $_POST[ 'wcj_remove_checkout_file_' . $i ] ) ) {
@@ -370,7 +370,7 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
370
  $file_path = wcj_get_wcj_uploads_dir( 'checkout_files_upload' ) . '/' . $order_file_name;
371
  unlink( $file_path );
372
  $file_name = get_post_meta( $order_id, '_' . 'wcj_checkout_files_upload_real_name_' . $i, true );
373
- $this->add_notice( sprintf( get_option( 'wcj_checkout_files_upload_notice_success_remove_' . $i,
374
  __( 'File "%s" was successfully removed.', 'woocommerce-jetpack' ) ), $file_name ) );
375
  delete_post_meta( $order_id, '_' . 'wcj_checkout_files_upload_' . $i );
376
  delete_post_meta( $order_id, '_' . 'wcj_checkout_files_upload_real_name_' . $i );
@@ -393,7 +393,7 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
393
  $file_name = $session_data['name'];
394
  unlink( $session_data['tmp_name'] );
395
  wcj_session_set( 'wcj_checkout_files_upload_' . $i, null );
396
- $this->add_notice( sprintf( get_option( 'wcj_checkout_files_upload_notice_success_remove_' . $i,
397
  __( 'File "%s" was successfully removed.', 'woocommerce-jetpack' ) ), $file_name ) );
398
  do_action( 'wcj_checkout_files_upload', 'remove_file', false, $file_name );
399
  }
@@ -408,19 +408,19 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
408
  $is_valid = true;
409
  $real_file_name = $_FILES[ $file_name ]['name'];
410
  $file_type = '.' . pathinfo( $real_file_name, PATHINFO_EXTENSION );
411
- if ( '' != ( $file_accept = get_option( 'wcj_checkout_files_upload_file_accept_' . $i, '' ) ) ) {
412
  // Validate file type
413
  $file_accept = explode( ',', $file_accept );
414
  if ( is_array( $file_accept ) && ! empty( $file_accept ) ) {
415
  if ( ! in_array( $file_type, $file_accept ) ) {
416
- $this->add_notice( sprintf( get_option( 'wcj_checkout_files_upload_notice_wrong_file_type_' . $i,
417
  __( 'Wrong file type: "%s"!', 'woocommerce-jetpack' ) ), $real_file_name ), 'error' );
418
  $is_valid = false;
419
  }
420
  }
421
  }
422
  if ( $this->is_extension_blocked( $file_type ) ) {
423
- $this->add_notice( sprintf( get_option( 'wcj_checkout_files_upload_notice_wrong_file_type_' . $i,
424
  __( 'Wrong file type: "%s"!', 'woocommerce-jetpack' ) ), $real_file_name ), 'error' );
425
  $is_valid = false;
426
  }
@@ -431,7 +431,7 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
431
  $session_data = $_FILES[ $file_name ];
432
  $session_data['tmp_name'] = $tmp_dest_file;
433
  wcj_session_set( $file_name, $session_data );
434
- $this->add_notice( sprintf( get_option( 'wcj_checkout_files_upload_notice_success_upload_' . $i,
435
  __( 'File "%s" was successfully uploaded.', 'woocommerce-jetpack' ) ), $_FILES[ $file_name ]['name'] ) );
436
  // To order
437
  if ( isset( $_POST[ 'wcj_checkout_files_upload_order_id_' . $i ] ) ) {
@@ -459,7 +459,7 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
459
  $_FILES[ $file_name ]['name'] );
460
  }
461
  } else {
462
- $this->add_notice( get_option( 'wcj_checkout_files_upload_notice_upload_no_file_' . $i,
463
  __( 'Please select file to upload!', 'woocommerce-jetpack' ) ), 'notice' );
464
  }
465
  }
@@ -546,19 +546,19 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
546
  }
547
 
548
  // Include by user role
549
- $user_roles = get_option( 'wcj_checkout_files_upload_show_user_roles_' . $i, '' );
550
  if ( ! empty( $user_roles ) && ! in_array( wcj_get_current_user_first_role(), $user_roles ) ) {
551
  return false;
552
  }
553
 
554
  // Exclude by user role
555
- $user_roles = get_option( 'wcj_checkout_files_upload_hide_user_roles_' . $i, '' );
556
  if ( ! empty( $user_roles ) && in_array( wcj_get_current_user_first_role(), $user_roles ) ) {
557
  return false;
558
  }
559
 
560
  // Include by product id
561
- $products_in = get_option( 'wcj_checkout_files_upload_show_products_in_' . $i );
562
  if ( ! empty( $products_in ) ) {
563
  $do_skip_by_products = true;
564
  if ( 0 != $order_id ) {
@@ -577,7 +577,7 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
577
  }
578
 
579
  // Exclude by product id
580
- $products_in = get_option( 'wcj_checkout_files_upload_hide_products_in_' . $i );
581
  if ( ! empty( $products_in ) ) {
582
  if ( 0 != $order_id ) {
583
  $the_order = wc_get_order( $order_id );
@@ -593,7 +593,7 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
593
  }
594
 
595
  // Include by product category
596
- $categories_in = get_option( 'wcj_checkout_files_upload_show_cats_in_' . $i );
597
  if ( ! empty( $categories_in ) ) {
598
  $do_skip_by_cats = true;
599
  if ( 0 != $order_id ) {
@@ -617,7 +617,7 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
617
  }
618
 
619
  // Exclude by product category
620
- $categories_in = get_option( 'wcj_checkout_files_upload_hide_cats_in_' . $i );
621
  if ( ! empty( $categories_in ) ) {
622
  if ( 0 != $order_id ) {
623
  $the_order = wc_get_order( $order_id );
@@ -637,7 +637,7 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
637
  }
638
 
639
  // Include by product tag
640
- $tags_in = get_option( 'wcj_checkout_files_upload_show_tags_in_' . $i );
641
  if ( ! empty( $tags_in ) ) {
642
  $do_skip_by_tags = true;
643
  if ( 0 != $order_id ) {
@@ -661,7 +661,7 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
661
  }
662
 
663
  // Exclude by product tag
664
- $tags_in = get_option( 'wcj_checkout_files_upload_hide_tags_in_' . $i );
665
  if ( ! empty( $tags_in ) ) {
666
  if ( 0 != $order_id ) {
667
  $the_order = wc_get_order( $order_id );
@@ -690,7 +690,7 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
690
  * @since 3.7.0
691
  */
692
  function maybe_get_image( $link, $i, $order_id = 0 ) {
693
- if ( 'yes' === get_option( 'wcj_checkout_files_upload_form_template_field_show_images', 'no' ) ) {
694
  if ( 0 != $order_id && isset( $_GET['key'] ) && ( $order = wc_get_order( $order_id ) ) && $order->key_is_valid( $_GET['key'] ) ) {
695
  $order_file_name = get_post_meta( $order_id, '_' . 'wcj_checkout_files_upload_' . $i, true );
696
  $tmp_file_name = wcj_get_wcj_uploads_dir( 'checkout_files_upload' ) . '/' . $order_file_name;
@@ -699,7 +699,7 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
699
  $tmp_file_name = $session_data['tmp_name'];
700
  }
701
  if ( @is_array( getimagesize( $tmp_file_name ) ) ) {
702
- return '<img style="' . get_option( 'wcj_checkout_files_upload_form_template_field_image_style', 'width:64px;' ) . '" src="' . $link. '"> ';
703
  }
704
  }
705
  return '';
@@ -714,11 +714,11 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
714
  function get_the_form( $i, $file_name, $order_id = 0 ) {
715
  $html = '';
716
  $html .= '<form enctype="multipart/form-data" action="" method="POST">';
717
- $html .= get_option( 'wcj_checkout_files_upload_form_template_before', '<table>' );
718
- if ( '' != ( $the_label = get_option( 'wcj_checkout_files_upload_label_' . $i, '' ) ) ) {
719
- $template = get_option( 'wcj_checkout_files_upload_form_template_label',
720
  '<tr><td colspan="2"><label for="%field_id%">%field_label%</label>%required_html%</td></tr>' );
721
- $required_html = ( 'yes' === get_option( 'wcj_checkout_files_upload_required_' . $i, 'no' ) ) ?
722
  '&nbsp;<abbr class="required" title="required">*</abbr>' : '';
723
  $html .= str_replace(
724
  array( '%field_id%', '%field_label%', '%required_html%' ),
@@ -728,14 +728,14 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
728
  }
729
  if ( '' == $file_name ) {
730
  $field_html = '<input type="file" name="wcj_checkout_files_upload_' . $i . '" id="wcj_checkout_files_upload_' . $i .
731
- '" accept="' . get_option( 'wcj_checkout_files_upload_file_accept_' . $i, '' ) . '">';
732
  $button_html = '<input type="submit"' .
733
  ' class="button alt"' .
734
  ' style="width:100%;"' .
735
  ' name="wcj_upload_checkout_file_' . $i . '"' .
736
  ' id="wcj_upload_checkout_file_' . $i . '"' .
737
- ' value="' . get_option( 'wcj_checkout_files_upload_label_upload_button_' . $i, __( 'Upload', 'woocommerce-jetpack' ) ) . '"' .
738
- ' data-value="' . get_option( 'wcj_checkout_files_upload_label_upload_button_' . $i, __( 'Upload', 'woocommerce-jetpack' ) ) . '">';
739
  } else {
740
  $link = add_query_arg( array( 'wcj_download_checkout_file' => $i, '_wpnonce' => wp_create_nonce( 'wcj_download_checkout_file' ), 'wcj_download_checkout_file_order_id' => $order_id ) );
741
  $field_html = '<a href="' . $link . '">' . $this->maybe_get_image( $link, $i, $order_id ) . $file_name . '</a>';
@@ -744,17 +744,17 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
744
  ' style="width:100%;"' .
745
  ' name="wcj_remove_checkout_file_' . $i . '"' .
746
  ' id="wcj_remove_checkout_file_' . $i . '"' .
747
- ' value="' . get_option( 'wcj_checkout_files_upload_label_remove_button_' . $i, __( 'Remove', 'woocommerce-jetpack' ) ) . '"' .
748
- ' data-value="' . get_option( 'wcj_checkout_files_upload_label_remove_button_' . $i, __( 'Remove', 'woocommerce-jetpack' ) ) . '">';
749
  }
750
- $template = get_option( 'wcj_checkout_files_upload_form_template_field',
751
  '<tr><td style="width:50%;max-width:50vw;">%field_html%</td><td style="width:50%;">%button_html%</td></tr>' );
752
  $html .= str_replace(
753
  array( '%field_html%', '%button_html%' ),
754
  array( $field_html, $button_html ),
755
  $template
756
  );
757
- $html .= get_option( 'wcj_checkout_files_upload_form_template_after', '</table>' );
758
  if ( 0 != $order_id ) {
759
  $html .= '<input type="hidden" name="wcj_checkout_files_upload_order_id_' . $i . '" value="' . $order_id . '">';
760
  }
@@ -770,13 +770,13 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
770
  */
771
  function add_files_upload_form_to_thankyou_and_myaccount_page( $order_id ) {
772
  $html = '';
773
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_files_upload_total_number', 1 ) );
774
  $current_filter = current_filter();
775
  for ( $i = 1; $i <= $total_number; $i++ ) {
776
- if ( 'yes' === get_option( 'wcj_checkout_files_upload_enabled_' . $i, 'yes' ) && $this->is_visible( $i, $order_id ) ) {
777
  if (
778
- ( 'yes' === get_option( 'wcj_checkout_files_upload_add_to_thankyou_' . $i, 'no' ) && 'woocommerce_thankyou' === $current_filter ) ||
779
- ( 'yes' === get_option( 'wcj_checkout_files_upload_add_to_myaccount_' . $i, 'no' ) && 'woocommerce_view_order' === $current_filter )
780
  ) {
781
  $file_name = get_post_meta( $order_id, '_' . 'wcj_checkout_files_upload_real_name_' . $i, true );
782
  $html .= $this->get_the_form( $i, $file_name, $order_id );
@@ -804,17 +804,17 @@ class WCJ_Checkout_Files_Upload extends WCJ_Module {
804
  */
805
  function add_files_upload_form_to_checkout_frontend_all( $is_direct_call = false ) {
806
  $html = '';
807
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_files_upload_total_number', 1 ) );
808
  if ( ! $is_direct_call ) {
809
  $current_filter = current_filter();
810
  $current_filter_priority = wcj_current_filter_priority();
811
  }
812
  for ( $i = 1; $i <= $total_number; $i++ ) {
813
  $is_filter_ok = ( $is_direct_call ) ? true : (
814
- $current_filter === get_option( 'wcj_checkout_files_upload_hook_' . $i, 'woocommerce_before_checkout_form' ) &&
815
- $current_filter_priority == get_option( 'wcj_checkout_files_upload_hook_priority_' . $i, 10 )
816
  );
817
- if ( 'yes' === get_option( 'wcj_checkout_files_upload_enabled_' . $i, 'yes' ) && $is_filter_ok && $this->is_visible( $i ) ) {
818
  $session_data = wcj_session_get( 'wcj_checkout_files_upload_' . $i );
819
  $file_name = ( null !== $session_data ? $session_data['name'] : '' );
820
  $html .= $this->get_the_form( $i, $file_name );
33
  $this->init_settings();
34
  add_action( 'add_meta_boxes', array( $this, 'add_file_admin_order_meta_box' ) );
35
  add_action( 'init', array( $this, 'process_checkout_files_upload' ) );
36
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_files_upload_remove_on_empty_cart', 'no' ) ) {
37
  add_action( 'woocommerce_cart_item_removed', array( $this, 'remove_files_on_empty_cart' ), PHP_INT_MAX, 2 );
38
  }
39
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_files_upload_total_number', 1 ) );
40
  for ( $i = 1; $i <= $total_number; $i++ ) {
41
+ if ( 'disable' != ( $the_hook = wcj_get_option( 'wcj_checkout_files_upload_hook_' . $i, 'woocommerce_before_checkout_form' ) ) ) {
42
+ add_action( $the_hook, array( $this, 'add_files_upload_form_to_checkout_frontend' ), wcj_get_option( 'wcj_checkout_files_upload_hook_priority_' . $i, 10 ) );
43
  }
44
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_files_upload_add_to_thankyou_' . $i, 'no' ) ) {
45
  add_action( 'woocommerce_thankyou', array( $this, 'add_files_upload_form_to_thankyou_and_myaccount_page' ), PHP_INT_MAX, 1 );
46
  }
47
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_files_upload_add_to_myaccount_' . $i, 'no' ) ) {
48
  add_action( 'woocommerce_view_order', array( $this, 'add_files_upload_form_to_thankyou_and_myaccount_page' ), PHP_INT_MAX, 1 );
49
  }
50
  }
64
  * @todo (dev) (maybe) init settings on demand only
65
  */
66
  function init_settings() {
67
+ $this->templates_settings = wcj_get_option( 'wcj_checkout_files_upload_templates', array() );
68
  $this->templates_settings = wp_parse_args( $this->templates_settings, array(
69
  'order_before' => '',
70
  'order_item' => sprintf( __( 'File: %s', 'woocommerce-jetpack' ), '%file_name%' ) . '<br>',
74
  'email_item' => sprintf( __( 'File: %s', 'woocommerce-jetpack' ), '%file_name%' ) . '<br>',
75
  'email_after' => '',
76
  ) );
77
+ $this->additional_admin_emails_settings = wcj_get_option( 'wcj_checkout_files_upload_additional_admin_emails', array() );
78
  $this->additional_admin_emails_settings = wp_parse_args( $this->additional_admin_emails_settings, array(
79
  'actions' => array(),
80
  'do_attach' => 'yes',
81
  ) );
82
+ $this->checkout_files_upload_notice_type = wcj_get_option( 'wcj_checkout_files_upload_notice_type', 'wc_add_notice' );
83
  }
84
 
85
  /**
90
  */
91
  function add_files_to_email_attachments( $attachments, $status, $order ) {
92
  if (
93
+ ( 'new_order' === $status && 'yes' === wcj_get_option( 'wcj_checkout_files_upload_attach_to_admin_new_order', 'yes' ) ) ||
94
+ ( 'customer_processing_order' === $status && 'yes' === wcj_get_option( 'wcj_checkout_files_upload_attach_to_customer_processing_order', 'yes' ) )
95
  ) {
96
  $total_files = get_post_meta( wcj_get_order_id( $order ), '_' . 'wcj_checkout_files_total_files', true );
97
  for ( $i = 1; $i <= $total_files; $i++ ) {
169
  * @since 2.4.5
170
  */
171
  function validate_on_checkout( $posted ) {
172
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_files_upload_total_number', 1 ) );
173
  for ( $i = 1; $i <= $total_number; $i++ ) {
174
  if (
175
+ 'yes' === wcj_get_option( 'wcj_checkout_files_upload_enabled_' . $i, 'yes' ) &&
176
  $this->is_visible( $i ) &&
177
+ 'disable' != wcj_get_option( 'wcj_checkout_files_upload_hook_' . $i, 'woocommerce_before_checkout_form' )
178
  ) {
179
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_files_upload_required_' . $i, 'no' ) && null === wcj_session_get( 'wcj_checkout_files_upload_' . $i ) ) {
180
  // Is required
181
+ $this->add_notice( wcj_get_option( 'wcj_checkout_files_upload_notice_required_' . $i, __( 'File is required!', 'woocommerce-jetpack' ) ), 'error' );
182
  }
183
  if ( null === wcj_session_get( 'wcj_checkout_files_upload_' . $i ) ) {
184
  continue;
186
  $file_name = wcj_session_get( 'wcj_checkout_files_upload_' . $i );
187
  $file_name = $file_name['name'];
188
  $file_type = '.' . pathinfo( $file_name, PATHINFO_EXTENSION );
189
+ if ( '' != ( $file_accept = wcj_get_option( 'wcj_checkout_files_upload_file_accept_' . $i, '' ) ) ) {
190
  // Validate file type
191
  $file_accept = explode( ',', $file_accept );
192
  if ( is_array( $file_accept ) && ! empty( $file_accept ) ) {
193
  if ( ! in_array( $file_type, $file_accept ) ) {
194
+ $this->add_notice( sprintf( wcj_get_option( 'wcj_checkout_files_upload_notice_wrong_file_type_' . $i,
195
  __( 'Wrong file type: "%s"!', 'woocommerce-jetpack' ) ), $file_name ), 'error' );
196
  }
197
  }
198
  }
199
  if ( $this->is_extension_blocked( $file_type ) ) {
200
+ $this->add_notice( sprintf( wcj_get_option( 'wcj_checkout_files_upload_notice_wrong_file_type_' . $i,
201
  __( 'Wrong file type: "%s"!', 'woocommerce-jetpack' ) ), $file_name ), 'error' );
202
  }
203
  }
263
  * @since 3.2.3
264
  */
265
  function is_extension_blocked( $ext ) {
266
+ if ( 'no' === wcj_get_option( 'wcj_checkout_files_upload_block_files_enabled', 'yes' ) ) {
267
  return false;
268
  }
269
  $ext = strtolower( $ext );
270
  if ( strlen( $ext ) > 0 && '.' === $ext[0] ) {
271
  $ext = substr( $ext, 1 );
272
  }
273
+ $blocked_file_exts = wcj_get_option( 'wcj_checkout_files_upload_block_files_exts',
274
  'bat|exe|cmd|sh|php|php0|php1|php2|php3|php4|php5|php6|php7|php8|php9|ph|ph0|ph1|ph2|ph3|ph4|ph5|ph6|ph7|ph8|ph9|pl|cgi|386|dll|com|torrent|js|app|jar|pif|vb|vbscript|wsf|asp|cer|csr|jsp|drv|sys|ade|adp|bas|chm|cpl|crt|csh|fxp|hlp|hta|inf|ins|isp|jse|htaccess|htpasswd|ksh|lnk|mdb|mde|mdt|mdw|msc|msi|msp|mst|ops|pcd|prg|reg|scr|sct|shb|shs|url|vbe|vbs|wsc|wsf|wsh|html|htm'
275
  );
276
  $blocked_file_exts = explode( '|', $blocked_file_exts );
288
  if ( ! file_exists( $upload_dir ) ) {
289
  mkdir( $upload_dir, 0755, true );
290
  }
291
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_files_upload_total_number', 1 ) );
292
  for ( $i = 1; $i <= $total_number; $i++ ) {
293
  if ( null !== wcj_session_get( 'wcj_checkout_files_upload_' . $i ) ) {
294
  $session_data = wcj_session_get( 'wcj_checkout_files_upload_' . $i );
320
  if ( $cart->is_empty() ) {
321
  wcj_session_maybe_start();
322
  $any_files_removed = false;
323
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_files_upload_total_number', 1 ) ); $i++ ) {
324
  if ( null != ( $session_data = wcj_session_get( 'wcj_checkout_files_upload_' . $i ) ) ) {
325
  $any_files_removed = true;
326
  if ( isset( $session_data['tmp_name'] ) ) {
329
  wcj_session_set( 'wcj_checkout_files_upload_' . $i, null );
330
  }
331
  }
332
+ if ( $any_files_removed && 'yes' === wcj_get_option( 'wcj_checkout_files_upload_remove_on_empty_cart_add_notice', 'no' ) ) {
333
+ $this->add_notice( wcj_get_option( 'wcj_checkout_files_upload_notice_remove_on_empty_cart', __( 'Files were successfully removed.', 'woocommerce-jetpack' ) ) );
334
  }
335
  }
336
  }
356
  */
357
  function process_checkout_files_upload() {
358
  wcj_session_maybe_start();
359
+ $admin_email = wcj_get_option( 'admin_email' );
360
  $admin_email_subject = __( 'Booster for WooCommerce: Checkout Files Upload: %action%', 'woocommerce-jetpack' );
361
  $admin_email_content = __( 'Order ID: %order_id%; File name: %file_name%', 'woocommerce-jetpack' );
362
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_files_upload_total_number', 1 ) );
363
  // Remove file
364
  for ( $i = 1; $i <= $total_number; $i++ ) {
365
  if ( isset( $_POST[ 'wcj_remove_checkout_file_' . $i ] ) ) {
370
  $file_path = wcj_get_wcj_uploads_dir( 'checkout_files_upload' ) . '/' . $order_file_name;
371
  unlink( $file_path );
372
  $file_name = get_post_meta( $order_id, '_' . 'wcj_checkout_files_upload_real_name_' . $i, true );
373
+ $this->add_notice( sprintf( wcj_get_option( 'wcj_checkout_files_upload_notice_success_remove_' . $i,
374
  __( 'File "%s" was successfully removed.', 'woocommerce-jetpack' ) ), $file_name ) );
375
  delete_post_meta( $order_id, '_' . 'wcj_checkout_files_upload_' . $i );
376
  delete_post_meta( $order_id, '_' . 'wcj_checkout_files_upload_real_name_' . $i );
393
  $file_name = $session_data['name'];
394
  unlink( $session_data['tmp_name'] );
395
  wcj_session_set( 'wcj_checkout_files_upload_' . $i, null );
396
+ $this->add_notice( sprintf( wcj_get_option( 'wcj_checkout_files_upload_notice_success_remove_' . $i,
397
  __( 'File "%s" was successfully removed.', 'woocommerce-jetpack' ) ), $file_name ) );
398
  do_action( 'wcj_checkout_files_upload', 'remove_file', false, $file_name );
399
  }
408
  $is_valid = true;
409
  $real_file_name = $_FILES[ $file_name ]['name'];
410
  $file_type = '.' . pathinfo( $real_file_name, PATHINFO_EXTENSION );
411
+ if ( '' != ( $file_accept = wcj_get_option( 'wcj_checkout_files_upload_file_accept_' . $i, '' ) ) ) {
412
  // Validate file type
413
  $file_accept = explode( ',', $file_accept );
414
  if ( is_array( $file_accept ) && ! empty( $file_accept ) ) {
415
  if ( ! in_array( $file_type, $file_accept ) ) {
416
+ $this->add_notice( sprintf( wcj_get_option( 'wcj_checkout_files_upload_notice_wrong_file_type_' . $i,
417
  __( 'Wrong file type: "%s"!', 'woocommerce-jetpack' ) ), $real_file_name ), 'error' );
418
  $is_valid = false;
419
  }
420
  }
421
  }
422
  if ( $this->is_extension_blocked( $file_type ) ) {
423
+ $this->add_notice( sprintf( wcj_get_option( 'wcj_checkout_files_upload_notice_wrong_file_type_' . $i,
424
  __( 'Wrong file type: "%s"!', 'woocommerce-jetpack' ) ), $real_file_name ), 'error' );
425
  $is_valid = false;
426
  }
431
  $session_data = $_FILES[ $file_name ];
432
  $session_data['tmp_name'] = $tmp_dest_file;
433
  wcj_session_set( $file_name, $session_data );
434
+ $this->add_notice( sprintf( wcj_get_option( 'wcj_checkout_files_upload_notice_success_upload_' . $i,
435
  __( 'File "%s" was successfully uploaded.', 'woocommerce-jetpack' ) ), $_FILES[ $file_name ]['name'] ) );
436
  // To order
437
  if ( isset( $_POST[ 'wcj_checkout_files_upload_order_id_' . $i ] ) ) {
459
  $_FILES[ $file_name ]['name'] );
460
  }
461
  } else {
462
+ $this->add_notice( wcj_get_option( 'wcj_checkout_files_upload_notice_upload_no_file_' . $i,
463
  __( 'Please select file to upload!', 'woocommerce-jetpack' ) ), 'notice' );
464
  }
465
  }
546
  }
547
 
548
  // Include by user role
549
+ $user_roles = wcj_get_option( 'wcj_checkout_files_upload_show_user_roles_' . $i, '' );
550
  if ( ! empty( $user_roles ) && ! in_array( wcj_get_current_user_first_role(), $user_roles ) ) {
551
  return false;
552
  }
553
 
554
  // Exclude by user role
555
+ $user_roles = wcj_get_option( 'wcj_checkout_files_upload_hide_user_roles_' . $i, '' );
556
  if ( ! empty( $user_roles ) && in_array( wcj_get_current_user_first_role(), $user_roles ) ) {
557
  return false;
558
  }
559
 
560
  // Include by product id
561
+ $products_in = wcj_get_option( 'wcj_checkout_files_upload_show_products_in_' . $i );
562
  if ( ! empty( $products_in ) ) {
563
  $do_skip_by_products = true;
564
  if ( 0 != $order_id ) {
577
  }
578
 
579
  // Exclude by product id
580
+ $products_in = wcj_get_option( 'wcj_checkout_files_upload_hide_products_in_' . $i );
581
  if ( ! empty( $products_in ) ) {
582
  if ( 0 != $order_id ) {
583
  $the_order = wc_get_order( $order_id );
593
  }
594
 
595
  // Include by product category
596
+ $categories_in = wcj_get_option( 'wcj_checkout_files_upload_show_cats_in_' . $i );
597
  if ( ! empty( $categories_in ) ) {
598
  $do_skip_by_cats = true;
599
  if ( 0 != $order_id ) {
617
  }
618
 
619
  // Exclude by product category
620
+ $categories_in = wcj_get_option( 'wcj_checkout_files_upload_hide_cats_in_' . $i );
621
  if ( ! empty( $categories_in ) ) {
622
  if ( 0 != $order_id ) {
623
  $the_order = wc_get_order( $order_id );
637
  }
638
 
639
  // Include by product tag
640
+ $tags_in = wcj_get_option( 'wcj_checkout_files_upload_show_tags_in_' . $i );
641
  if ( ! empty( $tags_in ) ) {
642
  $do_skip_by_tags = true;
643
  if ( 0 != $order_id ) {
661
  }
662
 
663
  // Exclude by product tag
664
+ $tags_in = wcj_get_option( 'wcj_checkout_files_upload_hide_tags_in_' . $i );
665
  if ( ! empty( $tags_in ) ) {
666
  if ( 0 != $order_id ) {
667
  $the_order = wc_get_order( $order_id );
690
  * @since 3.7.0
691
  */
692
  function maybe_get_image( $link, $i, $order_id = 0 ) {
693
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_files_upload_form_template_field_show_images', 'no' ) ) {
694
  if ( 0 != $order_id && isset( $_GET['key'] ) && ( $order = wc_get_order( $order_id ) ) && $order->key_is_valid( $_GET['key'] ) ) {
695
  $order_file_name = get_post_meta( $order_id, '_' . 'wcj_checkout_files_upload_' . $i, true );
696
  $tmp_file_name = wcj_get_wcj_uploads_dir( 'checkout_files_upload' ) . '/' . $order_file_name;
699
  $tmp_file_name = $session_data['tmp_name'];
700
  }
701
  if ( @is_array( getimagesize( $tmp_file_name ) ) ) {
702
+ return '<img style="' . wcj_get_option( 'wcj_checkout_files_upload_form_template_field_image_style', 'width:64px;' ) . '" src="' . $link. '"> ';
703
  }
704
  }
705
  return '';
714
  function get_the_form( $i, $file_name, $order_id = 0 ) {
715
  $html = '';
716
  $html .= '<form enctype="multipart/form-data" action="" method="POST">';
717
+ $html .= wcj_get_option( 'wcj_checkout_files_upload_form_template_before', '<table>' );
718
+ if ( '' != ( $the_label = wcj_get_option( 'wcj_checkout_files_upload_label_' . $i, '' ) ) ) {
719
+ $template = wcj_get_option( 'wcj_checkout_files_upload_form_template_label',
720
  '<tr><td colspan="2"><label for="%field_id%">%field_label%</label>%required_html%</td></tr>' );
721
+ $required_html = ( 'yes' === wcj_get_option( 'wcj_checkout_files_upload_required_' . $i, 'no' ) ) ?
722
  '&nbsp;<abbr class="required" title="required">*</abbr>' : '';
723
  $html .= str_replace(
724
  array( '%field_id%', '%field_label%', '%required_html%' ),
728
  }
729
  if ( '' == $file_name ) {
730
  $field_html = '<input type="file" name="wcj_checkout_files_upload_' . $i . '" id="wcj_checkout_files_upload_' . $i .
731
+ '" accept="' . wcj_get_option( 'wcj_checkout_files_upload_file_accept_' . $i, '' ) . '">';
732
  $button_html = '<input type="submit"' .
733
  ' class="button alt"' .
734
  ' style="width:100%;"' .
735
  ' name="wcj_upload_checkout_file_' . $i . '"' .
736
  ' id="wcj_upload_checkout_file_' . $i . '"' .
737
+ ' value="' . wcj_get_option( 'wcj_checkout_files_upload_label_upload_button_' . $i, __( 'Upload', 'woocommerce-jetpack' ) ) . '"' .
738
+ ' data-value="' . wcj_get_option( 'wcj_checkout_files_upload_label_upload_button_' . $i, __( 'Upload', 'woocommerce-jetpack' ) ) . '">';
739
  } else {
740
  $link = add_query_arg( array( 'wcj_download_checkout_file' => $i, '_wpnonce' => wp_create_nonce( 'wcj_download_checkout_file' ), 'wcj_download_checkout_file_order_id' => $order_id ) );
741
  $field_html = '<a href="' . $link . '">' . $this->maybe_get_image( $link, $i, $order_id ) . $file_name . '</a>';
744
  ' style="width:100%;"' .
745
  ' name="wcj_remove_checkout_file_' . $i . '"' .
746
  ' id="wcj_remove_checkout_file_' . $i . '"' .
747
+ ' value="' . wcj_get_option( 'wcj_checkout_files_upload_label_remove_button_' . $i, __( 'Remove', 'woocommerce-jetpack' ) ) . '"' .
748
+ ' data-value="' . wcj_get_option( 'wcj_checkout_files_upload_label_remove_button_' . $i, __( 'Remove', 'woocommerce-jetpack' ) ) . '">';
749
  }
750
+ $template = wcj_get_option( 'wcj_checkout_files_upload_form_template_field',
751
  '<tr><td style="width:50%;max-width:50vw;">%field_html%</td><td style="width:50%;">%button_html%</td></tr>' );
752
  $html .= str_replace(
753
  array( '%field_html%', '%button_html%' ),
754
  array( $field_html, $button_html ),
755
  $template
756
  );
757
+ $html .= wcj_get_option( 'wcj_checkout_files_upload_form_template_after', '</table>' );
758
  if ( 0 != $order_id ) {
759
  $html .= '<input type="hidden" name="wcj_checkout_files_upload_order_id_' . $i . '" value="' . $order_id . '">';
760
  }
770
  */
771
  function add_files_upload_form_to_thankyou_and_myaccount_page( $order_id ) {
772
  $html = '';
773
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_files_upload_total_number', 1 ) );
774
  $current_filter = current_filter();
775
  for ( $i = 1; $i <= $total_number; $i++ ) {
776
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_files_upload_enabled_' . $i, 'yes' ) && $this->is_visible( $i, $order_id ) ) {
777
  if (
778
+ ( 'yes' === wcj_get_option( 'wcj_checkout_files_upload_add_to_thankyou_' . $i, 'no' ) && 'woocommerce_thankyou' === $current_filter ) ||
779
+ ( 'yes' === wcj_get_option( 'wcj_checkout_files_upload_add_to_myaccount_' . $i, 'no' ) && 'woocommerce_view_order' === $current_filter )
780
  ) {
781
  $file_name = get_post_meta( $order_id, '_' . 'wcj_checkout_files_upload_real_name_' . $i, true );
782
  $html .= $this->get_the_form( $i, $file_name, $order_id );
804
  */
805
  function add_files_upload_form_to_checkout_frontend_all( $is_direct_call = false ) {
806
  $html = '';
807
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_files_upload_total_number', 1 ) );
808
  if ( ! $is_direct_call ) {
809
  $current_filter = current_filter();
810
  $current_filter_priority = wcj_current_filter_priority();
811
  }
812
  for ( $i = 1; $i <= $total_number; $i++ ) {
813
  $is_filter_ok = ( $is_direct_call ) ? true : (
814
+ $current_filter === wcj_get_option( 'wcj_checkout_files_upload_hook_' . $i, 'woocommerce_before_checkout_form' ) &&
815
+ $current_filter_priority == wcj_get_option( 'wcj_checkout_files_upload_hook_priority_' . $i, 10 )
816
  );
817
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_files_upload_enabled_' . $i, 'yes' ) && $is_filter_ok && $this->is_visible( $i ) ) {
818
  $session_data = wcj_session_get( 'wcj_checkout_files_upload_' . $i );
819
  $file_name = ( null !== $session_data ? $session_data['name'] : '' );
820
  $html .= $this->get_the_form( $i, $file_name );
includes/class-wcj-coupon-by-user-role.php CHANGED
@@ -34,7 +34,7 @@ class WCJ_Coupon_By_User_Role extends WCJ_Module {
34
  add_filter( 'woocommerce_coupons_enabled', array( $this, 'coupons_enabled' ), PHP_INT_MAX, 1 );
35
  add_filter( 'woocommerce_coupon_is_valid', array( $this, 'coupon_valid' ), PHP_INT_MAX, 3 );
36
  add_filter( 'woocommerce_coupon_error', array( $this, 'coupon_not_valid_message' ), PHP_INT_MAX, 3 );
37
- if ( $this->invalid_per_coupon_enabled = ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_coupon_by_user_role_invalid_per_coupon', 'no' ) ) ) ) {
38
  $this->meta_box_screen = 'shop_coupon';
39
  $this->meta_box_context = 'side';
40
  $this->meta_box_priority = 'default';
@@ -51,7 +51,7 @@ class WCJ_Coupon_By_User_Role extends WCJ_Module {
51
  * @since 3.6.0
52
  */
53
  function coupons_enabled( $is_enabled ) {
54
- $disabled_user_roles = get_option( 'wcj_coupon_by_user_role_disabled', '' );
55
  if ( ! empty( $disabled_user_roles ) && in_array( wcj_get_current_user_first_role(), $disabled_user_roles ) ) {
56
  return false;
57
  }
@@ -66,7 +66,7 @@ class WCJ_Coupon_By_User_Role extends WCJ_Module {
66
  * @todo (maybe) check if `$coupon->get_id()` is working in WC below v3.0.0
67
  */
68
  function coupon_valid( $valid, $coupon, $discounts ) {
69
- $invalid_user_roles = get_option( 'wcj_coupon_by_user_role_invalid', '' );
70
  if ( empty( $invalid_user_roles ) ) {
71
  $invalid_user_roles = array();
72
  }
34
  add_filter( 'woocommerce_coupons_enabled', array( $this, 'coupons_enabled' ), PHP_INT_MAX, 1 );
35
  add_filter( 'woocommerce_coupon_is_valid', array( $this, 'coupon_valid' ), PHP_INT_MAX, 3 );
36
  add_filter( 'woocommerce_coupon_error', array( $this, 'coupon_not_valid_message' ), PHP_INT_MAX, 3 );
37
+ if ( $this->invalid_per_coupon_enabled = ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_coupon_by_user_role_invalid_per_coupon', 'no' ) ) ) ) {
38
  $this->meta_box_screen = 'shop_coupon';
39
  $this->meta_box_context = 'side';
40
  $this->meta_box_priority = 'default';
51
  * @since 3.6.0
52
  */
53
  function coupons_enabled( $is_enabled ) {
54
+ $disabled_user_roles = wcj_get_option( 'wcj_coupon_by_user_role_disabled', '' );
55
  if ( ! empty( $disabled_user_roles ) && in_array( wcj_get_current_user_first_role(), $disabled_user_roles ) ) {
56
  return false;
57
  }
66
  * @todo (maybe) check if `$coupon->get_id()` is working in WC below v3.0.0
67
  */
68
  function coupon_valid( $valid, $coupon, $discounts ) {
69
+ $invalid_user_roles = wcj_get_option( 'wcj_coupon_by_user_role_invalid', '' );
70
  if ( empty( $invalid_user_roles ) ) {
71
  $invalid_user_roles = array();
72
  }
includes/class-wcj-coupon-code-generator.php CHANGED
@@ -32,7 +32,7 @@ class WCJ_Coupon_Code_Generator extends WCJ_Module {
32
  parent::__construct();
33
 
34
  if ( $this->is_enabled() ) {
35
- if ( 'yes' === get_option( 'wcj_coupons_code_generator_enabled', 'no' ) ) {
36
  add_action( 'wp_ajax_wcj_generate_coupon_code', array( $this, 'ajax_generate_coupon_code' ) );
37
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_generate_coupon_code_script' ) );
38
  }
@@ -81,7 +81,7 @@ class WCJ_Coupon_Code_Generator extends WCJ_Module {
81
  $str = time();
82
  }
83
  if ( '' === $algorithm ) {
84
- $algorithm = apply_filters( 'booster_option', 'crc32', get_option( 'wcj_coupons_code_generator_algorithm', 'crc32' ) );
85
  }
86
  switch ( $algorithm ) {
87
  case 'random_letters_and_numbers':
@@ -104,7 +104,7 @@ class WCJ_Coupon_Code_Generator extends WCJ_Module {
104
  break;
105
  }
106
  if ( '' === $length ) {
107
- $length = apply_filters( 'booster_option', 0, get_option( 'wcj_coupons_code_generator_length', 0 ) );
108
  }
109
  if ( $length > 0 && strlen( $code ) > $length ) {
110
  $code = substr( $code, 0, $length );
32
  parent::__construct();
33
 
34
  if ( $this->is_enabled() ) {
35
+ if ( 'yes' === wcj_get_option( 'wcj_coupons_code_generator_enabled', 'no' ) ) {
36
  add_action( 'wp_ajax_wcj_generate_coupon_code', array( $this, 'ajax_generate_coupon_code' ) );
37
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_generate_coupon_code_script' ) );
38
  }
81
  $str = time();
82
  }
83
  if ( '' === $algorithm ) {
84
+ $algorithm = apply_filters( 'booster_option', 'crc32', wcj_get_option( 'wcj_coupons_code_generator_algorithm', 'crc32' ) );
85
  }
86
  switch ( $algorithm ) {
87
  case 'random_letters_and_numbers':
104
  break;
105
  }
106
  if ( '' === $length ) {
107
+ $length = apply_filters( 'booster_option', 0, wcj_get_option( 'wcj_coupons_code_generator_length', 0 ) );
108
  }
109
  if ( $length > 0 && strlen( $code ) > $length ) {
110
  $code = substr( $code, 0, $length );
includes/class-wcj-cross-sells.php CHANGED
@@ -42,20 +42,20 @@ class WCJ_Cross_Sells extends WCJ_Module {
42
  add_filter( 'woocommerce_cross_sells_order', array( $this, 'cross_sells_order' ), PHP_INT_MAX );
43
  }
44
  if ( ! WCJ_IS_WC_VERSION_BELOW_3 ) {
45
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_cross_sells_global_enabled', 'no' ) ) ) {
46
  add_filter( 'woocommerce_product_get_cross_sell_ids', array( $this, 'cross_sells_ids' ), PHP_INT_MAX, 2 );
47
  }
48
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_cross_sells_exclude_not_in_stock', 'no' ) ) ) {
49
  add_filter( 'woocommerce_product_get_cross_sell_ids', array( $this, 'cross_sells_exclude_not_in_stock' ), PHP_INT_MAX, 2 );
50
  }
51
  }
52
- if ( 'yes' === get_option( 'wcj_cross_sells_hide', 'no' ) ) {
53
  add_action( 'init', array( $this, 'hide_cross_sells' ), PHP_INT_MAX );
54
  }
55
- if ( 'no_changes' != get_option( 'wcj_cross_sells_position', 'no_changes' ) ) {
56
  add_action( 'init', array( $this, 'reposition_cross_sells' ), PHP_INT_MAX );
57
  }
58
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_cross_sells_replace_with_cross_sells', 'no' ) ) ) {
59
  add_filter( 'woocommerce_product_add_to_cart_url', array( $this, 'replace_with_cross_sells_to_url' ), PHP_INT_MAX, 2 );
60
  add_action( 'woocommerce_cart_loaded_from_session', array( $this, 'remove_from_cart_by_product_id' ) );
61
  }
@@ -119,7 +119,7 @@ class WCJ_Cross_Sells extends WCJ_Module {
119
  */
120
  function reposition_cross_sells() {
121
  $this->hide_cross_sells();
122
- add_action( get_option( 'wcj_cross_sells_position', 'no_changes' ), 'woocommerce_cross_sell_display', get_option( 'wcj_cross_sells_position_priority', 10 ) );
123
  }
124
 
125
  /**
@@ -158,7 +158,7 @@ class WCJ_Cross_Sells extends WCJ_Module {
158
  * @todo [feature] (maybe) on per category/tag basis
159
  */
160
  function cross_sells_ids( $ids, $_product ) {
161
- $global_cross_sells = get_option( 'wcj_cross_sells_global_ids', '' );
162
  if ( ! empty( $global_cross_sells ) ) {
163
  $global_cross_sells = array_unique( $global_cross_sells );
164
  $product_id = wcj_get_product_id_or_variation_parent_id( $_product );
@@ -176,7 +176,7 @@ class WCJ_Cross_Sells extends WCJ_Module {
176
  * @since 3.5.3
177
  */
178
  function cross_sells_order( $order ) {
179
- return ( 'no_changes' != ( $_order = get_option( 'wcj_cross_sells_order', 'no_changes' ) ) ? $_order : $order );
180
  }
181
 
182
  /**
@@ -186,7 +186,7 @@ class WCJ_Cross_Sells extends WCJ_Module {
186
  * @since 3.5.3
187
  */
188
  function cross_sells_orderby( $orderby ) {
189
- return ( 'no_changes' != ( $_orderby = get_option( 'wcj_cross_sells_orderby', 'no_changes' ) ) ? $_orderby : $orderby );
190
  }
191
 
192
  /**
@@ -196,7 +196,7 @@ class WCJ_Cross_Sells extends WCJ_Module {
196
  * @since 3.5.3
197
  */
198
  function cross_sells_columns( $columns ) {
199
- return ( 0 != ( $_columns = get_option( 'wcj_cross_sells_columns', 0 ) ) ? $_columns : $columns );
200
  }
201
 
202
  /**
@@ -206,7 +206,7 @@ class WCJ_Cross_Sells extends WCJ_Module {
206
  * @since 3.5.3
207
  */
208
  function cross_sells_total( $limit ) {
209
- return ( 0 != ( $_limit = get_option( 'wcj_cross_sells_total', 0 ) ) ? $_limit : $limit );
210
  }
211
 
212
  }
42
  add_filter( 'woocommerce_cross_sells_order', array( $this, 'cross_sells_order' ), PHP_INT_MAX );
43
  }
44
  if ( ! WCJ_IS_WC_VERSION_BELOW_3 ) {
45
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_cross_sells_global_enabled', 'no' ) ) ) {
46
  add_filter( 'woocommerce_product_get_cross_sell_ids', array( $this, 'cross_sells_ids' ), PHP_INT_MAX, 2 );
47
  }
48
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_cross_sells_exclude_not_in_stock', 'no' ) ) ) {
49
  add_filter( 'woocommerce_product_get_cross_sell_ids', array( $this, 'cross_sells_exclude_not_in_stock' ), PHP_INT_MAX, 2 );
50
  }
51
  }
52
+ if ( 'yes' === wcj_get_option( 'wcj_cross_sells_hide', 'no' ) ) {
53
  add_action( 'init', array( $this, 'hide_cross_sells' ), PHP_INT_MAX );
54
  }
55
+ if ( 'no_changes' != wcj_get_option( 'wcj_cross_sells_position', 'no_changes' ) ) {
56
  add_action( 'init', array( $this, 'reposition_cross_sells' ), PHP_INT_MAX );
57
  }
58
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_cross_sells_replace_with_cross_sells', 'no' ) ) ) {
59
  add_filter( 'woocommerce_product_add_to_cart_url', array( $this, 'replace_with_cross_sells_to_url' ), PHP_INT_MAX, 2 );
60
  add_action( 'woocommerce_cart_loaded_from_session', array( $this, 'remove_from_cart_by_product_id' ) );
61
  }
119
  */
120
  function reposition_cross_sells() {
121
  $this->hide_cross_sells();
122
+ add_action( wcj_get_option( 'wcj_cross_sells_position', 'no_changes' ), 'woocommerce_cross_sell_display', wcj_get_option( 'wcj_cross_sells_position_priority', 10 ) );
123
  }
124
 
125
  /**
158
  * @todo [feature] (maybe) on per category/tag basis
159
  */
160
  function cross_sells_ids( $ids, $_product ) {
161
+ $global_cross_sells = wcj_get_option( 'wcj_cross_sells_global_ids', '' );
162
  if ( ! empty( $global_cross_sells ) ) {
163
  $global_cross_sells = array_unique( $global_cross_sells );
164
  $product_id = wcj_get_product_id_or_variation_parent_id( $_product );
176
  * @since 3.5.3
177
  */
178
  function cross_sells_order( $order ) {
179
+ return ( 'no_changes' != ( $_order = wcj_get_option( 'wcj_cross_sells_order', 'no_changes' ) ) ? $_order : $order );
180
  }
181
 
182
  /**
186
  * @since 3.5.3
187
  */
188
  function cross_sells_orderby( $orderby ) {
189
+ return ( 'no_changes' != ( $_orderby = wcj_get_option( 'wcj_cross_sells_orderby', 'no_changes' ) ) ? $_orderby : $orderby );
190
  }
191
 
192
  /**
196
  * @since 3.5.3
197
  */
198
  function cross_sells_columns( $columns ) {
199
+ return ( 0 != ( $_columns = wcj_get_option( 'wcj_cross_sells_columns', 0 ) ) ? $_columns : $columns );
200
  }
201
 
202
  /**
206
  * @since 3.5.3
207
  */
208
  function cross_sells_total( $limit ) {
209
+ return ( 0 != ( $_limit = wcj_get_option( 'wcj_cross_sells_total', 0 ) ) ? $_limit : $limit );
210
  }
211
 
212
  }
includes/class-wcj-currency-exchange-rates.php CHANGED
@@ -49,7 +49,7 @@ class WCJ_Currency_Exchange_Rates extends WCJ_Module {
49
  * @return mixed
50
  */
51
  function force_dot_as_exchange_rate_decimal_separator( $value ) {
52
- if ( 'yes' !== get_option( 'wcj_currency_exchange_rates_point_decimal_separator', 'no' ) ) {
53
  return $value;
54
  }
55
  $value = str_replace( ',', '.', $value );
@@ -125,55 +125,55 @@ class WCJ_Currency_Exchange_Rates extends WCJ_Module {
125
  $currencies[] = $additional_currency;
126
  }
127
  // Additional currencies (via custom currencies section)
128
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_currency_exchange_custom_currencies_total_number', 1 ) );
129
  for ( $i = 1; $i <= $total_number; $i++ ) {
130
- if ( 'disabled' != ( $additional_currency = get_option( 'wcj_currency_exchange_custom_currencies_' . $i, 'disabled' ) ) ) {
131
  $currencies[] = $additional_currency;
132
  }
133
  }
134
  if ( wcj_is_module_enabled( 'price_by_country' ) ) {
135
  // Currency Pairs - Price by Country
136
- if ( 'manual' != apply_filters( 'booster_option', 'manual', get_option( 'wcj_price_by_country_auto_exchange_rates', 'manual' ) ) ) {
137
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i++ ) {
138
- $currency_to = get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $i );
139
  $currencies[] = $currency_to;
140
  }
141
  }
142
  }
143
  if ( wcj_is_module_enabled( 'multicurrency' ) ) {
144
  // Currency Pairs - Multicurrency
145
- if ( 'manual' != apply_filters( 'booster_option', 'manual', get_option( 'wcj_multicurrency_exchange_rate_update_auto', 'manual' ) ) ) {
146
- for ( $i = 1; $i <= apply_filters( 'booster_option', 2, get_option( 'wcj_multicurrency_total_number', 2 ) ); $i++ ) {
147
- $currency_to = get_option( 'wcj_multicurrency_currency_' . $i );
148
  $currencies[] = $currency_to;
149
  }
150
  }
151
  }
152
  if ( wcj_is_module_enabled( 'multicurrency_base_price' ) ) {
153
  // Currency Pairs - Multicurrency Product Base Price
154
- if ( 'manual' != apply_filters( 'booster_option', 'manual', get_option( 'wcj_multicurrency_base_price_exchange_rate_update', 'manual' ) ) ) {
155
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_multicurrency_base_price_total_number', 1 ) ); $i++ ) {
156
- $currency_to = get_option( 'wcj_multicurrency_base_price_currency_' . $i );
157
  $currencies[] = $currency_to;
158
  }
159
  }
160
  }
161
  if ( wcj_is_module_enabled( 'currency_per_product' ) ) {
162
  // Currency Pairs - Currency per Product
163
- if ( 'manual' != apply_filters( 'booster_option', 'manual', get_option( 'wcj_currency_per_product_exchange_rate_update', 'manual' ) ) ) {
164
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_currency_per_product_total_number', 1 ) ); $i++ ) {
165
- $currency_to = get_option( 'wcj_currency_per_product_currency_' . $i );
166
  $currencies[] = $currency_to;
167
  }
168
  }
169
  }
170
  if ( wcj_is_module_enabled( 'payment_gateways_currency' ) ) {
171
- if ( 'manual' != apply_filters( 'booster_option', 'manual', get_option( 'wcj_gateways_currency_exchange_rate_update_auto', 'manual' ) ) ) {
172
  // Currency Pairs - Gateway Currency
173
  global $woocommerce;
174
  $available_gateways = $woocommerce->payment_gateways->payment_gateways();
175
  foreach ( $available_gateways as $key => $gateway ) {
176
- $currency_to = get_option( 'wcj_gateways_currency_' . $key );
177
  if ( 'no_changes' != $currency_to ) {
178
  $currencies[] = $currency_to;
179
  }
@@ -257,13 +257,13 @@ class WCJ_Currency_Exchange_Rates extends WCJ_Module {
257
  if ( $add_extra_settings ) {
258
  // Server
259
  $exchange_rate_servers = wcj_get_currency_exchange_rate_servers();
260
- $exchange_rate_server = get_option( 'wcj_currency_exchange_rates_server', 'ecb' );
261
  $default_server = ( isset( $exchange_rate_servers[ $exchange_rate_server ] ) ? $exchange_rate_servers[ $exchange_rate_server ] : $exchange_rate_server );
262
  // Offset
263
- $default_offset = get_option( 'wcj_currency_exchange_rates_offset_percent', 0 );
264
  }
265
  $settings = array();
266
- $currency_from = get_option( 'woocommerce_currency' );
267
  $currencies = $this->get_all_currencies_exchange_rates_currencies();
268
  foreach ( $currencies as $currency ) {
269
  $settings = $this->add_currency_pair_setting( $currency_from, $currency, $settings );
49
  * @return mixed
50
  */
51
  function force_dot_as_exchange_rate_decimal_separator( $value ) {
52
+ if ( 'yes' !== wcj_get_option( 'wcj_currency_exchange_rates_point_decimal_separator', 'no' ) ) {
53
  return $value;
54
  }
55
  $value = str_replace( ',', '.', $value );
125
  $currencies[] = $additional_currency;
126
  }
127
  // Additional currencies (via custom currencies section)
128
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_currency_exchange_custom_currencies_total_number', 1 ) );
129
  for ( $i = 1; $i <= $total_number; $i++ ) {
130
+ if ( 'disabled' != ( $additional_currency = wcj_get_option( 'wcj_currency_exchange_custom_currencies_' . $i, 'disabled' ) ) ) {
131
  $currencies[] = $additional_currency;
132
  }
133
  }
134
  if ( wcj_is_module_enabled( 'price_by_country' ) ) {
135
  // Currency Pairs - Price by Country
136
+ if ( 'manual' != apply_filters( 'booster_option', 'manual', wcj_get_option( 'wcj_price_by_country_auto_exchange_rates', 'manual' ) ) ) {
137
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i++ ) {
138
+ $currency_to = wcj_get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $i );
139
  $currencies[] = $currency_to;
140
  }
141
  }
142
  }
143
  if ( wcj_is_module_enabled( 'multicurrency' ) ) {
144
  // Currency Pairs - Multicurrency
145
+ if ( 'manual' != apply_filters( 'booster_option', 'manual', wcj_get_option( 'wcj_multicurrency_exchange_rate_update_auto', 'manual' ) ) ) {
146
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 2, wcj_get_option( 'wcj_multicurrency_total_number', 2 ) ); $i++ ) {
147
+ $currency_to = wcj_get_option( 'wcj_multicurrency_currency_' . $i );
148
  $currencies[] = $currency_to;
149
  }
150
  }
151
  }
152
  if ( wcj_is_module_enabled( 'multicurrency_base_price' ) ) {
153
  // Currency Pairs - Multicurrency Product Base Price
154
+ if ( 'manual' != apply_filters( 'booster_option', 'manual', wcj_get_option( 'wcj_multicurrency_base_price_exchange_rate_update', 'manual' ) ) ) {
155
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_multicurrency_base_price_total_number', 1 ) ); $i++ ) {
156
+ $currency_to = wcj_get_option( 'wcj_multicurrency_base_price_currency_' . $i );
157
  $currencies[] = $currency_to;
158
  }
159
  }
160
  }
161
  if ( wcj_is_module_enabled( 'currency_per_product' ) ) {
162
  // Currency Pairs - Currency per Product
163
+ if ( 'manual' != apply_filters( 'booster_option', 'manual', wcj_get_option( 'wcj_currency_per_product_exchange_rate_update', 'manual' ) ) ) {
164
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_currency_per_product_total_number', 1 ) ); $i++ ) {
165
+ $currency_to = wcj_get_option( 'wcj_currency_per_product_currency_' . $i );
166
  $currencies[] = $currency_to;
167
  }
168
  }
169
  }
170
  if ( wcj_is_module_enabled( 'payment_gateways_currency' ) ) {
171
+ if ( 'manual' != apply_filters( 'booster_option', 'manual', wcj_get_option( 'wcj_gateways_currency_exchange_rate_update_auto', 'manual' ) ) ) {
172
  // Currency Pairs - Gateway Currency
173
  global $woocommerce;
174
  $available_gateways = $woocommerce->payment_gateways->payment_gateways();
175
  foreach ( $available_gateways as $key => $gateway ) {
176
+ $currency_to = wcj_get_option( 'wcj_gateways_currency_' . $key );
177
  if ( 'no_changes' != $currency_to ) {
178
  $currencies[] = $currency_to;
179
  }
257
  if ( $add_extra_settings ) {
258
  // Server
259
  $exchange_rate_servers = wcj_get_currency_exchange_rate_servers();
260
+ $exchange_rate_server = wcj_get_option( 'wcj_currency_exchange_rates_server', 'ecb' );
261
  $default_server = ( isset( $exchange_rate_servers[ $exchange_rate_server ] ) ? $exchange_rate_servers[ $exchange_rate_server ] : $exchange_rate_server );
262
  // Offset
263
+ $default_offset = wcj_get_option( 'wcj_currency_exchange_rates_offset_percent', 0 );
264
  }
265
  $settings = array();
266
+ $currency_from = wcj_get_option( 'woocommerce_currency' );
267
  $currencies = $this->get_all_currencies_exchange_rates_currencies();
268
  foreach ( $currencies as $currency ) {
269
  $settings = $this->add_currency_pair_setting( $currency_from, $currency, $settings );
includes/class-wcj-currency-external-products.php CHANGED
@@ -26,7 +26,7 @@ class WCJ_Currency_External_Products extends WCJ_Module {
26
  parent::__construct();
27
 
28
  if ( $this->is_enabled() ) {
29
- if ( '' != get_option( 'wcj_currency_external_products_symbol', 'EUR' ) ) {
30
  add_filter( 'woocommerce_currency', array( $this, 'change_currency_code' ), PHP_INT_MAX, 1 );
31
  }
32
  }
@@ -41,7 +41,7 @@ class WCJ_Currency_External_Products extends WCJ_Module {
41
  function change_currency_code( $currency ) {
42
  global $product;
43
  if ( is_object( $product ) && $product->is_type( 'external' ) ) {
44
- return get_option( 'wcj_currency_external_products_symbol', 'EUR' );
45
  }
46
  return $currency;
47
  }
26
  parent::__construct();
27
 
28
  if ( $this->is_enabled() ) {
29
+ if ( '' != wcj_get_option( 'wcj_currency_external_products_symbol', 'EUR' ) ) {
30
  add_filter( 'woocommerce_currency', array( $this, 'change_currency_code' ), PHP_INT_MAX, 1 );
31
  }
32
  }
41
  function change_currency_code( $currency ) {
42
  global $product;
43
  if ( is_object( $product ) && $product->is_type( 'external' ) ) {
44
+ return wcj_get_option( 'wcj_currency_external_products_symbol', 'EUR' );
45
  }
46
  return $currency;
47
  }
includes/class-wcj-currency-per-product.php CHANGED
@@ -31,9 +31,9 @@ class WCJ_Currency_Per_Product extends WCJ_Module {
31
 
32
  if ( $this->is_enabled() ) {
33
 
34
- $this->do_save_converted_prices = ( 'yes' === get_option( 'wcj_currency_per_product_save_prices', 'no' ) );
35
 
36
- $this->is_currency_per_product_by_product_enabled = ( 'yes' === get_option( 'wcj_currency_per_product_per_product', 'yes' ) );
37
  if ( $this->is_currency_per_product_by_product_enabled ) {
38
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
39
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
@@ -72,13 +72,13 @@ class WCJ_Currency_Per_Product extends WCJ_Module {
72
  if ( WC()->cart->is_empty() ) {
73
  return $package_rates;
74
  }
75
- $cart_checkout_behaviour = get_option( 'wcj_currency_per_product_cart_checkout', 'convert_shop_default' );
76
  switch ( $cart_checkout_behaviour ) {
77
  case 'leave_one_product':
78
  case 'leave_same_currency':
79
  case 'convert_first_product':
80
  case 'convert_last_product':
81
- $shop_currency = get_option( 'woocommerce_currency' );
82
  if ( false != ( $_currency = $this->get_cart_checkout_currency() ) && $_currency != $shop_currency ) {
83
  $currency_exchange_rate = $this->get_currency_exchange_rate( $_currency );
84
  if ( 0 != $currency_exchange_rate && 1 != $currency_exchange_rate ) {
@@ -102,14 +102,14 @@ class WCJ_Currency_Per_Product extends WCJ_Module {
102
  *
103
  * @version 3.7.0
104
  * @since 2.9.0
105
- * @todo (maybe) return empty string or false, if it's shop default currency: `return ( get_option( 'woocommerce_currency' ) != ( $return = get_post_meta( $product_id, '_' . 'wcj_currency_per_product_currency', true ) ) ? $return : false );`
106
  */
107
  function get_product_currency( $product_id ) {
108
  // By users or user roles
109
- $do_check_by_users = ( 'yes' === get_option( 'wcj_currency_per_product_by_users_enabled', 'no' ) );
110
- $do_check_by_user_roles = ( 'yes' === get_option( 'wcj_currency_per_product_by_user_roles_enabled', 'no' ) );
111
- $do_check_by_product_cats = ( 'yes' === get_option( 'wcj_currency_per_product_by_product_cats_enabled', 'no' ) );
112
- $do_check_by_product_tags = ( 'yes' === get_option( 'wcj_currency_per_product_by_product_tags_enabled', 'no' ) );
113
  if ( $do_check_by_users || $do_check_by_user_roles || $do_check_by_product_cats || $do_check_by_product_tags ) {
114
  if ( $do_check_by_users || $do_check_by_user_roles ) {
115
  $product_author_id = get_post_field( 'post_author', $product_id );
@@ -120,35 +120,35 @@ class WCJ_Currency_Per_Product extends WCJ_Module {
120
  if ( $do_check_by_product_tags ) {
121
  $_product_tags = wcj_get_the_terms( $product_id, 'product_tag' );
122
  }
123
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_currency_per_product_total_number', 1 ) );
124
  for ( $i = 1; $i <= $total_number; $i++ ) {
125
  if ( $do_check_by_users ) {
126
- $users = get_option( 'wcj_currency_per_product_users_' . $i, '' );
127
  if ( ! empty( $users ) && in_array( $product_author_id, $users ) ) {
128
- return get_option( 'wcj_currency_per_product_currency_' . $i );
129
  }
130
  }
131
  if ( $do_check_by_user_roles ) {
132
- $user_roles = get_option( 'wcj_currency_per_product_user_roles_' . $i, '' );
133
  if ( ! empty( $user_roles ) && wcj_is_user_role( $user_roles, $product_author_id ) ) {
134
- return get_option( 'wcj_currency_per_product_currency_' . $i );
135
  }
136
  }
137
  if ( $do_check_by_product_cats ) {
138
- $product_cats = get_option( 'wcj_currency_per_product_product_cats_' . $i, '' );
139
  if ( ! empty( $_product_cats ) && ! empty( $product_cats ) ) {
140
  $_intersect = array_intersect( $_product_cats, $product_cats );
141
  if ( ! empty( $_intersect ) ) {
142
- return get_option( 'wcj_currency_per_product_currency_' . $i );
143
  }
144
  }
145
  }
146
  if ( $do_check_by_product_tags ) {
147
- $product_tags = get_option( 'wcj_currency_per_product_product_tags_' . $i, '' );
148
  if ( ! empty( $_product_tags ) && ! empty( $product_tags ) ) {
149
  $_intersect = array_intersect( $_product_tags, $product_tags );
150
  if ( ! empty( $_intersect ) ) {
151
- return get_option( 'wcj_currency_per_product_currency_' . $i );
152
  }
153
  }
154
  }
@@ -165,17 +165,17 @@ class WCJ_Currency_Per_Product extends WCJ_Module {
165
  * @since 2.7.0
166
  */
167
  function validate_on_add_to_cart( $passed, $product_id ) {
168
- $cart_checkout_behaviour = get_option( 'wcj_currency_per_product_cart_checkout', 'convert_shop_default' );
169
  if ( 'leave_one_product' === $cart_checkout_behaviour ) {
170
  foreach ( WC()->cart->get_cart() as $cart_item ) {
171
  if ( $cart_item['product_id'] != $product_id ) {
172
- wc_add_notice( get_option( 'wcj_currency_per_product_cart_checkout_leave_one_product',
173
  __( 'Only one product can be added to the cart. Clear the cart or finish the order, before adding another product to the cart.', 'woocommerce-jetpack' ) ), 'error' );
174
  return false;
175
  }
176
  }
177
  } elseif ( 'leave_same_currency' === $cart_checkout_behaviour ) {
178
- $shop_currency = get_option( 'woocommerce_currency' );
179
  $product_currency = $this->get_product_currency( $product_id );
180
  if ( '' == $product_currency ) {
181
  $product_currency = $shop_currency;
@@ -184,7 +184,7 @@ class WCJ_Currency_Per_Product extends WCJ_Module {
184
  $cart_product_currency = ( isset( $cart_item['wcj_currency_per_product'] ) && '' != $cart_item['wcj_currency_per_product'] ) ?
185
  $cart_item['wcj_currency_per_product'] : $shop_currency;
186
  if ( $cart_product_currency != $product_currency ) {
187
- wc_add_notice( get_option( 'wcj_currency_per_product_cart_checkout_leave_same_currency',
188
  __( 'Only products with same currency can be added to the cart. Clear the cart or finish the order, before adding products with another currency to the cart.', 'woocommerce-jetpack' ) ), 'error' );
189
  return false;
190
  }
@@ -240,10 +240,10 @@ class WCJ_Currency_Per_Product extends WCJ_Module {
240
  * @since 2.5.2
241
  */
242
  function get_currency_exchange_rate( $currency_code ) {
243
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_currency_per_product_total_number', 1 ) );
244
  for ( $i = 1; $i <= $total_number; $i++ ) {
245
- if ( $currency_code === get_option( 'wcj_currency_per_product_currency_' . $i ) ) {
246
- return ( 0 != ( $rate = get_option( 'wcj_currency_per_product_exchange_rate_' . $i, 1 ) ) ? ( 1 / $rate ) : 1 );
247
  }
248
  }
249
  return 1;
@@ -287,14 +287,14 @@ class WCJ_Currency_Per_Product extends WCJ_Module {
287
  */
288
  function change_price( $price, $_product ) {
289
  if ( isset( $_product->wcj_currency_per_product ) ) {
290
- $cart_checkout_behaviour = get_option( 'wcj_currency_per_product_cart_checkout', 'convert_shop_default' );
291
  switch ( $cart_checkout_behaviour ) {
292
  case 'leave_one_product':
293
  case 'leave_same_currency':
294
  return $price;
295
  case 'convert_first_product':
296
  case 'convert_last_product':
297
- $shop_currency = get_option( 'woocommerce_currency' );
298
  if ( false != ( $_currency = $this->get_cart_checkout_currency() ) && $_currency != $shop_currency ) {
299
  if ( $_product->wcj_currency_per_product === $_currency ) {
300
  return $price;
@@ -317,7 +317,7 @@ class WCJ_Currency_Per_Product extends WCJ_Module {
317
  return $this->maybe_save_converted_price( $price * $exchange_rate, $_product, $shop_currency );
318
  }
319
  default: // case 'convert_shop_default':
320
- $shop_currency = get_option( 'woocommerce_currency' );
321
  if ( false !== ( $saved_price = $this->maybe_return_saved_converted_price( $_product, $shop_currency ) ) ) {
322
  return $saved_price;
323
  }
@@ -417,7 +417,7 @@ class WCJ_Currency_Per_Product extends WCJ_Module {
417
  * @since 2.7.0
418
  */
419
  function get_cart_checkout_currency() {
420
- $cart_checkout_behaviour = get_option( 'wcj_currency_per_product_cart_checkout', 'convert_shop_default' );
421
  if ( false !== ( $value = apply_filters( 'wcj_currency_per_product_cart_checkout_currency', false, $cart_checkout_behaviour ) ) ) {
422
  return $value;
423
  }
31
 
32
  if ( $this->is_enabled() ) {
33
 
34
+ $this->do_save_converted_prices = ( 'yes' === wcj_get_option( 'wcj_currency_per_product_save_prices', 'no' ) );
35
 
36
+ $this->is_currency_per_product_by_product_enabled = ( 'yes' === wcj_get_option( 'wcj_currency_per_product_per_product', 'yes' ) );
37
  if ( $this->is_currency_per_product_by_product_enabled ) {
38
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
39
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
72
  if ( WC()->cart->is_empty() ) {
73
  return $package_rates;
74
  }
75
+ $cart_checkout_behaviour = wcj_get_option( 'wcj_currency_per_product_cart_checkout', 'convert_shop_default' );
76
  switch ( $cart_checkout_behaviour ) {
77
  case 'leave_one_product':
78
  case 'leave_same_currency':
79
  case 'convert_first_product':
80
  case 'convert_last_product':
81
+ $shop_currency = wcj_get_option( 'woocommerce_currency' );
82
  if ( false != ( $_currency = $this->get_cart_checkout_currency() ) && $_currency != $shop_currency ) {
83
  $currency_exchange_rate = $this->get_currency_exchange_rate( $_currency );
84
  if ( 0 != $currency_exchange_rate && 1 != $currency_exchange_rate ) {
102
  *
103
  * @version 3.7.0
104
  * @since 2.9.0
105
+ * @todo (maybe) return empty string or false, if it's shop default currency: `return ( wcj_get_option( 'woocommerce_currency' ) != ( $return = get_post_meta( $product_id, '_' . 'wcj_currency_per_product_currency', true ) ) ? $return : false );`
106
  */
107
  function get_product_currency( $product_id ) {
108
  // By users or user roles
109
+ $do_check_by_users = ( 'yes' === wcj_get_option( 'wcj_currency_per_product_by_users_enabled', 'no' ) );
110
+ $do_check_by_user_roles = ( 'yes' === wcj_get_option( 'wcj_currency_per_product_by_user_roles_enabled', 'no' ) );
111
+ $do_check_by_product_cats = ( 'yes' === wcj_get_option( 'wcj_currency_per_product_by_product_cats_enabled', 'no' ) );
112
+ $do_check_by_product_tags = ( 'yes' === wcj_get_option( 'wcj_currency_per_product_by_product_tags_enabled', 'no' ) );
113
  if ( $do_check_by_users || $do_check_by_user_roles || $do_check_by_product_cats || $do_check_by_product_tags ) {
114
  if ( $do_check_by_users || $do_check_by_user_roles ) {
115
  $product_author_id = get_post_field( 'post_author', $product_id );
120
  if ( $do_check_by_product_tags ) {
121
  $_product_tags = wcj_get_the_terms( $product_id, 'product_tag' );
122
  }
123
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_currency_per_product_total_number', 1 ) );
124
  for ( $i = 1; $i <= $total_number; $i++ ) {
125
  if ( $do_check_by_users ) {
126
+ $users = wcj_get_option( 'wcj_currency_per_product_users_' . $i, '' );
127
  if ( ! empty( $users ) && in_array( $product_author_id, $users ) ) {
128
+ return wcj_get_option( 'wcj_currency_per_product_currency_' . $i );
129
  }
130
  }
131
  if ( $do_check_by_user_roles ) {
132
+ $user_roles = wcj_get_option( 'wcj_currency_per_product_user_roles_' . $i, '' );
133
  if ( ! empty( $user_roles ) && wcj_is_user_role( $user_roles, $product_author_id ) ) {
134
+ return wcj_get_option( 'wcj_currency_per_product_currency_' . $i );
135
  }
136
  }
137
  if ( $do_check_by_product_cats ) {
138
+ $product_cats = wcj_get_option( 'wcj_currency_per_product_product_cats_' . $i, '' );
139
  if ( ! empty( $_product_cats ) && ! empty( $product_cats ) ) {
140
  $_intersect = array_intersect( $_product_cats, $product_cats );
141
  if ( ! empty( $_intersect ) ) {
142
+ return wcj_get_option( 'wcj_currency_per_product_currency_' . $i );
143
  }
144
  }
145
  }
146
  if ( $do_check_by_product_tags ) {
147
+ $product_tags = wcj_get_option( 'wcj_currency_per_product_product_tags_' . $i, '' );
148
  if ( ! empty( $_product_tags ) && ! empty( $product_tags ) ) {
149
  $_intersect = array_intersect( $_product_tags, $product_tags );
150
  if ( ! empty( $_intersect ) ) {
151
+ return wcj_get_option( 'wcj_currency_per_product_currency_' . $i );
152
  }
153
  }
154
  }
165
  * @since 2.7.0
166
  */
167
  function validate_on_add_to_cart( $passed, $product_id ) {
168
+ $cart_checkout_behaviour = wcj_get_option( 'wcj_currency_per_product_cart_checkout', 'convert_shop_default' );
169
  if ( 'leave_one_product' === $cart_checkout_behaviour ) {
170
  foreach ( WC()->cart->get_cart() as $cart_item ) {
171
  if ( $cart_item['product_id'] != $product_id ) {
172
+ wc_add_notice( wcj_get_option( 'wcj_currency_per_product_cart_checkout_leave_one_product',
173
  __( 'Only one product can be added to the cart. Clear the cart or finish the order, before adding another product to the cart.', 'woocommerce-jetpack' ) ), 'error' );
174
  return false;
175
  }
176
  }
177
  } elseif ( 'leave_same_currency' === $cart_checkout_behaviour ) {
178
+ $shop_currency = wcj_get_option( 'woocommerce_currency' );
179
  $product_currency = $this->get_product_currency( $product_id );
180
  if ( '' == $product_currency ) {
181
  $product_currency = $shop_currency;
184
  $cart_product_currency = ( isset( $cart_item['wcj_currency_per_product'] ) && '' != $cart_item['wcj_currency_per_product'] ) ?
185
  $cart_item['wcj_currency_per_product'] : $shop_currency;
186
  if ( $cart_product_currency != $product_currency ) {
187
+ wc_add_notice( wcj_get_option( 'wcj_currency_per_product_cart_checkout_leave_same_currency',
188
  __( 'Only products with same currency can be added to the cart. Clear the cart or finish the order, before adding products with another currency to the cart.', 'woocommerce-jetpack' ) ), 'error' );
189
  return false;
190
  }
240
  * @since 2.5.2
241
  */
242
  function get_currency_exchange_rate( $currency_code ) {
243
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_currency_per_product_total_number', 1 ) );
244
  for ( $i = 1; $i <= $total_number; $i++ ) {
245
+ if ( $currency_code === wcj_get_option( 'wcj_currency_per_product_currency_' . $i ) ) {
246
+ return ( 0 != ( $rate = wcj_get_option( 'wcj_currency_per_product_exchange_rate_' . $i, 1 ) ) ? ( 1 / $rate ) : 1 );
247
  }
248
  }
249
  return 1;
287
  */
288
  function change_price( $price, $_product ) {
289
  if ( isset( $_product->wcj_currency_per_product ) ) {
290
+ $cart_checkout_behaviour = wcj_get_option( 'wcj_currency_per_product_cart_checkout', 'convert_shop_default' );
291
  switch ( $cart_checkout_behaviour ) {
292
  case 'leave_one_product':
293
  case 'leave_same_currency':
294
  return $price;
295
  case 'convert_first_product':
296
  case 'convert_last_product':
297
+ $shop_currency = wcj_get_option( 'woocommerce_currency' );
298
  if ( false != ( $_currency = $this->get_cart_checkout_currency() ) && $_currency != $shop_currency ) {
299
  if ( $_product->wcj_currency_per_product === $_currency ) {
300
  return $price;
317
  return $this->maybe_save_converted_price( $price * $exchange_rate, $_product, $shop_currency );
318
  }
319
  default: // case 'convert_shop_default':
320
+ $shop_currency = wcj_get_option( 'woocommerce_currency' );
321
  if ( false !== ( $saved_price = $this->maybe_return_saved_converted_price( $_product, $shop_currency ) ) ) {
322
  return $saved_price;
323
  }
417
  * @since 2.7.0
418
  */
419
  function get_cart_checkout_currency() {
420
+ $cart_checkout_behaviour = wcj_get_option( 'wcj_currency_per_product_cart_checkout', 'convert_shop_default' );
421
  if ( false !== ( $value = apply_filters( 'wcj_currency_per_product_cart_checkout_currency', false, $cart_checkout_behaviour ) ) ) {
422
  return $value;
423
  }
includes/class-wcj-currency.php CHANGED
@@ -45,9 +45,9 @@ class WCJ_Currencies extends WCJ_Module {
45
  */
46
  function get_custom_currencies() {
47
  $custom_currencies = array();
48
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_currency_custom_currency_total_number', 1 ) ); $i++ ) {
49
- $custom_currency_code = get_option( 'wcj_currency_custom_currency_code_' . $i, '' );
50
- $custom_currency_name = get_option( 'wcj_currency_custom_currency_name_' . $i, '' );
51
  if ( '' != $custom_currency_code && '' != $custom_currency_name ) {
52
  $custom_currencies[ $custom_currency_code ] = $custom_currency_name;
53
  }
@@ -126,7 +126,7 @@ class WCJ_Currencies extends WCJ_Module {
126
  * @since 3.9.0
127
  */
128
  function get_saved_currency_symbol( $currency, $default_symbol ) {
129
- if ( false === ( $saved_currency_symbol = get_option( 'wcj_currency_' . $currency, false ) ) ) {
130
  return ( in_array( $currency, array_keys( $this->get_additional_currencies() ) ) ? $this->get_additional_currency_symbol( $currency ) : $default_symbol );
131
  } else {
132
  return $saved_currency_symbol;
@@ -144,15 +144,15 @@ class WCJ_Currencies extends WCJ_Module {
144
  return $this->saved_symbol[ $currency ];
145
  }
146
  // Maybe hide symbol
147
- if ( 'yes' === get_option( 'wcj_currency_hide_symbol', 'no' ) ) {
148
  return '';
149
  }
150
  // Custom currencies
151
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_currency_custom_currency_total_number', 1 ) ); $i++ ) {
152
- $custom_currency_code = get_option( 'wcj_currency_custom_currency_code_' . $i, '' );
153
- $custom_currency_name = get_option( 'wcj_currency_custom_currency_name_' . $i, '' );
154
  if ( '' != $custom_currency_code && '' != $custom_currency_name && $currency === $custom_currency_code ) {
155
- $this->saved_symbol[ $currency ] = do_shortcode( get_option( 'wcj_currency_custom_currency_symbol_' . $i, '' ) );
156
  return $this->saved_symbol[ $currency ];
157
  }
158
  }
45
  */
46
  function get_custom_currencies() {
47
  $custom_currencies = array();
48
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_currency_custom_currency_total_number', 1 ) ); $i++ ) {
49
+ $custom_currency_code = wcj_get_option( 'wcj_currency_custom_currency_code_' . $i, '' );
50
+ $custom_currency_name = wcj_get_option( 'wcj_currency_custom_currency_name_' . $i, '' );
51
  if ( '' != $custom_currency_code && '' != $custom_currency_name ) {
52
  $custom_currencies[ $custom_currency_code ] = $custom_currency_name;
53
  }
126
  * @since 3.9.0
127
  */
128
  function get_saved_currency_symbol( $currency, $default_symbol ) {
129
+ if ( false === ( $saved_currency_symbol = wcj_get_option( 'wcj_currency_' . $currency, false ) ) ) {
130
  return ( in_array( $currency, array_keys( $this->get_additional_currencies() ) ) ? $this->get_additional_currency_symbol( $currency ) : $default_symbol );
131
  } else {
132
  return $saved_currency_symbol;
144
  return $this->saved_symbol[ $currency ];
145
  }
146
  // Maybe hide symbol
147
+ if ( 'yes' === wcj_get_option( 'wcj_currency_hide_symbol', 'no' ) ) {
148
  return '';
149
  }
150
  // Custom currencies
151
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_currency_custom_currency_total_number', 1 ) ); $i++ ) {
152
+ $custom_currency_code = wcj_get_option( 'wcj_currency_custom_currency_code_' . $i, '' );
153
+ $custom_currency_name = wcj_get_option( 'wcj_currency_custom_currency_name_' . $i, '' );
154
  if ( '' != $custom_currency_code && '' != $custom_currency_name && $currency === $custom_currency_code ) {
155
+ $this->saved_symbol[ $currency ] = do_shortcode( wcj_get_option( 'wcj_currency_custom_currency_symbol_' . $i, '' ) );
156
  return $this->saved_symbol[ $currency ];
157
  }
158
  }
includes/class-wcj-custom-css.php CHANGED
@@ -32,16 +32,16 @@ class WCJ_Custom_CSS extends WCJ_Module {
32
 
33
  if ( $this->is_enabled() ) {
34
  // Frontend
35
- if ( '' != get_option( 'wcj_general_custom_css', '' ) ) {
36
- add_action( 'wp_' . get_option( 'wcj_custom_css_hook', 'head' ), array( $this, 'hook_custom_css' ) );
37
  }
38
  // Admin
39
- if ( '' != get_option( 'wcj_general_custom_admin_css', '' ) ) {
40
- add_action( 'admin_' . get_option( 'wcj_custom_css_hook', 'head' ), array( $this, 'hook_custom_admin_css' ) );
41
  }
42
  // Per product
43
- if ( 'yes' === get_option( 'wcj_custom_css_per_product', 'no' ) ) {
44
- add_action( 'wp_' . get_option( 'wcj_custom_css_hook', 'head' ), array( $this, 'maybe_add_per_product_css' ) );
45
  // Settings
46
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
47
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
@@ -71,7 +71,7 @@ class WCJ_Custom_CSS extends WCJ_Module {
71
  * @since 2.7.0
72
  */
73
  function hook_custom_css() {
74
- echo '<style>' . get_option( 'wcj_general_custom_css', '' ) . '</style>';
75
  }
76
 
77
  /**
@@ -81,7 +81,7 @@ class WCJ_Custom_CSS extends WCJ_Module {
81
  * @since 2.7.0
82
  */
83
  function hook_custom_admin_css() {
84
- echo '<style>' . get_option( 'wcj_general_custom_admin_css', '' ) . '</style>';
85
  }
86
 
87
  }
32
 
33
  if ( $this->is_enabled() ) {
34
  // Frontend
35
+ if ( '' != wcj_get_option( 'wcj_general_custom_css', '' ) ) {
36
+ add_action( 'wp_' . wcj_get_option( 'wcj_custom_css_hook', 'head' ), array( $this, 'hook_custom_css' ) );
37
  }
38
  // Admin
39
+ if ( '' != wcj_get_option( 'wcj_general_custom_admin_css', '' ) ) {
40
+ add_action( 'admin_' . wcj_get_option( 'wcj_custom_css_hook', 'head' ), array( $this, 'hook_custom_admin_css' ) );
41
  }
42
  // Per product
43
+ if ( 'yes' === wcj_get_option( 'wcj_custom_css_per_product', 'no' ) ) {
44
+ add_action( 'wp_' . wcj_get_option( 'wcj_custom_css_hook', 'head' ), array( $this, 'maybe_add_per_product_css' ) );
45
  // Settings
46
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
47
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
71
  * @since 2.7.0
72
  */
73
  function hook_custom_css() {
74
+ echo '<style>' . wcj_get_option( 'wcj_general_custom_css', '' ) . '</style>';
75
  }
76
 
77
  /**
81
  * @since 2.7.0
82
  */
83
  function hook_custom_admin_css() {
84
+ echo '<style>' . wcj_get_option( 'wcj_general_custom_admin_css', '' ) . '</style>';
85
  }
86
 
87
  }
includes/class-wcj-custom-js.php CHANGED
@@ -30,11 +30,11 @@ class WCJ_Custom_JS extends WCJ_Module {
30
  parent::__construct();
31
 
32
  if ( $this->is_enabled() ) {
33
- if ( '' != get_option( 'wcj_custom_js_frontend', '' ) ) {
34
- add_action( 'wp_' . get_option( 'wcj_custom_js_hook', 'head' ), array( $this, 'custom_frontend_js' ) );
35
  }
36
- if ( '' != get_option( 'wcj_custom_js_backend', '' ) ) {
37
- add_action( 'admin_' . get_option( 'wcj_custom_js_hook', 'head' ), array( $this, 'custom_backend_js' ) );
38
  }
39
  }
40
  }
@@ -46,7 +46,7 @@ class WCJ_Custom_JS extends WCJ_Module {
46
  * @since 2.8.0
47
  */
48
  function custom_frontend_js() {
49
- echo '<script>' . do_shortcode( get_option( 'wcj_custom_js_frontend', '' ) ) . '</script>';
50
  }
51
 
52
  /**
@@ -56,7 +56,7 @@ class WCJ_Custom_JS extends WCJ_Module {
56
  * @since 2.8.0
57
  */
58
  function custom_backend_js() {
59
- echo '<script>' . do_shortcode( get_option( 'wcj_custom_js_backend', '' ) ) . '</script>';
60
  }
61
 
62
  }
30
  parent::__construct();
31
 
32
  if ( $this->is_enabled() ) {
33
+ if ( '' != wcj_get_option( 'wcj_custom_js_frontend', '' ) ) {
34
+ add_action( 'wp_' . wcj_get_option( 'wcj_custom_js_hook', 'head' ), array( $this, 'custom_frontend_js' ) );
35
  }
36
+ if ( '' != wcj_get_option( 'wcj_custom_js_backend', '' ) ) {
37
+ add_action( 'admin_' . wcj_get_option( 'wcj_custom_js_hook', 'head' ), array( $this, 'custom_backend_js' ) );
38
  }
39
  }
40
  }
46
  * @since 2.8.0
47
  */
48
  function custom_frontend_js() {
49
+ echo '<script>' . do_shortcode( wcj_get_option( 'wcj_custom_js_frontend', '' ) ) . '</script>';
50
  }
51
 
52
  /**
56
  * @since 2.8.0
57
  */
58
  function custom_backend_js() {
59
+ echo '<script>' . do_shortcode( wcj_get_option( 'wcj_custom_js_backend', '' ) ) . '</script>';
60
  }
61
 
62
  }
includes/class-wcj-custom-php.php CHANGED
@@ -70,7 +70,7 @@ class WCJ_Custom_PHP extends WCJ_Module {
70
  */
71
  function create_php_file( $sections, $current_section ) {
72
  if ( $this->id === $current_section ) {
73
- $file_content = get_option( 'wcj_custom_php', '' );
74
  if ( '' !== $file_content ) {
75
  $file_path = wcj_get_wcj_uploads_dir( 'custom_php' ) . DIRECTORY_SEPARATOR . 'booster.php';
76
  file_put_contents( $file_path, '<?php' . PHP_EOL . $file_content );
70
  */
71
  function create_php_file( $sections, $current_section ) {
72
  if ( $this->id === $current_section ) {
73
+ $file_content = wcj_get_option( 'wcj_custom_php', '' );
74
  if ( '' !== $file_content ) {
75
  $file_path = wcj_get_wcj_uploads_dir( 'custom_php' ) . DIRECTORY_SEPARATOR . 'booster.php';
76
  file_put_contents( $file_path, '<?php' . PHP_EOL . $file_content );
includes/class-wcj-debug-tools.php CHANGED
@@ -56,7 +56,7 @@ class WCJ_Debug_Tools extends WCJ_Module {
56
  // Log
57
  $the_log = '';
58
  $the_log .= '<p style="font-style:italic;color:gray;">' . sprintf( __( 'Now: %s', 'woocommerce-jetpack' ), date( 'Y-m-d H:i:s' ) ) . '</p>';
59
- if ( '' != ( $log = get_option( 'wcj_log', '' ) ) ) {
60
  $the_log .= '<pre style="color:green;background-color:black;padding:5px;">' . $log . '</pre>';
61
  } else {
62
  $the_log .= '<p style="font-style:italic;color:gray;">' . __( 'Log is empty.', 'woocommerce-jetpack' ) . '</p>';
56
  // Log
57
  $the_log = '';
58
  $the_log .= '<p style="font-style:italic;color:gray;">' . sprintf( __( 'Now: %s', 'woocommerce-jetpack' ), date( 'Y-m-d H:i:s' ) ) . '</p>';
59
+ if ( '' != ( $log = wcj_get_option( 'wcj_log', '' ) ) ) {
60
  $the_log .= '<pre style="color:green;background-color:black;padding:5px;">' . $log . '</pre>';
61
  } else {
62
  $the_log .= '<p style="font-style:italic;color:gray;">' . __( 'Log is empty.', 'woocommerce-jetpack' ) . '</p>';
includes/class-wcj-email-options.php CHANGED
@@ -30,14 +30,14 @@ class WCJ_Email_Options extends WCJ_Module {
30
 
31
  if ( $this->is_enabled() ) {
32
  // Email Forwarding
33
- if ( '' != get_option( 'wcj_emails_bcc_email', '' ) ) {
34
  add_filter( 'woocommerce_email_headers', array( $this, 'add_bcc_email' ), PHP_INT_MAX, 3 );
35
  }
36
- if ( '' != get_option( 'wcj_emails_cc_email', '' ) ) {
37
  add_filter( 'woocommerce_email_headers', array( $this, 'add_cc_email' ), PHP_INT_MAX, 3 );
38
  }
39
  // Product Info
40
- if ( 'yes' === get_option( 'wcj_product_info_in_email_order_item_name_enabled', 'no' ) ) {
41
  add_filter( 'woocommerce_order_item_name', array( $this, 'add_product_info_to_email_order_item_name' ), PHP_INT_MAX, 2 );
42
  }
43
  // Settings
@@ -57,7 +57,7 @@ class WCJ_Email_Options extends WCJ_Module {
57
  $product_id = ( ! empty( $item['variation_id'] ) ? $item['variation_id'] : $item['product_id'] );
58
  $post = get_post( $product_id );
59
  setup_postdata( $post );
60
- $item_name .= do_shortcode( get_option( 'wcj_product_info_in_email_order_item_name', '[wcj_product_categories strip_tags="yes" before="<hr><em>" after="</em>"]' ) );
61
  wp_reset_postdata();
62
  }
63
  return $item_name;
@@ -70,7 +70,7 @@ class WCJ_Email_Options extends WCJ_Module {
70
  * @since 3.5.0
71
  */
72
  function maybe_check_order_status( $_object ) {
73
- $enable_order_statuses = apply_filters( 'booster_option', '', get_option( 'wcj_emails_forwarding_enable_order_status', '' ) );
74
  if ( ! empty( $enable_order_statuses ) && isset( $_object ) && is_object( $_object ) && 'WC_Order' === get_class( $_object ) ) {
75
  if ( ! in_array( $_object->get_status(), $enable_order_statuses ) ) {
76
  return false;
@@ -85,7 +85,7 @@ class WCJ_Email_Options extends WCJ_Module {
85
  * @version 3.5.0
86
  */
87
  function add_bcc_email( $email_headers, $id, $_object ) {
88
- return ( $this->maybe_check_order_status( $_object ) ? $email_headers . "Bcc: " . get_option( 'wcj_emails_bcc_email', '' ) . "\r\n" : $email_headers );
89
  }
90
 
91
  /**
@@ -94,7 +94,7 @@ class WCJ_Email_Options extends WCJ_Module {
94
  * @version 3.5.0
95
  */
96
  function add_cc_email( $email_headers, $id, $_object ) {
97
- return ( $this->maybe_check_order_status( $_object ) ? $email_headers . "Cc: " . get_option( 'wcj_emails_cc_email', '' ) . "\r\n" : $email_headers );
98
  }
99
 
100
  /**
30
 
31
  if ( $this->is_enabled() ) {
32
  // Email Forwarding
33
+ if ( '' != wcj_get_option( 'wcj_emails_bcc_email', '' ) ) {
34
  add_filter( 'woocommerce_email_headers', array( $this, 'add_bcc_email' ), PHP_INT_MAX, 3 );
35
  }
36
+ if ( '' != wcj_get_option( 'wcj_emails_cc_email', '' ) ) {
37
  add_filter( 'woocommerce_email_headers', array( $this, 'add_cc_email' ), PHP_INT_MAX, 3 );
38
  }
39
  // Product Info
40
+ if ( 'yes' === wcj_get_option( 'wcj_product_info_in_email_order_item_name_enabled', 'no' ) ) {
41
  add_filter( 'woocommerce_order_item_name', array( $this, 'add_product_info_to_email_order_item_name' ), PHP_INT_MAX, 2 );
42
  }
43
  // Settings
57
  $product_id = ( ! empty( $item['variation_id'] ) ? $item['variation_id'] : $item['product_id'] );
58
  $post = get_post( $product_id );
59
  setup_postdata( $post );
60
+ $item_name .= do_shortcode( wcj_get_option( 'wcj_product_info_in_email_order_item_name', '[wcj_product_categories strip_tags="yes" before="<hr><em>" after="</em>"]' ) );
61
  wp_reset_postdata();
62
  }
63
  return $item_name;
70
  * @since 3.5.0
71
  */
72
  function maybe_check_order_status( $_object ) {
73
+ $enable_order_statuses = apply_filters( 'booster_option', '', wcj_get_option( 'wcj_emails_forwarding_enable_order_status', '' ) );
74
  if ( ! empty( $enable_order_statuses ) && isset( $_object ) && is_object( $_object ) && 'WC_Order' === get_class( $_object ) ) {
75
  if ( ! in_array( $_object->get_status(), $enable_order_statuses ) ) {
76
  return false;
85
  * @version 3.5.0
86
  */
87
  function add_bcc_email( $email_headers, $id, $_object ) {
88
+ return ( $this->maybe_check_order_status( $_object ) ? $email_headers . "Bcc: " . wcj_get_option( 'wcj_emails_bcc_email', '' ) . "\r\n" : $email_headers );
89
  }
90
 
91
  /**
94
  * @version 3.5.0
95
  */
96
  function add_cc_email( $email_headers, $id, $_object ) {
97
+ return ( $this->maybe_check_order_status( $_object ) ? $email_headers . "Cc: " . wcj_get_option( 'wcj_emails_cc_email', '' ) . "\r\n" : $email_headers );
98
  }
99
 
100
  /**
includes/class-wcj-emails-verification.php CHANGED
@@ -49,7 +49,7 @@ class WCJ_Email_Verification extends WCJ_Module {
49
  */
50
  function prevent_login() {
51
  if (
52
- 'yes' !== get_option( 'wcj_emails_verification_prevent_user_login', 'no' )
53
  || is_admin()
54
  || ! is_user_logged_in()
55
  || empty( $user = wp_get_current_user() ) ||
@@ -72,7 +72,7 @@ class WCJ_Email_Verification extends WCJ_Module {
72
  */
73
  function prevent_authenticate( $user ) {
74
  if (
75
- 'yes' !== get_option( 'wcj_emails_verification_prevent_user_login', 'no' )
76
  || is_wp_error( $user )
77
  || is_null( $user )
78
  || 0 == $user->ID
@@ -99,7 +99,7 @@ class WCJ_Email_Verification extends WCJ_Module {
99
  * @return bool
100
  */
101
  function woocommerce_registration_auth_new_customer( $allowed ) {
102
- if ( 'yes' !== get_option( 'wcj_emails_verification_prevent_user_login', 'no' ) ) {
103
  return $allowed;
104
  }
105
  $allowed = false;
@@ -154,18 +154,18 @@ class WCJ_Email_Verification extends WCJ_Module {
154
  */
155
  function check_if_user_email_is_verified( $userdata ) {
156
  if (
157
- ( 'yes' === get_option( 'wcj_emails_verification_already_registered_enabled', 'no' ) && ! get_user_meta( $userdata->ID, 'wcj_is_activated', true ) ) ||
158
- ( 'no' === get_option( 'wcj_emails_verification_already_registered_enabled', 'no' ) && '0' === get_user_meta( $userdata->ID, 'wcj_is_activated', true ) )
159
  ) {
160
  if ( isset( $userdata->roles ) && ! empty( $userdata->roles ) ) {
161
  $userdata_roles = wcj_get_array( $userdata->roles );
162
- $skip_user_roles = wcj_get_array( get_option( 'wcj_emails_verification_skip_user_roles', array( 'administrator' ) ) );
163
  $_intersect = array_intersect( $userdata_roles, $skip_user_roles );
164
  if ( ! empty( $_intersect ) ) {
165
  return $userdata;
166
  }
167
  }
168
- $error_message = do_shortcode( get_option( 'wcj_emails_verification_error_message',
169
  __( 'Your account has to be activated before you can login. You can resend email with verification link by clicking <a href="%resend_verification_url%">here</a>.', 'woocommerce-jetpack' )
170
  ) );
171
  $error_message = str_replace( '%resend_verification_url%', add_query_arg( 'wcj_user_id', $userdata->ID, wc_get_page_permalink( 'myaccount' ) ), $error_message );
@@ -196,7 +196,7 @@ class WCJ_Email_Verification extends WCJ_Module {
196
  __( 'Please activate your account', 'woocommerce-jetpack' ) ) ) );
197
  update_user_meta( $user_id, 'wcj_is_activated', '0' );
198
  update_user_meta( $user_id, 'wcj_activation_code', $code );
199
- if ( 'wc' === apply_filters( 'booster_option', 'plain', get_option( 'wcj_emails_verification_email_template', 'plain' ) ) ) {
200
  $email_content = wcj_wrap_in_wc_email_template( $email_content,
201
  get_option( 'wcj_emails_verification_email_template_wc_heading', __( 'Activate your account', 'woocommerce-jetpack' ) ) );
202
  }
@@ -214,7 +214,7 @@ class WCJ_Email_Verification extends WCJ_Module {
214
  if ( function_exists( 'wc_add_notice' ) ) {
215
  $data = json_decode( base64_decode( $_GET['wcj_verified_email'] ), true );
216
  if ( ! empty( $data['id'] ) && ! empty( $data['code'] ) && get_user_meta( $data['id'], 'wcj_activation_code', true ) == $data['code'] ) {
217
- wc_add_notice( do_shortcode( get_option( 'wcj_emails_verification_success_message',
218
  __( '<strong>Success:</strong> Your account has been activated!', 'woocommerce-jetpack' ) ) ) );
219
  }
220
  }
@@ -222,11 +222,11 @@ class WCJ_Email_Verification extends WCJ_Module {
222
  $data = json_decode( base64_decode( $_GET['wcj_verify_email'] ), true );
223
  if ( ! empty( $data['id'] ) && ! empty( $data['code'] ) && get_user_meta( $data['id'], 'wcj_activation_code', true ) == $data['code'] ) {
224
  update_user_meta( $data['id'], 'wcj_is_activated', '1' );
225
- if ( 'yes' === get_option( 'wcj_emails_verification_redirect_on_success', 'yes' ) ) {
226
  wp_set_current_user( $data['id'] );
227
  wp_set_auth_cookie( $data['id'] );
228
  }
229
- $url = ( '' != ( $custom_url = get_option( 'wcj_emails_verification_redirect_on_success_custom_url', '' ) ) ? $custom_url : wc_get_page_permalink( 'myaccount' ) );
230
  wp_safe_redirect( add_query_arg( 'wcj_verified_email', $_GET['wcj_verify_email'], $url ) );
231
  exit;
232
  } elseif ( ! empty( $data['id'] ) ) {
@@ -238,16 +238,16 @@ class WCJ_Email_Verification extends WCJ_Module {
238
  $_notice = str_replace( '%resend_verification_url%', add_query_arg( 'wcj_user_id', $data['id'], wc_get_page_permalink( 'myaccount' ) ), $_notice );
239
  wc_add_notice( $_notice, 'error' );
240
  } else {
241
- $_notice = get_option( 'wcj_emails_verification_failed_message_no_user_id',
242
  __( '<strong>Error:</strong> Activation failed, please contact our administrator.', 'woocommerce-jetpack' ) );
243
  wc_add_notice( $_notice, 'error' );
244
  }
245
  } elseif ( isset( $_GET['wcj_activate_account_message'] ) ) {
246
- wc_add_notice( do_shortcode( get_option( 'wcj_emails_verification_activation_message',
247
  __( 'Thank you for your registration. Your account has to be activated before you can login. Please check your email.', 'woocommerce-jetpack' ) ) ) );
248
  } elseif ( isset( $_GET['wcj_user_id'] ) ) {
249
  $this->reset_and_mail_activation_link( $_GET['wcj_user_id'] );
250
- wc_add_notice( do_shortcode( get_option( 'wcj_emails_verification_email_resend_message',
251
  __( '<strong>Success:</strong> Your activation email has been resent. Please check your email.', 'woocommerce-jetpack' ) ) ) );
252
  }
253
  }
49
  */
50
  function prevent_login() {
51
  if (
52
+ 'yes' !== wcj_get_option( 'wcj_emails_verification_prevent_user_login', 'no' )
53
  || is_admin()
54
  || ! is_user_logged_in()
55
  || empty( $user = wp_get_current_user() ) ||
72
  */
73
  function prevent_authenticate( $user ) {
74
  if (
75
+ 'yes' !== wcj_get_option( 'wcj_emails_verification_prevent_user_login', 'no' )
76
  || is_wp_error( $user )
77
  || is_null( $user )
78
  || 0 == $user->ID
99
  * @return bool
100
  */
101
  function woocommerce_registration_auth_new_customer( $allowed ) {
102
+ if ( 'yes' !== wcj_get_option( 'wcj_emails_verification_prevent_user_login', 'no' ) ) {
103
  return $allowed;
104
  }
105
  $allowed = false;
154
  */
155
  function check_if_user_email_is_verified( $userdata ) {
156
  if (
157
+ ( 'yes' === wcj_get_option( 'wcj_emails_verification_already_registered_enabled', 'no' ) && ! get_user_meta( $userdata->ID, 'wcj_is_activated', true ) ) ||
158
+ ( 'no' === wcj_get_option( 'wcj_emails_verification_already_registered_enabled', 'no' ) && '0' === get_user_meta( $userdata->ID, 'wcj_is_activated', true ) )
159
  ) {
160
  if ( isset( $userdata->roles ) && ! empty( $userdata->roles ) ) {
161
  $userdata_roles = wcj_get_array( $userdata->roles );
162
+ $skip_user_roles = wcj_get_array( wcj_get_option( 'wcj_emails_verification_skip_user_roles', array( 'administrator' ) ) );
163
  $_intersect = array_intersect( $userdata_roles, $skip_user_roles );
164
  if ( ! empty( $_intersect ) ) {
165
  return $userdata;
166
  }
167
  }
168
+ $error_message = do_shortcode( wcj_get_option( 'wcj_emails_verification_error_message',
169
  __( 'Your account has to be activated before you can login. You can resend email with verification link by clicking <a href="%resend_verification_url%">here</a>.', 'woocommerce-jetpack' )
170
  ) );
171
  $error_message = str_replace( '%resend_verification_url%', add_query_arg( 'wcj_user_id', $userdata->ID, wc_get_page_permalink( 'myaccount' ) ), $error_message );
196
  __( 'Please activate your account', 'woocommerce-jetpack' ) ) ) );
197
  update_user_meta( $user_id, 'wcj_is_activated', '0' );
198
  update_user_meta( $user_id, 'wcj_activation_code', $code );
199
+ if ( 'wc' === apply_filters( 'booster_option', 'plain', wcj_get_option( 'wcj_emails_verification_email_template', 'plain' ) ) ) {
200
  $email_content = wcj_wrap_in_wc_email_template( $email_content,
201
  get_option( 'wcj_emails_verification_email_template_wc_heading', __( 'Activate your account', 'woocommerce-jetpack' ) ) );
202
  }
214
  if ( function_exists( 'wc_add_notice' ) ) {
215
  $data = json_decode( base64_decode( $_GET['wcj_verified_email'] ), true );
216
  if ( ! empty( $data['id'] ) && ! empty( $data['code'] ) && get_user_meta( $data['id'], 'wcj_activation_code', true ) == $data['code'] ) {
217
+ wc_add_notice( do_shortcode( wcj_get_option( 'wcj_emails_verification_success_message',
218
  __( '<strong>Success:</strong> Your account has been activated!', 'woocommerce-jetpack' ) ) ) );
219
  }
220
  }
222
  $data = json_decode( base64_decode( $_GET['wcj_verify_email'] ), true );
223
  if ( ! empty( $data['id'] ) && ! empty( $data['code'] ) && get_user_meta( $data['id'], 'wcj_activation_code', true ) == $data['code'] ) {
224
  update_user_meta( $data['id'], 'wcj_is_activated', '1' );
225
+ if ( 'yes' === wcj_get_option( 'wcj_emails_verification_redirect_on_success', 'yes' ) ) {
226
  wp_set_current_user( $data['id'] );
227
  wp_set_auth_cookie( $data['id'] );
228
  }
229
+ $url = ( '' != ( $custom_url = wcj_get_option( 'wcj_emails_verification_redirect_on_success_custom_url', '' ) ) ? $custom_url : wc_get_page_permalink( 'myaccount' ) );
230
  wp_safe_redirect( add_query_arg( 'wcj_verified_email', $_GET['wcj_verify_email'], $url ) );
231
  exit;
232
  } elseif ( ! empty( $data['id'] ) ) {
238
  $_notice = str_replace( '%resend_verification_url%', add_query_arg( 'wcj_user_id', $data['id'], wc_get_page_permalink( 'myaccount' ) ), $_notice );
239
  wc_add_notice( $_notice, 'error' );
240
  } else {
241
+ $_notice = wcj_get_option( 'wcj_emails_verification_failed_message_no_user_id',
242
  __( '<strong>Error:</strong> Activation failed, please contact our administrator.', 'woocommerce-jetpack' ) );
243
  wc_add_notice( $_notice, 'error' );
244
  }
245
  } elseif ( isset( $_GET['wcj_activate_account_message'] ) ) {
246
+ wc_add_notice( do_shortcode( wcj_get_option( 'wcj_emails_verification_activation_message',
247
  __( 'Thank you for your registration. Your account has to be activated before you can login. Please check your email.', 'woocommerce-jetpack' ) ) ) );
248
  } elseif ( isset( $_GET['wcj_user_id'] ) ) {
249
  $this->reset_and_mail_activation_link( $_GET['wcj_user_id'] );
250
+ wc_add_notice( do_shortcode( wcj_get_option( 'wcj_emails_verification_email_resend_message',
251
  __( '<strong>Success:</strong> Your activation email has been resent. Please check your email.', 'woocommerce-jetpack' ) ) ) );
252
  }
253
  }
includes/class-wcj-emails.php CHANGED
@@ -32,7 +32,7 @@ class WCJ_Emails extends WCJ_Module {
32
  add_filter( 'woocommerce_resend_order_emails_available', array( $this, 'add_custom_emails_to_wc_resend_order_emails' ) );
33
  if ( ! WCJ_IS_WC_VERSION_BELOW_3_2_0 ) {
34
  add_filter( 'woocommerce_order_actions', array( $this, 'add_custom_emails_order_actions' ), PHP_INT_MAX, 1 );
35
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_emails_custom_emails_total_number', 1 ) ); $i++ ) {
36
  add_action( 'woocommerce_order_action_' . 'wcj_send_email_custom' . '_' . $i,
37
  array( $this, 'do_custom_emails_order_actions' ), PHP_INT_MAX, 1 );
38
  }
@@ -71,7 +71,7 @@ class WCJ_Emails extends WCJ_Module {
71
  * @todo (maybe) add "Add Custom Email(s) to Order Actions" option (in WC >= 3.2.0); same to `woocommerce_order_action_`
72
  */
73
  function add_custom_emails_order_actions( $actions ) {
74
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_emails_custom_emails_total_number', 1 ) ); $i++ ) {
75
  $actions[ 'wcj_send_email_custom' . '_' . $i ] = sprintf( apply_filters( 'wcj_emails_custom_emails_order_action_text',
76
  __( 'Booster: Send Email: %s', 'woocommerce-jetpack' ), $i ),
77
  get_option( 'wcj_emails_custom_emails_admin_title_' . $i, __( 'Custom', 'woocommerce-jetpack' ) . ' #' . $i )
@@ -107,7 +107,7 @@ class WCJ_Emails extends WCJ_Module {
107
  * @since 2.3.9
108
  */
109
  function add_custom_emails_to_wc_resend_order_emails( $emails ) {
110
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_emails_custom_emails_total_number', 1 ) ); $i++ ) {
111
  $emails[] = 'wcj_custom' . '_' . $i;
112
  }
113
  return $emails;
@@ -123,7 +123,7 @@ class WCJ_Emails extends WCJ_Module {
123
  if ( ! class_exists( 'WC_Email_WCJ_Custom' ) ) {
124
  require_once( 'emails/class-wc-email-wcj-custom.php' );
125
  }
126
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_emails_custom_emails_total_number', 1 ) ); $i++ ) {
127
  $emails[ 'WC_Email_WCJ_Custom_' . $i ] = new WC_Email_WCJ_Custom( $i );
128
  }
129
  return $emails;
32
  add_filter( 'woocommerce_resend_order_emails_available', array( $this, 'add_custom_emails_to_wc_resend_order_emails' ) );
33
  if ( ! WCJ_IS_WC_VERSION_BELOW_3_2_0 ) {
34
  add_filter( 'woocommerce_order_actions', array( $this, 'add_custom_emails_order_actions' ), PHP_INT_MAX, 1 );
35
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_emails_custom_emails_total_number', 1 ) ); $i++ ) {
36
  add_action( 'woocommerce_order_action_' . 'wcj_send_email_custom' . '_' . $i,
37
  array( $this, 'do_custom_emails_order_actions' ), PHP_INT_MAX, 1 );
38
  }
71
  * @todo (maybe) add "Add Custom Email(s) to Order Actions" option (in WC >= 3.2.0); same to `woocommerce_order_action_`
72
  */
73
  function add_custom_emails_order_actions( $actions ) {
74
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_emails_custom_emails_total_number', 1 ) ); $i++ ) {
75
  $actions[ 'wcj_send_email_custom' . '_' . $i ] = sprintf( apply_filters( 'wcj_emails_custom_emails_order_action_text',
76
  __( 'Booster: Send Email: %s', 'woocommerce-jetpack' ), $i ),
77
  get_option( 'wcj_emails_custom_emails_admin_title_' . $i, __( 'Custom', 'woocommerce-jetpack' ) . ' #' . $i )
107
  * @since 2.3.9
108
  */
109
  function add_custom_emails_to_wc_resend_order_emails( $emails ) {
110
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_emails_custom_emails_total_number', 1 ) ); $i++ ) {
111
  $emails[] = 'wcj_custom' . '_' . $i;
112
  }
113
  return $emails;
123
  if ( ! class_exists( 'WC_Email_WCJ_Custom' ) ) {
124
  require_once( 'emails/class-wc-email-wcj-custom.php' );
125
  }
126
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_emails_custom_emails_total_number', 1 ) ); $i++ ) {
127
  $emails[ 'WC_Email_WCJ_Custom_' . $i ] = new WC_Email_WCJ_Custom( $i );
128
  }
129
  return $emails;
includes/class-wcj-empty-cart-button.php CHANGED
@@ -35,7 +35,7 @@ class WCJ_Empty_Cart_Button extends WCJ_Module {
35
  ) {
36
  add_action( $empty_cart_cart_position, array( $this, 'add_empty_cart_link' ) );
37
  }
38
- if ( 'disable' != ( $empty_cart_checkout_position = get_option( 'wcj_empty_cart_checkout_position', 'disable' ) ) ) {
39
  $deprecated_hooks = array(
40
  'woocommerce_checkout_before_customer_details' => 'woocommerce_before_checkout_form',
41
  'woocommerce_checkout_billing' => 'woocommerce_before_checkout_form',
35
  ) {
36
  add_action( $empty_cart_cart_position, array( $this, 'add_empty_cart_link' ) );
37
  }
38
+ if ( 'disable' != ( $empty_cart_checkout_position = wcj_get_option( 'wcj_empty_cart_checkout_position', 'disable' ) ) ) {
39
  $deprecated_hooks = array(
40
  'woocommerce_checkout_before_customer_details' => 'woocommerce_before_checkout_form',
41
  'woocommerce_checkout_billing' => 'woocommerce_before_checkout_form',
includes/class-wcj-eu-vat-number.php CHANGED
@@ -49,7 +49,7 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
49
  add_filter( 'woocommerce_customer_meta_fields', array( $this, 'add_eu_vat_number_customer_meta_field' ) );
50
  add_filter( 'default_checkout_billing_eu_vat_number', array( $this, 'add_default_checkout_billing_eu_vat_number' ), PHP_INT_MAX, 2 );
51
 
52
- if ( 'after_order_table' === get_option( 'wcj_eu_vat_number_display_position', 'after_order_table' ) ) {
53
  add_action( 'woocommerce_order_details_after_order_table', array( $this, 'add_eu_vat_number_to_order_display' ), PHP_INT_MAX );
54
  add_action( 'woocommerce_email_after_order_table', array( $this, 'add_eu_vat_number_to_order_display' ), PHP_INT_MAX );
55
  } else {
@@ -62,7 +62,7 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
62
  $this->eu_countries_vat_rates_tool = include_once( 'tools/class-wcj-eu-countries-vat-rates-tool.php' );
63
 
64
  // EU VAT number summary on order edit page
65
- if ( 'yes' === get_option( 'wcj_eu_vat_number_add_order_edit_metabox', 'no' ) ) {
66
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
67
  // "Validate VAT and remove taxes" button
68
  add_action( 'admin_init', array( $this, 'admin_validate_vat_and_maybe_remove_taxes' ), PHP_INT_MAX );
@@ -86,7 +86,7 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
86
  * @return mixed
87
  */
88
  function maybe_recalculate_tax_totals( $total, $cart ) {
89
- if ( 'yes' === get_option( 'wcj_eu_vat_number_disable_for_valid_on_cart', 'no' ) && $this->need_to_exclude_vat() ) {
90
  return $total - $cart->get_taxes_total();
91
  }
92
  return $total;
@@ -104,7 +104,7 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
104
  * @return array
105
  */
106
  function maybe_remove_tax_totals( $tax_totals ) {
107
- if ( 'yes' === get_option( 'wcj_eu_vat_number_disable_for_valid_on_cart', 'no' ) && $this->need_to_exclude_vat() ) {
108
  $tax_totals = array();
109
  }
110
  return $tax_totals;
@@ -188,7 +188,7 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
188
  $location = WC_Geolocation::geolocate_ip( $_customer_ip_address );
189
  // Base fallback
190
  if ( empty( $location['country'] ) ) {
191
- $location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', get_option( 'woocommerce_default_country' ) ) );
192
  }
193
  $customer_country = ( isset( $location['country'] ) ) ? $location['country'] : '';
194
  } else {
@@ -301,7 +301,7 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
301
  $option_name = '_billing_' . $this->id;
302
  $the_eu_vat_number = get_post_meta( $order_id, $option_name, true );
303
  if ( '' != $the_eu_vat_number ) {
304
- $the_label = get_option( 'wcj_eu_vat_number_field_label', __( 'EU VAT Number', 'woocommerce-jetpack' ) );
305
  $html .= '<p>' . '<strong>' . $the_label . '</strong>: ' . $the_eu_vat_number . '</p>';
306
  }
307
  echo $html;
@@ -339,7 +339,7 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
339
  */
340
  function add_eu_vat_number_customer_meta_field( $fields ) {
341
  $fields['billing']['fields']['billing_eu_vat_number'] = array(
342
- 'label' => get_option( 'wcj_eu_vat_number_field_label' ),
343
  'description' => ''
344
  );
345
  return $fields;
@@ -374,7 +374,7 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
374
  * @return bool
375
  */
376
  function restrictive_loading_valid() {
377
- if ( empty( $restrictive_loading_conditions = get_option( 'wcj_eu_vat_number_restrictive_loading', array() ) ) ) {
378
  return true;
379
  }
380
  foreach ( $restrictive_loading_conditions as $condition ) {
@@ -392,7 +392,7 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
392
  */
393
  function enqueue_scripts() {
394
  if (
395
- 'no' === get_option( 'wcj_eu_vat_number_validate', 'yes' ) ||
396
  ! $this->restrictive_loading_valid()
397
  ) {
398
  return;
@@ -401,12 +401,12 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
401
  wp_localize_script( 'wcj-eu-vat-number', 'ajax_object', array(
402
  'ajax_url' => admin_url( 'admin-ajax.php' ),
403
  'eu_countries' => wcj_get_european_union_countries(),
404
- 'show_vat_field_for_eu_only' => get_option( 'wcj_eu_vat_number_show_vat_field_for_eu_only', 'no' ),
405
- 'add_progress_text' => get_option( 'wcj_eu_vat_number_add_progress_text', 'no' ),
406
- 'progress_text_validating' => do_shortcode( get_option( 'wcj_eu_vat_number_progress_text_validating', __( 'Validating VAT. Please wait...', 'woocommerce-jetpack' ) ) ),
407
- 'progress_text_valid' => do_shortcode( get_option( 'wcj_eu_vat_number_progress_text_valid', __( 'VAT is valid.', 'woocommerce-jetpack' ) ) ),
408
- 'progress_text_not_valid' => do_shortcode( get_option( 'wcj_eu_vat_number_progress_text_not_valid', __( 'VAT is not valid.', 'woocommerce-jetpack' ) ) ),
409
- 'progress_text_validation_failed' => do_shortcode( get_option( 'wcj_eu_vat_number_progress_text_validation_failed', __( 'Validation failed. Please try again.', 'woocommerce-jetpack' ) ) ),
410
  ) );
411
  }
412
 
@@ -425,10 +425,10 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
425
  if ( ! empty( $eu_vat_number ) ) {
426
  $eu_vat_number_to_check = substr( $eu_vat_number, 2 );
427
  $eu_vat_number_country_to_check = substr( $eu_vat_number, 0, 2 );
428
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_eu_vat_number_check_ip_location_country', 'no' ) ) ) {
429
  $location = WC_Geolocation::geolocate_ip();
430
  if ( empty( $location['country'] ) ) {
431
- $location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', get_option( 'woocommerce_default_country' ) ) );
432
  }
433
  $is_valid = ( $location['country'] === $eu_vat_number_country_to_check ) ?
434
  wcj_validate_vat( $eu_vat_number_country_to_check, $eu_vat_number_to_check ) :
@@ -472,18 +472,18 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
472
  defined( 'WOOCOMMERCE_CHECKOUT' ) || defined( 'WOOCOMMERCE_CART' ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX )
473
  ) &&
474
  ! empty( WC()->customer ) &&
475
- 'yes' === get_option( 'wcj_eu_vat_number_validate', 'yes' ) &&
476
- 'yes' === get_option( 'wcj_eu_vat_number_disable_for_valid', 'yes' ) &&
477
  (
478
  ( true === wcj_session_get( 'wcj_is_eu_vat_number_valid' ) && null !== ( $eu_vat_number = wcj_session_get( 'wcj_eu_vat_number_to_check' ) ) ) ||
479
- ( 'yes' === get_option( 'wcj_eu_vat_number_disable_for_valid_by_user_vat', 'no' ) && is_user_logged_in() && ! empty( $eu_vat_number = get_user_meta( get_current_user_id(), 'billing_eu_vat_number', true ) ) && '1' === $this->wcj_validate_eu_vat_number( array( 'wcj_eu_vat_number_to_check' => $eu_vat_number, 'echo' => false ) ) )
480
  )
481
  ) {
482
  $preserve_base_country_check_passed = true;
483
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_eu_vat_number_preserve_in_base_country', 'no' ) ) ) {
484
  $location = wc_get_base_location();
485
  if ( empty( $location['country'] ) ) {
486
- $location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', get_option( 'woocommerce_default_country' ) ) );
487
  }
488
  $selected_country = substr( $eu_vat_number, 0, 2 );
489
  if ( 'EL' === $selected_country ) {
@@ -525,9 +525,9 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
525
  * @version 4.6.1
526
  */
527
  function checkout_validate_vat( $_posted ) {
528
- if ( 'yes' === get_option( 'wcj_eu_vat_number_validate', 'yes' ) ) {
529
  if (
530
- ( 'yes' === get_option( 'wcj_eu_vat_number_field_required', 'no' ) && '' == $_posted['billing_eu_vat_number'] ) ||
531
  (
532
  '' != $_posted['billing_eu_vat_number'] ) &&
533
  '1' !== $this->wcj_validate_eu_vat_number( array( 'wcj_eu_vat_number_to_check' => $_posted['billing_eu_vat_number'], 'echo' => false )
@@ -551,12 +551,12 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
551
 
552
  $fields[ $this->id ] = array(
553
  'type' => 'text',
554
- 'label' => get_option( 'wcj_eu_vat_number_field_label' ),
555
  'show' => true
556
  );
557
 
558
  // Try to read meta from 'vat_number' if '_billing_eu_vat_number' is empty
559
- if ( 'yes' === get_option( 'wcj_eu_vat_number_read_vat_number_meta', 'no' ) ) {
560
  global $post;
561
  $order = wc_get_order( $post->ID );
562
  if ( is_a( $order, 'WC_Order' ) ) {
@@ -582,14 +582,14 @@ class WCJ_EU_VAT_Number extends WCJ_Module {
582
  function add_eu_vat_number_checkout_field_to_frontend( $fields ) {
583
  $fields['billing'][ 'billing_' . $this->id ] = array(
584
  'type' => 'text',
585
- 'label' => get_option( 'wcj_eu_vat_number_field_label' ),
586
- 'description' => get_option( 'wcj_eu_vat_number_field_description' ),
587
- 'placeholder' => get_option( 'wcj_eu_vat_number_field_placeholder' ),
588
- 'required' => ( 'yes' === get_option( 'wcj_eu_vat_number_field_required', 'no' ) ),
589
  'custom_attributes' => array(),
590
- 'clear' => ( 'yes' === get_option( 'wcj_eu_vat_number_field_clear', 'yes' ) ),
591
- 'class' => array( get_option( 'wcj_eu_vat_number_field_class', 'form-row-wide' ) ),
592
- 'validate' => ( 'yes' === get_option( 'wcj_eu_vat_number_validate', 'yes' ) ) ? array( 'eu-vat-number' ) : array(),
593
  );
594
  return $fields;
595
  }
49
  add_filter( 'woocommerce_customer_meta_fields', array( $this, 'add_eu_vat_number_customer_meta_field' ) );
50
  add_filter( 'default_checkout_billing_eu_vat_number', array( $this, 'add_default_checkout_billing_eu_vat_number' ), PHP_INT_MAX, 2 );
51
 
52
+ if ( 'after_order_table' === wcj_get_option( 'wcj_eu_vat_number_display_position', 'after_order_table' ) ) {
53
  add_action( 'woocommerce_order_details_after_order_table', array( $this, 'add_eu_vat_number_to_order_display' ), PHP_INT_MAX );
54
  add_action( 'woocommerce_email_after_order_table', array( $this, 'add_eu_vat_number_to_order_display' ), PHP_INT_MAX );
55
  } else {
62
  $this->eu_countries_vat_rates_tool = include_once( 'tools/class-wcj-eu-countries-vat-rates-tool.php' );
63
 
64
  // EU VAT number summary on order edit page
65
+ if ( 'yes' === wcj_get_option( 'wcj_eu_vat_number_add_order_edit_metabox', 'no' ) ) {
66
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
67
  // "Validate VAT and remove taxes" button
68
  add_action( 'admin_init', array( $this, 'admin_validate_vat_and_maybe_remove_taxes' ), PHP_INT_MAX );
86
  * @return mixed
87
  */
88
  function maybe_recalculate_tax_totals( $total, $cart ) {
89
+ if ( 'yes' === wcj_get_option( 'wcj_eu_vat_number_disable_for_valid_on_cart', 'no' ) && $this->need_to_exclude_vat() ) {
90
  return $total - $cart->get_taxes_total();
91
  }
92
  return $total;
104
  * @return array
105
  */
106
  function maybe_remove_tax_totals( $tax_totals ) {
107
+ if ( 'yes' === wcj_get_option( 'wcj_eu_vat_number_disable_for_valid_on_cart', 'no' ) && $this->need_to_exclude_vat() ) {
108
  $tax_totals = array();
109
  }
110
  return $tax_totals;
188
  $location = WC_Geolocation::geolocate_ip( $_customer_ip_address );
189
  // Base fallback
190
  if ( empty( $location['country'] ) ) {
191
+ $location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', wcj_get_option( 'woocommerce_default_country' ) ) );
192
  }
193
  $customer_country = ( isset( $location['country'] ) ) ? $location['country'] : '';
194
  } else {
301
  $option_name = '_billing_' . $this->id;
302
  $the_eu_vat_number = get_post_meta( $order_id, $option_name, true );
303
  if ( '' != $the_eu_vat_number ) {
304
+ $the_label = wcj_get_option( 'wcj_eu_vat_number_field_label', __( 'EU VAT Number', 'woocommerce-jetpack' ) );
305
  $html .= '<p>' . '<strong>' . $the_label . '</strong>: ' . $the_eu_vat_number . '</p>';
306
  }
307
  echo $html;
339
  */
340
  function add_eu_vat_number_customer_meta_field( $fields ) {
341
  $fields['billing']['fields']['billing_eu_vat_number'] = array(
342
+ 'label' => wcj_get_option( 'wcj_eu_vat_number_field_label' ),
343
  'description' => ''
344
  );
345
  return $fields;
374
  * @return bool
375
  */
376
  function restrictive_loading_valid() {
377
+ if ( empty( $restrictive_loading_conditions = wcj_get_option( 'wcj_eu_vat_number_restrictive_loading', array() ) ) ) {
378
  return true;
379
  }
380
  foreach ( $restrictive_loading_conditions as $condition ) {
392
  */
393
  function enqueue_scripts() {
394
  if (
395
+ 'no' === wcj_get_option( 'wcj_eu_vat_number_validate', 'yes' ) ||
396
  ! $this->restrictive_loading_valid()
397
  ) {
398
  return;
401
  wp_localize_script( 'wcj-eu-vat-number', 'ajax_object', array(
402
  'ajax_url' => admin_url( 'admin-ajax.php' ),
403
  'eu_countries' => wcj_get_european_union_countries(),
404
+ 'show_vat_field_for_eu_only' => wcj_get_option( 'wcj_eu_vat_number_show_vat_field_for_eu_only', 'no' ),
405
+ 'add_progress_text' => wcj_get_option( 'wcj_eu_vat_number_add_progress_text', 'no' ),
406
+ 'progress_text_validating' => do_shortcode( wcj_get_option( 'wcj_eu_vat_number_progress_text_validating', __( 'Validating VAT. Please wait...', 'woocommerce-jetpack' ) ) ),
407
+ 'progress_text_valid' => do_shortcode( wcj_get_option( 'wcj_eu_vat_number_progress_text_valid', __( 'VAT is valid.', 'woocommerce-jetpack' ) ) ),
408
+ 'progress_text_not_valid' => do_shortcode( wcj_get_option( 'wcj_eu_vat_number_progress_text_not_valid', __( 'VAT is not valid.', 'woocommerce-jetpack' ) ) ),
409
+ 'progress_text_validation_failed' => do_shortcode( wcj_get_option( 'wcj_eu_vat_number_progress_text_validation_failed', __( 'Validation failed. Please try again.', 'woocommerce-jetpack' ) ) ),
410
  ) );
411
  }
412
 
425
  if ( ! empty( $eu_vat_number ) ) {
426
  $eu_vat_number_to_check = substr( $eu_vat_number, 2 );
427
  $eu_vat_number_country_to_check = substr( $eu_vat_number, 0, 2 );
428
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_eu_vat_number_check_ip_location_country', 'no' ) ) ) {
429
  $location = WC_Geolocation::geolocate_ip();
430
  if ( empty( $location['country'] ) ) {
431
+ $location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', wcj_get_option( 'woocommerce_default_country' ) ) );
432
  }
433
  $is_valid = ( $location['country'] === $eu_vat_number_country_to_check ) ?
434
  wcj_validate_vat( $eu_vat_number_country_to_check, $eu_vat_number_to_check ) :
472
  defined( 'WOOCOMMERCE_CHECKOUT' ) || defined( 'WOOCOMMERCE_CART' ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX )
473
  ) &&
474
  ! empty( WC()->customer ) &&
475
+ 'yes' === wcj_get_option( 'wcj_eu_vat_number_validate', 'yes' ) &&
476
+ 'yes' === wcj_get_option( 'wcj_eu_vat_number_disable_for_valid', 'yes' ) &&
477
  (
478
  ( true === wcj_session_get( 'wcj_is_eu_vat_number_valid' ) && null !== ( $eu_vat_number = wcj_session_get( 'wcj_eu_vat_number_to_check' ) ) ) ||
479
+ ( 'yes' === wcj_get_option( 'wcj_eu_vat_number_disable_for_valid_by_user_vat', 'no' ) && is_user_logged_in() && ! empty( $eu_vat_number = get_user_meta( get_current_user_id(), 'billing_eu_vat_number', true ) ) && '1' === $this->wcj_validate_eu_vat_number( array( 'wcj_eu_vat_number_to_check' => $eu_vat_number, 'echo' => false ) ) )
480
  )
481
  ) {
482
  $preserve_base_country_check_passed = true;
483
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_eu_vat_number_preserve_in_base_country', 'no' ) ) ) {
484
  $location = wc_get_base_location();
485
  if ( empty( $location['country'] ) ) {
486
+ $location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', wcj_get_option( 'woocommerce_default_country' ) ) );
487
  }
488
  $selected_country = substr( $eu_vat_number, 0, 2 );
489
  if ( 'EL' === $selected_country ) {
525
  * @version 4.6.1
526
  */
527
  function checkout_validate_vat( $_posted ) {
528
+ if ( 'yes' === wcj_get_option( 'wcj_eu_vat_number_validate', 'yes' ) ) {
529
  if (
530
+ ( 'yes' === wcj_get_option( 'wcj_eu_vat_number_field_required', 'no' ) && '' == $_posted['billing_eu_vat_number'] ) ||
531
  (
532
  '' != $_posted['billing_eu_vat_number'] ) &&
533
  '1' !== $this->wcj_validate_eu_vat_number( array( 'wcj_eu_vat_number_to_check' => $_posted['billing_eu_vat_number'], 'echo' => false )
551
 
552
  $fields[ $this->id ] = array(
553
  'type' => 'text',
554
+ 'label' => wcj_get_option( 'wcj_eu_vat_number_field_label' ),
555
  'show' => true
556
  );
557
 
558
  // Try to read meta from 'vat_number' if '_billing_eu_vat_number' is empty
559
+ if ( 'yes' === wcj_get_option( 'wcj_eu_vat_number_read_vat_number_meta', 'no' ) ) {
560
  global $post;
561
  $order = wc_get_order( $post->ID );
562
  if ( is_a( $order, 'WC_Order' ) ) {
582
  function add_eu_vat_number_checkout_field_to_frontend( $fields ) {
583
  $fields['billing'][ 'billing_' . $this->id ] = array(
584
  'type' => 'text',
585
+ 'label' => wcj_get_option( 'wcj_eu_vat_number_field_label' ),
586
+ 'description' => wcj_get_option( 'wcj_eu_vat_number_field_description' ),
587
+ 'placeholder' => wcj_get_option( 'wcj_eu_vat_number_field_placeholder' ),
588
+ 'required' => ( 'yes' === wcj_get_option( 'wcj_eu_vat_number_field_required', 'no' ) ),
589
  'custom_attributes' => array(),
590
+ 'clear' => ( 'yes' === wcj_get_option( 'wcj_eu_vat_number_field_clear', 'yes' ) ),
591
+ 'class' => array( wcj_get_option( 'wcj_eu_vat_number_field_class', 'form-row-wide' ) ),
592
+ 'validate' => ( 'yes' === wcj_get_option( 'wcj_eu_vat_number_validate', 'yes' ) ) ? array( 'eu-vat-number' ) : array(),
593
  );
594
  return $fields;
595
  }
includes/class-wcj-export-import.php CHANGED
@@ -164,7 +164,7 @@ class WCJ_Export_Import extends WCJ_Module {
164
  * @return array
165
  */
166
  function smart_format_fields( $row ) {
167
- if ( 'no' === get_option( 'wcj_export_csv_smart_formatting', 'no' ) ) {
168
  return $row;
169
  }
170
  $row = array_map( function ( $item ) {
@@ -193,9 +193,9 @@ class WCJ_Export_Import extends WCJ_Module {
193
  $csv = '';
194
  foreach ( $data as $row ) {
195
  $row = $this->smart_format_fields( $row );
196
- $csv .= implode( get_option( 'wcj_export_csv_separator', ',' ), $row ) . PHP_EOL;
197
  }
198
- if ( 'yes' === get_option( 'wcj_export_csv_add_utf_8_bom', 'yes' ) ) {
199
  $csv = "\xEF\xBB\xBF" . $csv; // UTF-8 BOM
200
  }
201
  header( "Content-Disposition: attachment; filename=" . $_POST['wcj_export'] . ".csv" );
164
  * @return array
165
  */
166
  function smart_format_fields( $row ) {
167
+ if ( 'no' === wcj_get_option( 'wcj_export_csv_smart_formatting', 'no' ) ) {
168
  return $row;
169
  }
170
  $row = array_map( function ( $item ) {
193
  $csv = '';
194
  foreach ( $data as $row ) {
195
  $row = $this->smart_format_fields( $row );
196
+ $csv .= implode( wcj_get_option( 'wcj_export_csv_separator', ',' ), $row ) . PHP_EOL;
197
  }
198
+ if ( 'yes' === wcj_get_option( 'wcj_export_csv_add_utf_8_bom', 'yes' ) ) {
199
  $csv = "\xEF\xBB\xBF" . $csv; // UTF-8 BOM
200
  }
201
  header( "Content-Disposition: attachment; filename=" . $_POST['wcj_export'] . ".csv" );
includes/class-wcj-free-price.php CHANGED
@@ -131,8 +131,8 @@ class WCJ_Free_Price extends WCJ_Module {
131
  function modify_free_price_simple_external_custom( $price, $_product ) {
132
  $default = '<span class="amount">' . __( 'Free!', 'woocommerce' ) . '</span>';
133
  return ( $_product->is_type( 'external' ) ) ?
134
- do_shortcode( get_option( 'wcj_free_price_external_' . $this->get_view_id( wcj_get_product_id_or_variation_parent_id( $_product ) ), $default ) ) :
135
- do_shortcode( get_option( 'wcj_free_price_simple_' . $this->get_view_id( wcj_get_product_id_or_variation_parent_id( $_product ) ), $default ) );
136
  }
137
 
138
  /**
@@ -142,7 +142,7 @@ class WCJ_Free_Price extends WCJ_Module {
142
  * @since 2.5.9
143
  */
144
  function modify_free_price_grouped( $price, $_product ) {
145
- return do_shortcode( get_option( 'wcj_free_price_grouped_' . $this->get_view_id( wcj_get_product_id_or_variation_parent_id( $_product ) ), __( 'Free!', 'woocommerce' ) ) );
146
  }
147
 
148
  /**
@@ -152,7 +152,7 @@ class WCJ_Free_Price extends WCJ_Module {
152
  * @since 2.5.9
153
  */
154
  function modify_free_price_variable( $price, $_product ) {
155
- return do_shortcode( apply_filters( 'booster_option', __( 'Free!', 'woocommerce' ), get_option( 'wcj_free_price_variable_' . $this->get_view_id( wcj_get_product_id_or_variation_parent_id( $_product ) ), __( 'Free!', 'woocommerce' ) ) ) );
156
  }
157
 
158
  /**
@@ -162,7 +162,7 @@ class WCJ_Free_Price extends WCJ_Module {
162
  * @since 2.5.9
163
  */
164
  function modify_free_price_variation( $price, $_product ) {
165
- return do_shortcode( apply_filters( 'booster_option', __( 'Free!', 'woocommerce' ), get_option( 'wcj_free_price_variable_variation', __( 'Free!', 'woocommerce' ) ) ) );
166
  }
167
 
168
  }
131
  function modify_free_price_simple_external_custom( $price, $_product ) {
132
  $default = '<span class="amount">' . __( 'Free!', 'woocommerce' ) . '</span>';
133
  return ( $_product->is_type( 'external' ) ) ?
134
+ do_shortcode( wcj_get_option( 'wcj_free_price_external_' . $this->get_view_id( wcj_get_product_id_or_variation_parent_id( $_product ) ), $default ) ) :
135
+ do_shortcode( wcj_get_option( 'wcj_free_price_simple_' . $this->get_view_id( wcj_get_product_id_or_variation_parent_id( $_product ) ), $default ) );
136
  }
137
 
138
  /**
142
  * @since 2.5.9
143
  */
144
  function modify_free_price_grouped( $price, $_product ) {
145
+ return do_shortcode( wcj_get_option( 'wcj_free_price_grouped_' . $this->get_view_id( wcj_get_product_id_or_variation_parent_id( $_product ) ), __( 'Free!', 'woocommerce' ) ) );
146
  }
147
 
148
  /**
152
  * @since 2.5.9
153
  */
154
  function modify_free_price_variable( $price, $_product ) {
155
+ return do_shortcode( apply_filters( 'booster_option', __( 'Free!', 'woocommerce' ), wcj_get_option( 'wcj_free_price_variable_' . $this->get_view_id( wcj_get_product_id_or_variation_parent_id( $_product ) ), __( 'Free!', 'woocommerce' ) ) ) );
156
  }
157
 
158
  /**
162
  * @since 2.5.9
163
  */
164
  function modify_free_price_variation( $price, $_product ) {
165
+ return do_shortcode( apply_filters( 'booster_option', __( 'Free!', 'woocommerce' ), wcj_get_option( 'wcj_free_price_variable_variation', __( 'Free!', 'woocommerce' ) ) ) );
166
  }
167
 
168
  }
includes/class-wcj-general.php CHANGED
@@ -40,36 +40,36 @@ class WCJ_General extends WCJ_Module {
40
  if ( $this->is_enabled() ) {
41
 
42
  // PHP Memory Limit
43
- if ( 0 != ( $php_memory_limit = get_option( 'wcj_admin_tools_php_memory_limit', 0 ) ) ) {
44
  ini_set( 'memory_limit', $php_memory_limit . 'M' );
45
  }
46
  $this->current_php_memory_limit = sprintf( ' ' . __( 'Current PHP memory limit: %s.', 'woocommerce-jetpack' ), ini_get( 'memory_limit' ) );
47
 
48
  // PHP Time Limit
49
- if ( 0 != ( $php_time_limit = get_option( 'wcj_admin_tools_php_time_limit', 0 ) ) ) {
50
  set_time_limit( $php_time_limit );
51
  }
52
  $this->current_php_time_limit = sprintf( ' ' . __( 'Current PHP time limit: %s seconds.', 'woocommerce-jetpack' ), ini_get( 'max_execution_time' ) );
53
 
54
  // Recalculate cart totals
55
- if ( 'yes' === get_option( 'wcj_general_advanced_recalculate_cart_totals', 'no' ) ) {
56
  add_action( 'wp_loaded', array( $this, 'fix_mini_cart' ), PHP_INT_MAX );
57
  }
58
 
59
  // Shortcodes in text widgets
60
- if ( 'yes' === get_option( 'wcj_general_shortcodes_in_text_widgets_enabled' ) ) {
61
  add_filter( 'widget_text', 'do_shortcode' );
62
  }
63
 
64
  // PayPal email per product
65
- if ( 'yes' === get_option( 'wcj_paypal_email_per_product_enabled', 'no' ) ) {
66
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
67
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
68
  add_filter( 'woocommerce_payment_gateways', array( $this, 'maybe_change_paypal_email' ) );
69
  }
70
 
71
  // Session expiration
72
- if ( 'yes' === get_option( 'wcj_session_expiration_section_enabled', 'no' ) ) {
73
  add_filter( 'wc_session_expiring', array( $this, 'change_session_expiring' ), PHP_INT_MAX );
74
  add_filter( 'wc_session_expiration', array( $this, 'change_session_expiration' ), PHP_INT_MAX );
75
  }
@@ -81,7 +81,7 @@ class WCJ_General extends WCJ_Module {
81
  }
82
 
83
  // Try to overwrite WooCommerce IP detection
84
- if ( 'yes' === get_option( 'wcj_general_overwrite_wc_ip', 'no' ) ) {
85
  if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
86
  $_SERVER['HTTP_X_REAL_IP'] = wcj_get_the_ip();
87
  }
@@ -159,7 +159,7 @@ class WCJ_General extends WCJ_Module {
159
  * @since 2.5.7
160
  */
161
  function change_session_expiring( $the_time ) {
162
- return get_option( 'wcj_session_expiring', 47 * 60 * 60 );
163
  }
164
 
165
  /**
@@ -169,7 +169,7 @@ class WCJ_General extends WCJ_Module {
169
  * @since 2.5.7
170
  */
171
  function change_session_expiration( $the_time ) {
172
- return get_option( 'wcj_session_expiration', 48 * 60 * 60 );
173
  }
174
 
175
  /**
@@ -191,7 +191,7 @@ class WCJ_General extends WCJ_Module {
191
  $caps = ( ! empty( $caps_role->capabilities ) && is_array( $caps_role->capabilities ) ? $caps_role->capabilities : array() );
192
  $result = add_role( $role_id, $_POST['wcj_custom_role_name'], $caps );
193
  if ( null !== $result ) {
194
- $custom_roles = get_option( 'wcj_custom_roles', array() ); // `wcj_custom_roles` option added since Booster v4.0.0
195
  $custom_roles[ $role_id ] = array( 'display_name' => $_POST['wcj_custom_role_name'], 'caps_role' => $_POST['wcj_custom_role_caps'] );
196
  update_option( 'wcj_custom_roles', $custom_roles );
197
  echo '<p style="color:green;font-weight:bold;">' . __( 'Role successfully added!', 'woocommerce-jetpack') . '</p>';
@@ -204,7 +204,7 @@ class WCJ_General extends WCJ_Module {
204
 
205
  if ( isset( $_GET['wcj_delete_role'] ) && '' != $_GET['wcj_delete_role'] ) {
206
  remove_role( $_GET['wcj_delete_role'] );
207
- $custom_roles = get_option( 'wcj_custom_roles', array() );
208
  if ( isset( $custom_roles[ $_GET['wcj_delete_role'] ] ) ) {
209
  unset( $custom_roles[ $_GET['wcj_delete_role'] ] );
210
  update_option( 'wcj_custom_roles', $custom_roles );
@@ -218,7 +218,7 @@ class WCJ_General extends WCJ_Module {
218
  $table_data[] = array( __( 'ID', 'woocommerce-jetpack'), __( 'Name', 'woocommerce-jetpack'), __( 'Capabilities', 'woocommerce-jetpack'), __( 'Actions', 'woocommerce-jetpack') );
219
  $existing_roles = wcj_get_user_roles();
220
  $default_wp_wc_roles = array( 'guest', 'administrator', 'editor', 'author', 'contributor', 'subscriber', 'customer', 'shop_manager' );
221
- $custom_roles = get_option( 'wcj_custom_roles', array() );
222
  foreach ( $existing_roles as $role_key => $role_data ) {
223
  $delete_html = ( in_array( $role_key, $default_wp_wc_roles ) )
224
  ? ''
40
  if ( $this->is_enabled() ) {
41
 
42
  // PHP Memory Limit
43
+ if ( 0 != ( $php_memory_limit = wcj_get_option( 'wcj_admin_tools_php_memory_limit', 0 ) ) ) {
44
  ini_set( 'memory_limit', $php_memory_limit . 'M' );
45
  }
46
  $this->current_php_memory_limit = sprintf( ' ' . __( 'Current PHP memory limit: %s.', 'woocommerce-jetpack' ), ini_get( 'memory_limit' ) );
47
 
48
  // PHP Time Limit
49
+ if ( 0 != ( $php_time_limit = wcj_get_option( 'wcj_admin_tools_php_time_limit', 0 ) ) ) {
50
  set_time_limit( $php_time_limit );
51
  }
52
  $this->current_php_time_limit = sprintf( ' ' . __( 'Current PHP time limit: %s seconds.', 'woocommerce-jetpack' ), ini_get( 'max_execution_time' ) );
53
 
54
  // Recalculate cart totals
55
+ if ( 'yes' === wcj_get_option( 'wcj_general_advanced_recalculate_cart_totals', 'no' ) ) {
56
  add_action( 'wp_loaded', array( $this, 'fix_mini_cart' ), PHP_INT_MAX );
57
  }
58
 
59
  // Shortcodes in text widgets
60
+ if ( 'yes' === wcj_get_option( 'wcj_general_shortcodes_in_text_widgets_enabled' ) ) {
61
  add_filter( 'widget_text', 'do_shortcode' );
62
  }
63
 
64
  // PayPal email per product
65
+ if ( 'yes' === wcj_get_option( 'wcj_paypal_email_per_product_enabled', 'no' ) ) {
66
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
67
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
68
  add_filter( 'woocommerce_payment_gateways', array( $this, 'maybe_change_paypal_email' ) );
69
  }
70
 
71
  // Session expiration
72
+ if ( 'yes' === wcj_get_option( 'wcj_session_expiration_section_enabled', 'no' ) ) {
73
  add_filter( 'wc_session_expiring', array( $this, 'change_session_expiring' ), PHP_INT_MAX );
74
  add_filter( 'wc_session_expiration', array( $this, 'change_session_expiration' ), PHP_INT_MAX );
75
  }
81
  }
82
 
83
  // Try to overwrite WooCommerce IP detection
84
+ if ( 'yes' === wcj_get_option( 'wcj_general_overwrite_wc_ip', 'no' ) ) {
85
  if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
86
  $_SERVER['HTTP_X_REAL_IP'] = wcj_get_the_ip();
87
  }
159
  * @since 2.5.7
160
  */
161
  function change_session_expiring( $the_time ) {
162
+ return wcj_get_option( 'wcj_session_expiring', 47 * 60 * 60 );
163
  }
164
 
165
  /**
169
  * @since 2.5.7
170
  */
171
  function change_session_expiration( $the_time ) {
172
+ return wcj_get_option( 'wcj_session_expiration', 48 * 60 * 60 );
173
  }
174
 
175
  /**
191
  $caps = ( ! empty( $caps_role->capabilities ) && is_array( $caps_role->capabilities ) ? $caps_role->capabilities : array() );
192
  $result = add_role( $role_id, $_POST['wcj_custom_role_name'], $caps );
193
  if ( null !== $result ) {
194
+ $custom_roles = wcj_get_option( 'wcj_custom_roles', array() ); // `wcj_custom_roles` option added since Booster v4.0.0
195
  $custom_roles[ $role_id ] = array( 'display_name' => $_POST['wcj_custom_role_name'], 'caps_role' => $_POST['wcj_custom_role_caps'] );
196
  update_option( 'wcj_custom_roles', $custom_roles );
197
  echo '<p style="color:green;font-weight:bold;">' . __( 'Role successfully added!', 'woocommerce-jetpack') . '</p>';
204
 
205
  if ( isset( $_GET['wcj_delete_role'] ) && '' != $_GET['wcj_delete_role'] ) {
206
  remove_role( $_GET['wcj_delete_role'] );
207
+ $custom_roles = wcj_get_option( 'wcj_custom_roles', array() );
208
  if ( isset( $custom_roles[ $_GET['wcj_delete_role'] ] ) ) {
209
  unset( $custom_roles[ $_GET['wcj_delete_role'] ] );
210
  update_option( 'wcj_custom_roles', $custom_roles );
218
  $table_data[] = array( __( 'ID', 'woocommerce-jetpack'), __( 'Name', 'woocommerce-jetpack'), __( 'Capabilities', 'woocommerce-jetpack'), __( 'Actions', 'woocommerce-jetpack') );
219
  $existing_roles = wcj_get_user_roles();
220
  $default_wp_wc_roles = array( 'guest', 'administrator', 'editor', 'author', 'contributor', 'subscriber', 'customer', 'shop_manager' );
221
+ $custom_roles = wcj_get_option( 'wcj_custom_roles', array() );
222
  foreach ( $existing_roles as $role_key => $role_data ) {
223
  $delete_html = ( in_array( $role_key, $default_wp_wc_roles ) )
224
  ? ''
includes/class-wcj-global-discount.php CHANGED
@@ -34,7 +34,7 @@ class WCJ_Global_Discount extends WCJ_Module {
34
 
35
  if ( $this->is_enabled() ) {
36
  $this->price_hooks_priority = wcj_get_module_price_hooks_priority( 'global_discount' );
37
- if ( 'yes' === get_option( 'wcj_global_discount_enabled_in_admin', 'no' ) || wcj_is_frontend() ) {
38
  wcj_add_change_price_hooks( $this, $this->price_hooks_priority, false );
39
  }
40
 
@@ -59,7 +59,7 @@ class WCJ_Global_Discount extends WCJ_Module {
59
  function add_wcj_sale_ids_to_products_shortcode( $args, $atts, $type ) {
60
  if (
61
  'sale_products' != $type ||
62
- 'yes' != get_option( 'wcj_global_discount_products_shortcode_compatibility', 'no' )
63
  ) {
64
  return $args;
65
  }
@@ -77,7 +77,7 @@ class WCJ_Global_Discount extends WCJ_Module {
77
  */
78
  function regenerate_wcj_sale_products_in_cache() {
79
  if (
80
- 'yes' != get_option( 'wcj_global_discount_products_shortcode_compatibility', 'no' ) ||
81
  ! isset( $_REQUEST['page'] ) || 'wc-settings' !== $_REQUEST['page'] ||
82
  ! isset( $_REQUEST['tab'] ) || 'jetpack' !== $_REQUEST['tab'] ||
83
  ! isset( $_REQUEST['wcj-cat'] ) || 'prices_and_currencies' !== $_REQUEST['wcj-cat'] ||
@@ -107,16 +107,16 @@ class WCJ_Global_Discount extends WCJ_Module {
107
  'posts_per_page' => - 1,
108
  'fields' => 'ids',
109
  );
110
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_global_discount_groups_total_number', 1 ) );
111
  for ( $i = 1; $i <= $total_number; $i ++ ) {
112
- $enabled = get_option( 'wcj_global_discount_sale_enabled_' . $i, 'yes' );
113
  if ( 'yes' !== $enabled ) {
114
  continue;
115
  }
116
 
117
  // Categories
118
- $include_cats = get_option( 'wcj_global_discount_sale_categories_incl_' . $i, array() );
119
- $exclude_cats = get_option( 'wcj_global_discount_sale_categories_excl_' . $i, array() );
120
  $cats = array();
121
  if ( ! empty( $include_cats ) || ! empty( $exclude_cats ) ) {
122
  $cats = array(
@@ -142,8 +142,8 @@ class WCJ_Global_Discount extends WCJ_Module {
142
  }
143
 
144
  // Tags
145
- $include_tags = get_option( 'wcj_global_discount_sale_tags_incl_' . $i, array() );
146
- $exclude_tags = get_option( 'wcj_global_discount_sale_tags_excl_' . $i, array() );
147
  $tags = array();
148
  if ( ! empty( $include_tags ) || ! empty( $exclude_tags ) ) {
149
  $tags = array(
@@ -180,8 +180,8 @@ class WCJ_Global_Discount extends WCJ_Module {
180
  }
181
 
182
  // Products
183
- $products_incl = get_option( 'wcj_global_discount_sale_products_incl_' . $i, array() );
184
- $products_excl = get_option( 'wcj_global_discount_sale_products_excl_' . $i, array() );
185
  if ( ! empty( $products_incl ) || ! empty( $products_excl ) ) {
186
  if ( ! empty( $products_incl ) ) {
187
  $args['post__in'] = $products_incl;
@@ -192,7 +192,7 @@ class WCJ_Global_Discount extends WCJ_Module {
192
  }
193
 
194
  // Scope
195
- $scope = get_option( 'wcj_global_discount_sale_product_scope_' . $i, 'all' );
196
  if ( 'all' != $scope ) {
197
  $wc_sale_products = wc_get_product_ids_on_sale();
198
  if ( 'only_on_sale' == $scope ) {
@@ -276,12 +276,12 @@ class WCJ_Global_Discount extends WCJ_Module {
276
  if ( '' === $price ) {
277
  return $price;
278
  }
279
- $return_price = ( 'percent' === get_option( 'wcj_global_discount_sale_coefficient_type_' . $group, 'percent' ) ) ?
280
  ( $price + $price * ( $coefficient / 100 ) ) :
281
  ( $price + $coefficient );
282
  $return_price = ( $return_price >= 0 ? $return_price : 0 );
283
- if ( 'none' != ( $final_correction_function = get_option( 'wcj_global_discount_sale_final_correction_func_' . $group, 'none' ) ) ) {
284
- $final_correction_coef = get_option( 'wcj_global_discount_sale_final_correction_coef_' . $group, 1 );
285
  $return_price = $final_correction_function( $return_price / $final_correction_coef ) * $final_correction_coef;
286
  }
287
  return $return_price;
@@ -295,7 +295,7 @@ class WCJ_Global_Discount extends WCJ_Module {
295
  * @return bool
296
  */
297
  function check_if_applicable( $_product, $group ) {
298
- return ( 'yes' === get_option( 'wcj_global_discount_sale_enabled_' . $group, 'yes' ) && $this->is_enabled_for_product( $_product, $group ) );
299
  }
300
 
301
  /**
@@ -307,12 +307,12 @@ class WCJ_Global_Discount extends WCJ_Module {
307
  function is_enabled_for_product( $_product, $group ) {
308
  $product_id = wcj_get_product_id_or_variation_parent_id( $_product );
309
  return wcj_is_enabled_for_product( $product_id, array(
310
- 'include_products' => get_option( 'wcj_global_discount_sale_products_incl_' . $group, '' ),
311
- 'exclude_products' => get_option( 'wcj_global_discount_sale_products_excl_' . $group, '' ),
312
- 'include_categories' => get_option( 'wcj_global_discount_sale_categories_incl_' . $group, '' ),
313
- 'exclude_categories' => get_option( 'wcj_global_discount_sale_categories_excl_' . $group, '' ),
314
- 'include_tags' => get_option( 'wcj_global_discount_sale_tags_incl_' . $group, '' ),
315
- 'exclude_tags' => get_option( 'wcj_global_discount_sale_tags_excl_' . $group, '' ),
316
  ) );
317
  }
318
 
@@ -358,14 +358,14 @@ class WCJ_Global_Discount extends WCJ_Module {
358
  if ( 'price' === $price_type && '' === $price ) {
359
  return $price; // no changes
360
  }
361
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_global_discount_groups_total_number', 1 ) );
362
  for ( $i = 1; $i <= $total_number; $i++ ) {
363
  if ( ! $this->check_if_applicable( $_product, $i ) ) {
364
  continue; // no changes by current discount group
365
  }
366
- $coefficient = get_option( 'wcj_global_discount_sale_coefficient_' . $i, 0 );
367
  if ( 0 != $coefficient ) {
368
- if ( ! $this->check_if_applicable_by_product_scope( $_product, $price, $price_type, get_option( 'wcj_global_discount_sale_product_scope_' . $i, 'all' ) ) ) {
369
  continue; // no changes by current discount group
370
  }
371
  if ( 'sale_price' === $price_type && 0 == $price ) {
@@ -388,19 +388,19 @@ class WCJ_Global_Discount extends WCJ_Module {
388
  function get_global_discount_options() {
389
  $options = $this->wcj_global_options;
390
  if ( empty( $options ) ) {
391
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_global_discount_groups_total_number', 1 ) );
392
  $options['total_number'] = $total_number;
393
  for ( $i = 1; $i <= $total_number; $i ++ ) {
394
- $options['enabled'][ $i ] = get_option( 'wcj_global_discount_sale_enabled_' . $i, 'yes' );
395
- $options['type'][ $i ] = get_option( 'wcj_global_discount_sale_coefficient_type_' . $i, 'percent' );
396
- $options['value'][ $i ] = get_option( 'wcj_global_discount_sale_coefficient_' . $i, 0 );
397
- $options['scope'][ $i ] = get_option( 'wcj_global_discount_sale_product_scope_' . $i, 'all' );
398
- $options['cats_in'][ $i ] = get_option( 'wcj_global_discount_sale_categories_incl_' . $i, array() );
399
- $options['cats_ex'][ $i ] = get_option( 'wcj_global_discount_sale_categories_excl_' . $i, array() );
400
- $options['tags_in'][ $i ] = get_option( 'wcj_global_discount_sale_tags_incl_' . $i, array() );
401
- $options['tags_ex'][ $i ] = get_option( 'wcj_global_discount_sale_tags_excl_' . $i, array() );
402
- $options['products_in'][ $i ] = get_option( 'wcj_global_discount_sale_products_incl_' . $i, array() );
403
- $options['products_ex'][ $i ] = get_option( 'wcj_global_discount_sale_products_excl_' . $i, array() );
404
  }
405
  $this->wcj_global_options = $options;
406
  }
34
 
35
  if ( $this->is_enabled() ) {
36
  $this->price_hooks_priority = wcj_get_module_price_hooks_priority( 'global_discount' );
37
+ if ( 'yes' === wcj_get_option( 'wcj_global_discount_enabled_in_admin', 'no' ) || wcj_is_frontend() ) {
38
  wcj_add_change_price_hooks( $this, $this->price_hooks_priority, false );
39
  }
40
 
59
  function add_wcj_sale_ids_to_products_shortcode( $args, $atts, $type ) {
60
  if (
61
  'sale_products' != $type ||
62
+ 'yes' != wcj_get_option( 'wcj_global_discount_products_shortcode_compatibility', 'no' )
63
  ) {
64
  return $args;
65
  }
77
  */
78
  function regenerate_wcj_sale_products_in_cache() {
79
  if (
80
+ 'yes' != wcj_get_option( 'wcj_global_discount_products_shortcode_compatibility', 'no' ) ||
81
  ! isset( $_REQUEST['page'] ) || 'wc-settings' !== $_REQUEST['page'] ||
82
  ! isset( $_REQUEST['tab'] ) || 'jetpack' !== $_REQUEST['tab'] ||
83
  ! isset( $_REQUEST['wcj-cat'] ) || 'prices_and_currencies' !== $_REQUEST['wcj-cat'] ||
107
  'posts_per_page' => - 1,
108
  'fields' => 'ids',
109
  );
110
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_global_discount_groups_total_number', 1 ) );
111
  for ( $i = 1; $i <= $total_number; $i ++ ) {
112
+ $enabled = wcj_get_option( 'wcj_global_discount_sale_enabled_' . $i, 'yes' );
113
  if ( 'yes' !== $enabled ) {
114
  continue;
115
  }
116
 
117
  // Categories
118
+ $include_cats = wcj_get_option( 'wcj_global_discount_sale_categories_incl_' . $i, array() );
119
+ $exclude_cats = wcj_get_option( 'wcj_global_discount_sale_categories_excl_' . $i, array() );
120
  $cats = array();
121
  if ( ! empty( $include_cats ) || ! empty( $exclude_cats ) ) {
122
  $cats = array(
142
  }
143
 
144
  // Tags
145
+ $include_tags = wcj_get_option( 'wcj_global_discount_sale_tags_incl_' . $i, array() );
146
+ $exclude_tags = wcj_get_option( 'wcj_global_discount_sale_tags_excl_' . $i, array() );
147
  $tags = array();
148
  if ( ! empty( $include_tags ) || ! empty( $exclude_tags ) ) {
149
  $tags = array(
180
  }
181
 
182
  // Products
183
+ $products_incl = wcj_get_option( 'wcj_global_discount_sale_products_incl_' . $i, array() );
184
+ $products_excl = wcj_get_option( 'wcj_global_discount_sale_products_excl_' . $i, array() );
185
  if ( ! empty( $products_incl ) || ! empty( $products_excl ) ) {
186
  if ( ! empty( $products_incl ) ) {
187
  $args['post__in'] = $products_incl;
192
  }
193
 
194
  // Scope
195
+ $scope = wcj_get_option( 'wcj_global_discount_sale_product_scope_' . $i, 'all' );
196
  if ( 'all' != $scope ) {
197
  $wc_sale_products = wc_get_product_ids_on_sale();
198
  if ( 'only_on_sale' == $scope ) {
276
  if ( '' === $price ) {
277
  return $price;
278
  }
279
+ $return_price = ( 'percent' === wcj_get_option( 'wcj_global_discount_sale_coefficient_type_' . $group, 'percent' ) ) ?
280
  ( $price + $price * ( $coefficient / 100 ) ) :
281
  ( $price + $coefficient );
282
  $return_price = ( $return_price >= 0 ? $return_price : 0 );
283
+ if ( 'none' != ( $final_correction_function = wcj_get_option( 'wcj_global_discount_sale_final_correction_func_' . $group, 'none' ) ) ) {
284
+ $final_correction_coef = wcj_get_option( 'wcj_global_discount_sale_final_correction_coef_' . $group, 1 );
285
  $return_price = $final_correction_function( $return_price / $final_correction_coef ) * $final_correction_coef;
286
  }
287
  return $return_price;
295
  * @return bool
296
  */
297
  function check_if_applicable( $_product, $group ) {
298
+ return ( 'yes' === wcj_get_option( 'wcj_global_discount_sale_enabled_' . $group, 'yes' ) && $this->is_enabled_for_product( $_product, $group ) );
299
  }
300
 
301
  /**
307
  function is_enabled_for_product( $_product, $group ) {
308
  $product_id = wcj_get_product_id_or_variation_parent_id( $_product );
309
  return wcj_is_enabled_for_product( $product_id, array(
310
+ 'include_products' => wcj_get_option( 'wcj_global_discount_sale_products_incl_' . $group, '' ),
311
+ 'exclude_products' => wcj_get_option( 'wcj_global_discount_sale_products_excl_' . $group, '' ),
312
+ 'include_categories' => wcj_get_option( 'wcj_global_discount_sale_categories_incl_' . $group, '' ),
313
+ 'exclude_categories' => wcj_get_option( 'wcj_global_discount_sale_categories_excl_' . $group, '' ),
314
+ 'include_tags' => wcj_get_option( 'wcj_global_discount_sale_tags_incl_' . $group, '' ),
315
+ 'exclude_tags' => wcj_get_option( 'wcj_global_discount_sale_tags_excl_' . $group, '' ),
316
  ) );
317
  }
318
 
358
  if ( 'price' === $price_type && '' === $price ) {
359
  return $price; // no changes
360
  }
361
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_global_discount_groups_total_number', 1 ) );
362
  for ( $i = 1; $i <= $total_number; $i++ ) {
363
  if ( ! $this->check_if_applicable( $_product, $i ) ) {
364
  continue; // no changes by current discount group
365
  }
366
+ $coefficient = wcj_get_option( 'wcj_global_discount_sale_coefficient_' . $i, 0 );
367
  if ( 0 != $coefficient ) {
368
+ if ( ! $this->check_if_applicable_by_product_scope( $_product, $price, $price_type, wcj_get_option( 'wcj_global_discount_sale_product_scope_' . $i, 'all' ) ) ) {
369
  continue; // no changes by current discount group
370
  }
371
  if ( 'sale_price' === $price_type && 0 == $price ) {
388
  function get_global_discount_options() {
389
  $options = $this->wcj_global_options;
390
  if ( empty( $options ) ) {
391
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_global_discount_groups_total_number', 1 ) );
392
  $options['total_number'] = $total_number;
393
  for ( $i = 1; $i <= $total_number; $i ++ ) {
394
+ $options['enabled'][ $i ] = wcj_get_option( 'wcj_global_discount_sale_enabled_' . $i, 'yes' );
395
+ $options['type'][ $i ] = wcj_get_option( 'wcj_global_discount_sale_coefficient_type_' . $i, 'percent' );
396
+ $options['value'][ $i ] = wcj_get_option( 'wcj_global_discount_sale_coefficient_' . $i, 0 );
397
+ $options['scope'][ $i ] = wcj_get_option( 'wcj_global_discount_sale_product_scope_' . $i, 'all' );
398
+ $options['cats_in'][ $i ] = wcj_get_option( 'wcj_global_discount_sale_categories_incl_' . $i, array() );
399
+ $options['cats_ex'][ $i ] = wcj_get_option( 'wcj_global_discount_sale_categories_excl_' . $i, array() );
400
+ $options['tags_in'][ $i ] = wcj_get_option( 'wcj_global_discount_sale_tags_incl_' . $i, array() );
401
+ $options['tags_ex'][ $i ] = wcj_get_option( 'wcj_global_discount_sale_tags_excl_' . $i, array() );
402
+ $options['products_in'][ $i ] = wcj_get_option( 'wcj_global_discount_sale_products_incl_' . $i, array() );
403
+ $options['products_ex'][ $i ] = wcj_get_option( 'wcj_global_discount_sale_products_excl_' . $i, array() );
404
  }
405
  $this->wcj_global_options = $options;
406
  }
includes/class-wcj-left-to-free-shipping.php CHANGED
@@ -28,21 +28,21 @@ class WCJ_Left_To_Free_Shipping extends WCJ_Module {
28
  parent::__construct();
29
 
30
  if ( $this->is_enabled() ) {
31
- if ( 'yes' === get_option( 'wcj_shipping_left_to_free_info_enabled_cart', 'no' ) ) {
32
  add_action(
33
  get_option( 'wcj_shipping_left_to_free_info_position_cart', 'woocommerce_after_cart_totals' ),
34
  array( $this, 'show_left_to_free_shipping_info_cart' ),
35
  get_option( 'wcj_shipping_left_to_free_info_priority_cart', 10 )
36
  );
37
  }
38
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_shipping_left_to_free_info_enabled_mini_cart', 'no' ) ) ) {
39
  add_action(
40
  get_option( 'wcj_shipping_left_to_free_info_position_mini_cart', 'woocommerce_after_mini_cart' ),
41
  array( $this, 'show_left_to_free_shipping_info_mini_cart' ),
42
  get_option( 'wcj_shipping_left_to_free_info_priority_mini_cart', 10 )
43
  );
44
  }
45
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_shipping_left_to_free_info_enabled_checkout', 'no' ) ) ) {
46
  add_action(
47
  get_option( 'wcj_shipping_left_to_free_info_position_checkout', 'woocommerce_checkout_after_order_review' ),
48
  array( $this, 'show_left_to_free_shipping_info_checkout' ),
@@ -59,7 +59,7 @@ class WCJ_Left_To_Free_Shipping extends WCJ_Module {
59
  * @since 2.4.4
60
  */
61
  function show_left_to_free_shipping_info_checkout() {
62
- $this->show_left_to_free_shipping_info( do_shortcode( get_option( 'wcj_shipping_left_to_free_info_content_checkout', __( '%left_to_free% left to free shipping', 'woocommerce-jetpack' ) ) ) );
63
  }
64
 
65
  /**
@@ -69,7 +69,7 @@ class WCJ_Left_To_Free_Shipping extends WCJ_Module {
69
  * @since 2.4.4
70
  */
71
  function show_left_to_free_shipping_info_mini_cart() {
72
- $this->show_left_to_free_shipping_info( do_shortcode( get_option( 'wcj_shipping_left_to_free_info_content_mini_cart', __( '%left_to_free% left to free shipping', 'woocommerce-jetpack' ) ) ) );
73
  }
74
 
75
  /**
@@ -79,7 +79,7 @@ class WCJ_Left_To_Free_Shipping extends WCJ_Module {
79
  * @since 2.4.4
80
  */
81
  function show_left_to_free_shipping_info_cart() {
82
- $this->show_left_to_free_shipping_info( do_shortcode( get_option( 'wcj_shipping_left_to_free_info_content_cart', __( '%left_to_free% left to free shipping', 'woocommerce-jetpack' ) ) ) );
83
  }
84
 
85
  /**
28
  parent::__construct();
29
 
30
  if ( $this->is_enabled() ) {
31
+ if ( 'yes' === wcj_get_option( 'wcj_shipping_left_to_free_info_enabled_cart', 'no' ) ) {
32
  add_action(
33
  get_option( 'wcj_shipping_left_to_free_info_position_cart', 'woocommerce_after_cart_totals' ),
34
  array( $this, 'show_left_to_free_shipping_info_cart' ),
35
  get_option( 'wcj_shipping_left_to_free_info_priority_cart', 10 )
36
  );
37
  }
38
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_shipping_left_to_free_info_enabled_mini_cart', 'no' ) ) ) {
39
  add_action(
40
  get_option( 'wcj_shipping_left_to_free_info_position_mini_cart', 'woocommerce_after_mini_cart' ),
41
  array( $this, 'show_left_to_free_shipping_info_mini_cart' ),
42
  get_option( 'wcj_shipping_left_to_free_info_priority_mini_cart', 10 )
43
  );
44
  }
45
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_shipping_left_to_free_info_enabled_checkout', 'no' ) ) ) {
46
  add_action(
47
  get_option( 'wcj_shipping_left_to_free_info_position_checkout', 'woocommerce_checkout_after_order_review' ),
48
  array( $this, 'show_left_to_free_shipping_info_checkout' ),
59
  * @since 2.4.4
60
  */
61
  function show_left_to_free_shipping_info_checkout() {
62
+ $this->show_left_to_free_shipping_info( do_shortcode( wcj_get_option( 'wcj_shipping_left_to_free_info_content_checkout', __( '%left_to_free% left to free shipping', 'woocommerce-jetpack' ) ) ) );
63
  }
64
 
65
  /**
69
  * @since 2.4.4
70
  */
71
  function show_left_to_free_shipping_info_mini_cart() {
72
+ $this->show_left_to_free_shipping_info( do_shortcode( wcj_get_option( 'wcj_shipping_left_to_free_info_content_mini_cart', __( '%left_to_free% left to free shipping', 'woocommerce-jetpack' ) ) ) );
73
  }
74
 
75
  /**
79
  * @since 2.4.4
80
  */
81
  function show_left_to_free_shipping_info_cart() {
82
+ $this->show_left_to_free_shipping_info( do_shortcode( wcj_get_option( 'wcj_shipping_left_to_free_info_content_cart', __( '%left_to_free% left to free shipping', 'woocommerce-jetpack' ) ) ) );
83
  }
84
 
85
  /**
includes/class-wcj-max-products-per-user.php CHANGED
@@ -35,21 +35,21 @@ class WCJ_Max_products_Per_User extends WCJ_Module {
35
  parent::__construct();
36
 
37
  if ( $this->is_enabled() ) {
38
- if ( 'yes' === get_option( 'wcj_max_products_per_user_global_enabled', 'no' ) || 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_max_products_per_user_local_enabled', 'no' ) ) ) {
39
  add_action( 'woocommerce_checkout_process', array( $this, 'check_cart_quantities' ), PHP_INT_MAX );
40
  add_action( 'woocommerce_before_cart', array( $this, 'check_cart_quantities' ), PHP_INT_MAX );
41
- if ( 'yes' === get_option( 'wcj_max_products_per_user_stop_from_adding_to_cart', 'no' ) ) {
42
  add_filter( 'woocommerce_add_to_cart_validation', array( $this, 'validate_on_add_to_cart' ), PHP_INT_MAX, 3 );
43
  }
44
- if ( 'yes' === get_option( 'wcj_max_products_per_user_stop_from_seeing_checkout', 'no' ) ) {
45
  add_action( 'wp', array( $this, 'stop_from_seeing_checkout' ), PHP_INT_MAX );
46
  }
47
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_max_products_per_user_local_enabled', 'no' ) ) ) {
48
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
49
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
50
  }
51
  }
52
- $this->order_status = get_option( 'wcj_max_products_per_user_order_status', array( 'wc-completed' ) );
53
  if ( empty( $this->order_status ) ) {
54
  $this->order_status = array( 'wc-completed' );
55
  }
@@ -110,7 +110,7 @@ class WCJ_Max_products_Per_User extends WCJ_Module {
110
  '%qty_already_bought%' => $user_already_bought,
111
  '%remaining_qty%' => max( ( $max_qty - $user_already_bought ), 0 ),
112
  );
113
- $message = get_option( 'wcj_max_products_per_user_message',
114
  __( 'You can only buy maximum %max_qty% pcs. of %product_title% (you already bought %qty_already_bought% pcs.).', 'woocommerce-jetpack' ) );
115
  $message = str_replace( array_keys( $replaced_values ), $replaced_values, $message );
116
  wc_add_notice( $message, 'error' );
@@ -256,10 +256,10 @@ class WCJ_Max_products_Per_User extends WCJ_Module {
256
  * @todo (maybe) per user and/or per user role (both global and local)
257
  */
258
  function get_max_qty( $product_id ) {
259
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_max_products_per_user_local_enabled', 'no' ) ) && 0 != ( $qty = get_post_meta( $product_id, '_' . 'wcj_max_products_per_user_qty', true ) ) ) {
260
  return $qty;
261
- } elseif ( 'yes' === get_option( 'wcj_max_products_per_user_global_enabled', 'no' ) ) {
262
- return get_option( 'wcj_max_products_per_user_global_max_qty', 1 );
263
  } else {
264
  return 0;
265
  }
@@ -329,7 +329,7 @@ class WCJ_Max_products_Per_User extends WCJ_Module {
329
  '%qty_already_bought%' => $user_already_bought,
330
  '%remaining_qty%' => max( ( $max_qty - $user_already_bought ), 0 ),
331
  );
332
- $message = get_option( 'wcj_max_products_per_user_message',
333
  __( 'You can only buy maximum %max_qty% pcs. of %product_title% (you already bought %qty_already_bought% pcs.).', 'woocommerce-jetpack' ) );
334
  $message = str_replace( array_keys( $replaced_values ), $replaced_values, $message );
335
  if ( $is_cart ) {
35
  parent::__construct();
36
 
37
  if ( $this->is_enabled() ) {
38
+ if ( 'yes' === wcj_get_option( 'wcj_max_products_per_user_global_enabled', 'no' ) || 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_max_products_per_user_local_enabled', 'no' ) ) ) {
39
  add_action( 'woocommerce_checkout_process', array( $this, 'check_cart_quantities' ), PHP_INT_MAX );
40
  add_action( 'woocommerce_before_cart', array( $this, 'check_cart_quantities' ), PHP_INT_MAX );
41
+ if ( 'yes' === wcj_get_option( 'wcj_max_products_per_user_stop_from_adding_to_cart', 'no' ) ) {
42
  add_filter( 'woocommerce_add_to_cart_validation', array( $this, 'validate_on_add_to_cart' ), PHP_INT_MAX, 3 );
43
  }
44
+ if ( 'yes' === wcj_get_option( 'wcj_max_products_per_user_stop_from_seeing_checkout', 'no' ) ) {
45
  add_action( 'wp', array( $this, 'stop_from_seeing_checkout' ), PHP_INT_MAX );
46
  }
47
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_max_products_per_user_local_enabled', 'no' ) ) ) {
48
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
49
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
50
  }
51
  }
52
+ $this->order_status = wcj_get_option( 'wcj_max_products_per_user_order_status', array( 'wc-completed' ) );
53
  if ( empty( $this->order_status ) ) {
54
  $this->order_status = array( 'wc-completed' );
55
  }
110
  '%qty_already_bought%' => $user_already_bought,
111
  '%remaining_qty%' => max( ( $max_qty - $user_already_bought ), 0 ),
112
  );
113
+ $message = wcj_get_option( 'wcj_max_products_per_user_message',
114
  __( 'You can only buy maximum %max_qty% pcs. of %product_title% (you already bought %qty_already_bought% pcs.).', 'woocommerce-jetpack' ) );
115
  $message = str_replace( array_keys( $replaced_values ), $replaced_values, $message );
116
  wc_add_notice( $message, 'error' );
256
  * @todo (maybe) per user and/or per user role (both global and local)
257
  */
258
  function get_max_qty( $product_id ) {
259
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_max_products_per_user_local_enabled', 'no' ) ) && 0 != ( $qty = get_post_meta( $product_id, '_' . 'wcj_max_products_per_user_qty', true ) ) ) {
260
  return $qty;
261
+ } elseif ( 'yes' === wcj_get_option( 'wcj_max_products_per_user_global_enabled', 'no' ) ) {
262
+ return wcj_get_option( 'wcj_max_products_per_user_global_max_qty', 1 );
263
  } else {
264
  return 0;
265
  }
329
  '%qty_already_bought%' => $user_already_bought,
330
  '%remaining_qty%' => max( ( $max_qty - $user_already_bought ), 0 ),
331
  );
332
+ $message = wcj_get_option( 'wcj_max_products_per_user_message',
333
  __( 'You can only buy maximum %max_qty% pcs. of %product_title% (you already bought %qty_already_bought% pcs.).', 'woocommerce-jetpack' ) );
334
  $message = str_replace( array_keys( $replaced_values ), $replaced_values, $message );
335
  if ( $is_cart ) {
includes/class-wcj-mini-cart.php CHANGED
@@ -28,7 +28,7 @@ class WCJ_Mini_Cart extends WCJ_Module {
28
  parent::__construct();
29
 
30
  if ( $this->is_enabled() ) {
31
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_mini_cart_custom_info_total_number', 1 ) );
32
  for ( $i = 1; $i <= $total_number; $i++ ) {
33
  add_action(
34
  get_option( 'wcj_mini_cart_custom_info_hook_' . $i, 'woocommerce_after_mini_cart' ),
@@ -47,14 +47,14 @@ class WCJ_Mini_Cart extends WCJ_Module {
47
  function add_mini_cart_custom_info() {
48
  $current_filter = current_filter();
49
  $current_filter_priority = wcj_current_filter_priority();
50
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_mini_cart_custom_info_total_number', 1 ) );
51
  for ( $i = 1; $i <= $total_number; $i++ ) {
52
  if (
53
- '' != get_option( 'wcj_mini_cart_custom_info_content_' . $i ) &&
54
- $current_filter === get_option( 'wcj_mini_cart_custom_info_hook_' . $i, 'woocommerce_after_mini_cart' ) &&
55
- $current_filter_priority == get_option( 'wcj_mini_cart_custom_info_priority_' . $i, 10 )
56
  ) {
57
- echo do_shortcode( get_option( 'wcj_mini_cart_custom_info_content_' . $i ) );
58
  }
59
  }
60
  }
28
  parent::__construct();
29
 
30
  if ( $this->is_enabled() ) {
31
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_mini_cart_custom_info_total_number', 1 ) );
32
  for ( $i = 1; $i <= $total_number; $i++ ) {
33
  add_action(
34
  get_option( 'wcj_mini_cart_custom_info_hook_' . $i, 'woocommerce_after_mini_cart' ),
47
  function add_mini_cart_custom_info() {
48
  $current_filter = current_filter();
49
  $current_filter_priority = wcj_current_filter_priority();
50
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_mini_cart_custom_info_total_number', 1 ) );
51
  for ( $i = 1; $i <= $total_number; $i++ ) {
52
  if (
53
+ '' != wcj_get_option( 'wcj_mini_cart_custom_info_content_' . $i ) &&
54
+ $current_filter === wcj_get_option( 'wcj_mini_cart_custom_info_hook_' . $i, 'woocommerce_after_mini_cart' ) &&
55
+ $current_filter_priority == wcj_get_option( 'wcj_mini_cart_custom_info_priority_' . $i, 10 )
56
  ) {
57
+ echo do_shortcode( wcj_get_option( 'wcj_mini_cart_custom_info_content_' . $i ) );
58
  }
59
  }
60
  }
includes/class-wcj-more-button-labels.php CHANGED
@@ -28,7 +28,7 @@ class WCJ_More_Button_Labels extends WCJ_Module {
28
 
29
  if ( $this->is_enabled() ) {
30
  add_filter( 'woocommerce_order_button_text', array( $this, 'set_order_button_text' ), PHP_INT_MAX );
31
- if ( 'yes' === get_option( 'wcj_checkout_place_order_button_override', 'no' ) ) {
32
  add_action( 'init', array( $this, 'override_order_button_text' ), PHP_INT_MAX );
33
  }
34
  }
@@ -54,7 +54,7 @@ class WCJ_More_Button_Labels extends WCJ_Module {
54
  * @version 2.8.0
55
  */
56
  function set_order_button_text( $current_text ) {
57
- return ( '' != ( $new_text = get_option( 'wcj_checkout_place_order_button_text', '' ) ) ) ? $new_text : $current_text;
58
  }
59
 
60
  }
28
 
29
  if ( $this->is_enabled() ) {
30
  add_filter( 'woocommerce_order_button_text', array( $this, 'set_order_button_text' ), PHP_INT_MAX );
31
+ if ( 'yes' === wcj_get_option( 'wcj_checkout_place_order_button_override', 'no' ) ) {
32
  add_action( 'init', array( $this, 'override_order_button_text' ), PHP_INT_MAX );
33
  }
34
  }
54
  * @version 2.8.0
55
  */
56
  function set_order_button_text( $current_text ) {
57
+ return ( '' != ( $new_text = wcj_get_option( 'wcj_checkout_place_order_button_text', '' ) ) ) ? $new_text : $current_text;
58
  }
59
 
60
  }
includes/class-wcj-multicurrency-product-base-price.php CHANGED
@@ -34,7 +34,7 @@ if ( ! class_exists( 'WCJ_Multicurrency_Base_Price' ) ) :
34
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
35
  add_filter( 'woocommerce_currency_symbol', array( $this, 'change_currency_symbol_on_product_edit' ), PHP_INT_MAX, 2 );
36
 
37
- $this->do_convert_in_back_end = ( 'yes' === get_option( 'wcj_multicurrency_base_price_do_convert_in_back_end', 'no' ) );
38
 
39
  if ( $this->do_convert_in_back_end || wcj_is_frontend() ) {
40
  $this->price_hooks_priority = wcj_get_module_price_hooks_priority( 'multicurrency_base_price' );
@@ -58,7 +58,7 @@ if ( ! class_exists( 'WCJ_Multicurrency_Base_Price' ) ) :
58
  function handle_wc_price_sorting() {
59
  add_filter( 'woocommerce_get_catalog_ordering_args', function ( $args, $orderby, $order ) {
60
  if (
61
- 'no' === get_option( 'wcj_multicurrency_base_price_comp_wc_price_sorting', 'no' ) ||
62
  is_admin()
63
  ) {
64
  return $args;
@@ -106,7 +106,7 @@ if ( ! class_exists( 'WCJ_Multicurrency_Base_Price' ) ) :
106
  */
107
  function modify_default_price_filter_hook( $query ) {
108
  if (
109
- 'no' === get_option( 'wcj_multicurrency_base_price_advanced_price_filter_comp', 'no' ) ||
110
  ! isset( $_GET['min_price'] ) ||
111
  ! isset( $_GET['max_price'] )
112
  ) {
@@ -157,7 +157,7 @@ if ( ! class_exists( 'WCJ_Multicurrency_Base_Price' ) ) :
157
  }
158
  $current_min_price = isset( $_GET['min_price'] ) ? floatval( wp_unslash( $_GET['min_price'] ) ) : 0; // WPCS: input var ok, CSRF ok.
159
  $current_max_price = isset( $_GET['max_price'] ) ? floatval( wp_unslash( $_GET['max_price'] ) ) : PHP_INT_MAX; // WPCS: input var ok, CSRF ok.
160
- if ( wc_tax_enabled() && 'incl' === get_option( 'woocommerce_tax_display_shop' ) && ! wc_prices_include_tax() ) {
161
  $tax_class = apply_filters( 'woocommerce_price_filter_widget_tax_class', '' ); // Uses standard tax class.
162
  $tax_rates = WC_Tax::get_rates( $tax_class );
163
  if ( $tax_rates ) {
@@ -202,7 +202,7 @@ if ( ! class_exists( 'WCJ_Multicurrency_Base_Price' ) ) :
202
  if (
203
  is_admin() ||
204
  ( ! is_shop() && ! is_product_taxonomy() ) ||
205
- 'no' === get_option( 'wcj_multicurrency_base_price_advanced_price_filter_comp', 'no' )
206
  ) {
207
  return $sql;
208
  }
@@ -255,7 +255,7 @@ if ( ! class_exists( 'WCJ_Multicurrency_Base_Price' ) ) :
255
  */
256
  function update_base_price_meta_on_base_price_currency_update( $meta_id, $object_id, $meta_key ) {
257
  if (
258
- ( 'no' === get_option( 'wcj_multicurrency_base_price_advanced_price_filter_comp' ) && 'no' === get_option( 'wcj_multicurrency_base_price_comp_wc_price_sorting', 'no' ) ) ||
259
  ! function_exists( 'wc_get_product' ) ||
260
  '_wcj_multicurrency_base_price_currency' !== $meta_key ||
261
  ! is_a( $product = wc_get_product( $object_id ), 'WC_Product' )
@@ -277,7 +277,7 @@ if ( ! class_exists( 'WCJ_Multicurrency_Base_Price' ) ) :
277
  */
278
  function update_base_price_meta_on_price_update( $meta_id, $object_id, $meta_key ){
279
  if (
280
- ( 'no' === get_option( 'wcj_multicurrency_base_price_advanced_price_filter_comp' ) && 'no' === get_option( 'wcj_multicurrency_base_price_comp_wc_price_sorting', 'no' ) ) ||
281
  ! function_exists( 'wc_get_product' ) ||
282
  '_price' !== $meta_key ||
283
  ! is_a( $product = wc_get_product( $object_id ), 'WC_Product' )
@@ -299,13 +299,13 @@ if ( ! class_exists( 'WCJ_Multicurrency_Base_Price' ) ) :
299
  */
300
  function update_products_base_price_on_exchange_rate_change( $option_name, $old_value, $option_value ){
301
  if (
302
- ( 'no' === get_option( 'wcj_multicurrency_base_price_advanced_price_filter_comp' ) && 'no' === get_option( 'wcj_multicurrency_base_price_comp_wc_price_sorting', 'no' ) ) ||
303
  false === strpos( $option_name, 'wcj_multicurrency_base_price_exchange_rate_' )
304
  ) {
305
  return;
306
  }
307
  $currency_number = substr( $option_name, strrpos( $option_name, '_' ) + 1 );
308
- $currency = get_option( 'wcj_multicurrency_base_price_currency_' . $currency_number );
309
  $the_query = $this->get_products_by_base_price_currency( '=', $currency );
310
  if ( $the_query->have_posts() ) {
311
  foreach ( $the_query->posts as $post_id ) {
@@ -328,14 +328,14 @@ if ( ! class_exists( 'WCJ_Multicurrency_Base_Price' ) ) :
328
  */
329
  function handle_price_filter_compatibility_flag_on_base_price_currency_update( $meta_id, $object_id, $meta_key, $meta_value ) {
330
  if (
331
- 'no' === get_option( 'wcj_multicurrency_base_price_advanced_price_filter_comp', 'no' ) ||
332
  ! function_exists( 'wc_get_product' ) ||
333
  '_wcj_multicurrency_base_price_currency' !== $meta_key ||
334
  ! is_a( $product = wc_get_product( $object_id ), 'WC_Product' )
335
  ) {
336
  return;
337
  }
338
- if ( $meta_value === get_option( 'woocommerce_currency' ) ) {
339
  delete_post_meta( $product->get_id(), '_wcj_multicurrency_base_price_comp_pf' );
340
  } else {
341
  update_post_meta( $product->get_id(), '_wcj_multicurrency_base_price_comp_pf', true );
@@ -355,7 +355,7 @@ if ( ! class_exists( 'WCJ_Multicurrency_Base_Price' ) ) :
355
  */
356
  function handle_price_filter_compatibility_flag_on_base_price_update( $meta_id, $object_id, $meta_key, $meta_value ) {
357
  if (
358
- 'no' === get_option( 'wcj_multicurrency_base_price_advanced_price_filter_comp', 'no' ) ||
359
  ! function_exists( 'wc_get_product' ) ||
360
  '_wcj_multicurrency_base_price' !== $meta_key ||
361
  ! is_a( $product = wc_get_product( $object_id ), 'WC_Product' )
@@ -382,7 +382,7 @@ if ( ! class_exists( 'WCJ_Multicurrency_Base_Price' ) ) :
382
  */
383
  function get_products_by_base_price_currency( $compare = '=', $currency = '' ) {
384
  if ( empty( $currency ) ) {
385
- $currency = get_option( 'woocommerce_currency' );
386
  }
387
  $args = array(
388
  'post_type' => 'product',
@@ -469,9 +469,9 @@ if ( ! class_exists( 'WCJ_Multicurrency_Base_Price' ) ) :
469
  $price_hash['wcj_multicurrency_base_price'] = array(
470
  'currency' => $multicurrency_base_price_currency,
471
  'exchange_rate' => wcj_get_currency_exchange_rate_product_base_currency( $multicurrency_base_price_currency ),
472
- 'rounding' => get_option( 'wcj_multicurrency_base_price_round_enabled', 'no' ),
473
- 'rounding_precision' => get_option( 'wcj_multicurrency_base_price_round_precision', get_option( 'woocommerce_price_num_decimals' ) ),
474
- 'save_prices' => get_option( 'wcj_multicurrency_base_price_save_prices', 'no' ),
475
  );
476
  return $price_hash;
477
  }
34
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
35
  add_filter( 'woocommerce_currency_symbol', array( $this, 'change_currency_symbol_on_product_edit' ), PHP_INT_MAX, 2 );
36
 
37
+ $this->do_convert_in_back_end = ( 'yes' === wcj_get_option( 'wcj_multicurrency_base_price_do_convert_in_back_end', 'no' ) );
38
 
39
  if ( $this->do_convert_in_back_end || wcj_is_frontend() ) {
40
  $this->price_hooks_priority = wcj_get_module_price_hooks_priority( 'multicurrency_base_price' );
58
  function handle_wc_price_sorting() {
59
  add_filter( 'woocommerce_get_catalog_ordering_args', function ( $args, $orderby, $order ) {
60
  if (
61
+ 'no' === wcj_get_option( 'wcj_multicurrency_base_price_comp_wc_price_sorting', 'no' ) ||
62
  is_admin()
63
  ) {
64
  return $args;
106
  */
107
  function modify_default_price_filter_hook( $query ) {
108
  if (
109
+ 'no' === wcj_get_option( 'wcj_multicurrency_base_price_advanced_price_filter_comp', 'no' ) ||
110
  ! isset( $_GET['min_price'] ) ||
111
  ! isset( $_GET['max_price'] )
112
  ) {
157
  }
158
  $current_min_price = isset( $_GET['min_price'] ) ? floatval( wp_unslash( $_GET['min_price'] ) ) : 0; // WPCS: input var ok, CSRF ok.
159
  $current_max_price = isset( $_GET['max_price'] ) ? floatval( wp_unslash( $_GET['max_price'] ) ) : PHP_INT_MAX; // WPCS: input var ok, CSRF ok.
160
+ if ( wc_tax_enabled() && 'incl' === wcj_get_option( 'woocommerce_tax_display_shop' ) && ! wc_prices_include_tax() ) {
161
  $tax_class = apply_filters( 'woocommerce_price_filter_widget_tax_class', '' ); // Uses standard tax class.
162
  $tax_rates = WC_Tax::get_rates( $tax_class );
163
  if ( $tax_rates ) {
202
  if (
203
  is_admin() ||
204
  ( ! is_shop() && ! is_product_taxonomy() ) ||
205
+ 'no' === wcj_get_option( 'wcj_multicurrency_base_price_advanced_price_filter_comp', 'no' )
206
  ) {
207
  return $sql;
208
  }
255
  */
256
  function update_base_price_meta_on_base_price_currency_update( $meta_id, $object_id, $meta_key ) {
257
  if (
258
+ ( 'no' === wcj_get_option( 'wcj_multicurrency_base_price_advanced_price_filter_comp' ) && 'no' === wcj_get_option( 'wcj_multicurrency_base_price_comp_wc_price_sorting', 'no' ) ) ||
259
  ! function_exists( 'wc_get_product' ) ||
260
  '_wcj_multicurrency_base_price_currency' !== $meta_key ||
261
  ! is_a( $product = wc_get_product( $object_id ), 'WC_Product' )
277
  */
278
  function update_base_price_meta_on_price_update( $meta_id, $object_id, $meta_key ){
279
  if (
280
+ ( 'no' === wcj_get_option( 'wcj_multicurrency_base_price_advanced_price_filter_comp' ) && 'no' === wcj_get_option( 'wcj_multicurrency_base_price_comp_wc_price_sorting', 'no' ) ) ||
281
  ! function_exists( 'wc_get_product' ) ||
282
  '_price' !== $meta_key ||
283
  ! is_a( $product = wc_get_product( $object_id ), 'WC_Product' )
299
  */
300
  function update_products_base_price_on_exchange_rate_change( $option_name, $old_value, $option_value ){
301
  if (
302
+ ( 'no' === wcj_get_option( 'wcj_multicurrency_base_price_advanced_price_filter_comp' ) && 'no' === wcj_get_option( 'wcj_multicurrency_base_price_comp_wc_price_sorting', 'no' ) ) ||
303
  false === strpos( $option_name, 'wcj_multicurrency_base_price_exchange_rate_' )
304
  ) {
305
  return;
306
  }
307
  $currency_number = substr( $option_name, strrpos( $option_name, '_' ) + 1 );
308
+ $currency = wcj_get_option( 'wcj_multicurrency_base_price_currency_' . $currency_number );
309
  $the_query = $this->get_products_by_base_price_currency( '=', $currency );
310
  if ( $the_query->have_posts() ) {
311
  foreach ( $the_query->posts as $post_id ) {
328
  */
329
  function handle_price_filter_compatibility_flag_on_base_price_currency_update( $meta_id, $object_id, $meta_key, $meta_value ) {
330
  if (
331
+ 'no' === wcj_get_option( 'wcj_multicurrency_base_price_advanced_price_filter_comp', 'no' ) ||
332
  ! function_exists( 'wc_get_product' ) ||
333
  '_wcj_multicurrency_base_price_currency' !== $meta_key ||
334
  ! is_a( $product = wc_get_product( $object_id ), 'WC_Product' )
335
  ) {
336
  return;
337
  }
338
+ if ( $meta_value === wcj_get_option( 'woocommerce_currency' ) ) {
339
  delete_post_meta( $product->get_id(), '_wcj_multicurrency_base_price_comp_pf' );
340
  } else {
341
  update_post_meta( $product->get_id(), '_wcj_multicurrency_base_price_comp_pf', true );
355
  */
356
  function handle_price_filter_compatibility_flag_on_base_price_update( $meta_id, $object_id, $meta_key, $meta_value ) {
357
  if (
358
+ 'no' === wcj_get_option( 'wcj_multicurrency_base_price_advanced_price_filter_comp', 'no' ) ||
359
  ! function_exists( 'wc_get_product' ) ||
360
  '_wcj_multicurrency_base_price' !== $meta_key ||
361
  ! is_a( $product = wc_get_product( $object_id ), 'WC_Product' )
382
  */
383
  function get_products_by_base_price_currency( $compare = '=', $currency = '' ) {
384
  if ( empty( $currency ) ) {
385
+ $currency = wcj_get_option( 'woocommerce_currency' );
386
  }
387
  $args = array(
388
  'post_type' => 'product',
469
  $price_hash['wcj_multicurrency_base_price'] = array(
470
  'currency' => $multicurrency_base_price_currency,
471
  'exchange_rate' => wcj_get_currency_exchange_rate_product_base_currency( $multicurrency_base_price_currency ),
472
+ 'rounding' => wcj_get_option( 'wcj_multicurrency_base_price_round_enabled', 'no' ),
473
+ 'rounding_precision' => wcj_get_option( 'wcj_multicurrency_base_price_round_precision', wcj_get_option( 'woocommerce_price_num_decimals' ) ),
474
+ 'save_prices' => wcj_get_option( 'wcj_multicurrency_base_price_save_prices', 'no' ),
475
  );
476
  return $price_hash;
477
  }
includes/class-wcj-multicurrency.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Module - Multicurrency (Currency Switcher)
4
  *
5
- * @version 5.2.0
6
  * @since 2.4.3
7
  * @author Pluggabl LLC.
8
  */
@@ -59,7 +59,7 @@ class WCJ_Multicurrency extends WCJ_Module {
59
 
60
  $this->add_hooks();
61
 
62
- if ( 'yes' === get_option( 'wcj_multicurrency_per_product_enabled' , 'yes' ) ) {
63
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
64
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
65
  }
@@ -83,21 +83,21 @@ class WCJ_Multicurrency extends WCJ_Module {
83
  * @since 4.5.0
84
  */
85
  function init_bkg_process_class() {
86
- if ( 'yes' === get_option( 'wcj_multicurrency_update_prices_on_exch_update', 'no' ) ) {
87
  require_once( wcj_plugin_path() . '/includes/background-process/class-wcj-multicurrency-price-updater.php' );
88
  $this->bkg_process_price_updater = new WCJ_Multicurrency_Price_Updater();
89
  }
90
  }
91
 
92
  /**
93
- * Handles third party compatibility
94
  *
95
- * @version 5.2.0
96
  * @since 4.3.0
97
  */
98
  function handle_compatibility(){
99
  // "WooCommerce Smart Coupons" Compatibility
100
- if ( 'yes' === get_option( 'wcj_multicurrency_compatibility_wc_smart_coupons' , 'yes' ) ) {
101
  add_filter( 'woocommerce_coupon_get_amount', array( $this, 'smart_coupons_get_amount' ), 10, 2 );
102
  }
103
 
@@ -106,7 +106,7 @@ class WCJ_Multicurrency extends WCJ_Module {
106
  add_filter( 'woocommerce_get_shop_coupon_data', array( $this, 'fix_wc_coupon_discount_amount' ), 10, 3 );
107
 
108
  // WooCommerce Price Filter Widget
109
- if ( 'yes' === get_option( 'wcj_multicurrency_compatibility_wc_price_filter' , 'no' ) ) {
110
  add_action( 'wp_footer', array( $this, 'add_compatibility_with_price_filter_widget' ) );
111
  add_action( 'wp_footer', array( $this, 'fix_price_filter_widget_currency_format' ) );
112
  add_filter( 'woocommerce_price_filter_sql', array( $this, 'get_price_filter_sql_compatible' ), 10, 3 );
@@ -118,18 +118,18 @@ class WCJ_Multicurrency extends WCJ_Module {
118
  }
119
 
120
  // Sort by Price
121
- if ( 'yes' === get_option( 'wcj_multicurrency_compatibility_price_sorting_per_product', 'no' ) ) {
122
  add_filter( 'woocommerce_get_catalog_ordering_args', array( $this, 'handle_per_product_opt_with_sort_by_price' ), 29, 3 );
123
  }
124
 
125
  // Fix WooCommerce Import
126
- if ( 'yes' === get_option( 'wcj_multicurrency_compatibility_wc_import' , 'no' ) ) {
127
  add_filter( 'woocommerce_product_importer_parsed_data', array( $this, 'fix_wc_product_import' ), 10, 2 );
128
  }
129
 
130
  // WPC Product Bundles plugin
131
  add_action( 'woocommerce_init', function () {
132
- if ( 'yes' === get_option( 'wcj_multicurrency_compatibility_wpc_product_bundle', 'no' ) ) {
133
  wcj_remove_class_filter( 'woocommerce_add_to_cart', 'WPcleverWoosb', 'woosb_add_to_cart' );
134
  }
135
  }, 99 );
@@ -151,9 +151,38 @@ class WCJ_Multicurrency extends WCJ_Module {
151
  add_filter( 'woocommerce_product_addons_option_price_raw', array( $this, 'product_addons_option_price_raw' ), 10, 2 );
152
  add_filter( 'woocommerce_product_addons_price_raw', array( $this, 'product_addons_price_raw' ), 10, 2 );
153
 
 
 
 
 
154
  //add_filter( 'wdp_get_product_price', array( $this, 'wdp_get_product_price' ) );
155
  }
156
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  /*function wdp_get_product_price( $price, $product, $price_mode, $item_meta ) {
158
  error_log('asd');
159
  if ( $product->is_on_sale( 'edit' ) ) {
@@ -183,7 +212,7 @@ class WCJ_Multicurrency extends WCJ_Module {
183
  */
184
  function product_addons_price_raw( $price, $addon ) {
185
  if (
186
- 'no' === get_option( 'wcj_multicurrency_compatibility_product_addons', 'no' )
187
  || ( 'quantity_based' != $addon['price_type'] && 'flat_fee' != $addon['price_type'] )
188
  ) {
189
  return $price;
@@ -203,7 +232,7 @@ class WCJ_Multicurrency extends WCJ_Module {
203
  * @return mixed
204
  */
205
  function convert_pricing_deals_settings( $option ) {
206
- if ( 'no' === get_option( 'wcj_multicurrency_compatibility_pricing_deals', 'no' ) ) {
207
  return $option;
208
  }
209
  foreach ( $option as $key => $value ) {
@@ -228,7 +257,7 @@ class WCJ_Multicurrency extends WCJ_Module {
228
  function change_currency_by_country( $country, $currency ) {
229
  if (
230
  empty( $currency ) ||
231
- 'no' === get_option( 'wcj_multicurrency_compatibility_price_by_country_module', 'no' )
232
  ) {
233
  return;
234
  }
@@ -245,7 +274,7 @@ class WCJ_Multicurrency extends WCJ_Module {
245
  *
246
  */
247
  function flexible_shipping_compatibility( $value ) {
248
- if ( 'yes' !== get_option( 'wcj_multicurrency_compatibility_flexible_shipping', 'no' ) ) {
249
  return $value;
250
  }
251
  $value *= $this->get_currency_exchange_rate( $this->get_current_currency_code() );
@@ -278,7 +307,7 @@ class WCJ_Multicurrency extends WCJ_Module {
278
  * @return mixed
279
  */
280
  function convert_wc_tree_table_rate_settings( $option ) {
281
- if ( 'no' === get_option( 'wcj_multicurrency_compatibility_wc_ttrs', 'no' ) ) {
282
  return $option;
283
  }
284
  $transition_name = 'wcj_wc_tree_table_opt_' . md5( current_filter() );
@@ -352,7 +381,7 @@ class WCJ_Multicurrency extends WCJ_Module {
352
  * @throws Exception
353
  */
354
  function check_woocommerce_coupon_min_max_amount( $valid, WC_Coupon $coupon, WC_Discounts $wc_discounts ) {
355
- if ( 'yes' !== get_option( 'wcj_multicurrency_compatibility_wc_coupons', 'no' ) ) {
356
  return $valid;
357
  }
358
  remove_filter( 'woocommerce_coupon_is_valid', array( $this, 'check_woocommerce_coupon_min_max_amount' ), 10 );
@@ -383,7 +412,7 @@ class WCJ_Multicurrency extends WCJ_Module {
383
  */
384
  function fix_wc_coupon_discount_amount( $false, $data, $coupon ) {
385
  if (
386
- 'yes' !== get_option( 'wcj_multicurrency_compatibility_wc_coupons', 'no' ) ||
387
  is_admin() ||
388
  empty( $coupon_id = wc_get_coupon_id_by_code( $data ) ) ||
389
  'fixed_cart' != get_post_meta( $coupon_id, 'discount_type', true )
@@ -412,7 +441,7 @@ class WCJ_Multicurrency extends WCJ_Module {
412
  $orderby != 'price' ||
413
  is_admin() ||
414
  ! is_main_query() ||
415
- 'no' === get_option( 'wcj_multicurrency_per_product_enabled', 'no' ) ||
416
  get_option( 'woocommerce_currency' ) === $this->get_current_currency_code() ||
417
  1 === $this->get_currency_exchange_rate( $this->get_current_currency_code()
418
  )
@@ -466,7 +495,7 @@ class WCJ_Multicurrency extends WCJ_Module {
466
  function posts_clauses_price_filter_compatible( $args, $query ) {
467
  if (
468
  is_admin() ||
469
- 'no' === get_option( 'wcj_multicurrency_per_product_enabled', 'no' ) ||
470
  get_option( 'woocommerce_currency' ) === $this->get_current_currency_code() ||
471
  1 === $this->get_currency_exchange_rate( $this->get_current_currency_code() ) ||
472
  ! isset( $args['where'] ) ||
@@ -512,7 +541,7 @@ class WCJ_Multicurrency extends WCJ_Module {
512
  function get_price_filter_sql_compatible( $sql, $meta_query_sql, $tax_query_sql ) {
513
  if (
514
  is_admin() ||
515
- 'no' === get_option( 'wcj_multicurrency_per_product_enabled', 'no' ) ||
516
  get_option( 'woocommerce_currency' ) === $this->get_current_currency_code() ||
517
  1 === $this->get_currency_exchange_rate( $this->get_current_currency_code() )
518
  ) {
@@ -755,7 +784,7 @@ class WCJ_Multicurrency extends WCJ_Module {
755
  $this->handle_compatibility();
756
 
757
  // Additional Price Filters
758
- $this->additional_price_filters = get_option( 'wcj_multicurrency_switcher_additional_price_filters', '' );
759
  if ( ! empty( $this->additional_price_filters ) ) {
760
  $this->additional_price_filters = array_map( 'trim', explode( PHP_EOL, $this->additional_price_filters ) );
761
  foreach ( $this->additional_price_filters as $additional_price_filter ) {
@@ -768,7 +797,7 @@ class WCJ_Multicurrency extends WCJ_Module {
768
  } else {
769
  // Saves min and max price when product is updated
770
  add_action( 'woocommerce_update_product', function ( $post_id ) {
771
- if ( 'no' === get_option( 'wcj_multicurrency_per_product_enabled', 'yes' ) ) {
772
  return;
773
  }
774
  $this->save_min_max_prices_per_product( $post_id );
@@ -793,14 +822,14 @@ class WCJ_Multicurrency extends WCJ_Module {
793
  */
794
  function update_min_max_prices_on_exchange_rate_change( $option_name, $old_value, $option_value ) {
795
  if (
796
- 'no' === get_option( 'wcj_multicurrency_update_prices_on_exch_update', 'no' ) ||
797
- 'no' === get_option( 'wcj_multicurrency_per_product_enabled', 'yes' ) ||
798
  false === strpos( $option_name, 'wcj_multicurrency_exchange_rate_' )
799
  ) {
800
  return;
801
  }
802
  $currency_number = substr( $option_name, strrpos( $option_name, '_' ) + 1 );
803
- $currency = get_option( 'wcj_multicurrency_currency_' . $currency_number );
804
  $product_ids = $this->get_products_by_per_product_currency( $currency );
805
  if ( is_array( $product_ids ) && count( $product_ids ) > 0 ) {
806
  $this->bkg_process_price_updater->cancel_process();
@@ -823,7 +852,7 @@ class WCJ_Multicurrency extends WCJ_Module {
823
  */
824
  function get_products_by_per_product_currency( $currency ) {
825
  if ( empty( $currency ) ) {
826
- $currency = get_option( 'woocommerce_currency' );
827
  }
828
 
829
  global $wpdb;
@@ -861,14 +890,14 @@ class WCJ_Multicurrency extends WCJ_Module {
861
  $products[ $post_id ] = $product->get_price();
862
  }
863
  if ( empty( $currency_code_param ) ) {
864
- $total_number = apply_filters( 'booster_option', 2, get_option( 'wcj_multicurrency_total_number', 2 ) );
865
  } else {
866
  $total_number = 1;
867
  }
868
 
869
  $per_product_prices = array();
870
  for ( $i = 1; $i <= $total_number; $i ++ ) {
871
- $currency_code = empty( $currency_code_param ) ? get_option( 'wcj_multicurrency_currency_' . $i ) : $currency_code_param;
872
  $exchange_rate = $this->get_currency_exchange_rate( $currency_code );
873
  foreach ( $products as $product_id => $original_price ) {
874
  // Regular Price
@@ -920,16 +949,39 @@ class WCJ_Multicurrency extends WCJ_Module {
920
  /**
921
  * init.
922
  *
923
- * @version 3.4.5
924
  * @since 3.4.5
925
  */
926
  function init() {
927
  wcj_session_maybe_start();
 
 
 
928
  if ( isset( $_REQUEST['wcj-currency'] ) ) {
929
- wcj_session_set( 'wcj-currency', $_REQUEST['wcj-currency'] );
 
 
 
 
 
 
930
  }
931
  }
932
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
933
  /**
934
  * Converts add-ons plugin prices.
935
  *
@@ -942,7 +994,7 @@ class WCJ_Multicurrency extends WCJ_Module {
942
  * @return float|int
943
  */
944
  function product_addons_option_price_raw( $price, $option ) {
945
- if ( 'no' === get_option( 'wcj_multicurrency_compatibility_product_addons', 'no' ) ) {
946
  return $price;
947
  }
948
  $price = $this->change_price( $price, null );
@@ -961,7 +1013,7 @@ class WCJ_Multicurrency extends WCJ_Module {
961
  * @return mixed
962
  */
963
  function get_addons_item_data( $other_data, $cart_item ) {
964
- if ( 'no' === get_option( 'wcj_multicurrency_compatibility_product_addons', 'no' ) ) {
965
  return $other_data;
966
  }
967
  if ( ! empty( $cart_item['addons'] ) ) {
@@ -1036,7 +1088,7 @@ class WCJ_Multicurrency extends WCJ_Module {
1036
  */
1037
  function change_price_grouped( $price, $qty, $_product ) {
1038
  if ( $_product->is_type( 'grouped' ) ) {
1039
- if ( 'yes' === get_option( 'wcj_multicurrency_per_product_enabled' , 'yes' ) ) {
1040
  foreach ( $_product->get_children() as $child_id ) {
1041
  $the_price = get_post_meta( $child_id, '_price', true );
1042
  $the_product = wc_get_product( $child_id );
@@ -1062,10 +1114,10 @@ class WCJ_Multicurrency extends WCJ_Module {
1062
  $price_hash['wcj_multicurrency'] = array(
1063
  'currency' => $currency_code,
1064
  'exchange_rate' => $this->get_currency_exchange_rate( $currency_code ),
1065
- 'per_product' => get_option( 'wcj_multicurrency_per_product_enabled', 'yes' ),
1066
- 'per_product_make_empty' => get_option( 'wcj_multicurrency_per_product_make_empty', 'no' ),
1067
- 'rounding' => get_option( 'wcj_multicurrency_rounding', 'no_round' ),
1068
- 'rounding_precision' => get_option( 'wcj_multicurrency_rounding_precision', absint( get_option( 'woocommerce_price_num_decimals', 2 ) ) ),
1069
  );
1070
  return $price_hash;
1071
  }
@@ -1077,10 +1129,10 @@ class WCJ_Multicurrency extends WCJ_Module {
1077
  */
1078
  function get_currency_exchange_rate( $currency_code ) {
1079
  $currency_exchange_rate = 1;
1080
- $total_number = apply_filters( 'booster_option', 2, get_option( 'wcj_multicurrency_total_number', 2 ) );
1081
  for ( $i = 1; $i <= $total_number; $i++ ) {
1082
- if ( $currency_code === get_option( 'wcj_multicurrency_currency_' . $i ) ) {
1083
- $currency_exchange_rate = get_option( 'wcj_multicurrency_exchange_rate_' . $i );
1084
  break;
1085
  }
1086
  }
@@ -1094,7 +1146,7 @@ class WCJ_Multicurrency extends WCJ_Module {
1094
  * @since 2.5.0
1095
  */
1096
  function do_revert() {
1097
- switch ( get_option( 'wcj_multicurrency_revert', 'no' ) ) {
1098
  case 'cart_only':
1099
  return is_cart();
1100
  case 'yes': // checkout only
@@ -1122,13 +1174,13 @@ class WCJ_Multicurrency extends WCJ_Module {
1122
  /**
1123
  * change_price.
1124
  *
1125
- * @version 5.1.0
1126
  */
1127
- function change_price( $price, $_product ) {
1128
  //Pricing Deals
1129
  global $vtprd_cart;
1130
  if (
1131
- 'yes' === get_option( 'wcj_multicurrency_compatibility_pricing_deals', 'no' ) &&
1132
  ( is_cart() || is_checkout() ) &&
1133
  ! empty( $vtprd_cart )
1134
  ) {
@@ -1143,8 +1195,12 @@ class WCJ_Multicurrency extends WCJ_Module {
1143
  return $price;
1144
  }
1145
 
 
 
 
 
1146
  $_product_id = wcj_get_product_id( $_product );
1147
- $do_save = ( 'yes' === get_option( 'wcj_multicurrency_multicurrency_save_prices', 'no' ) );
1148
  $_current_filter = current_filter();
1149
  if ( '' == $_current_filter ) {
1150
  $_current_filter = 'wcj_filter__none';
@@ -1154,9 +1210,9 @@ class WCJ_Multicurrency extends WCJ_Module {
1154
  }
1155
 
1156
  // Per product
1157
- if ( 'yes' === get_option( 'wcj_multicurrency_per_product_enabled' , 'yes' ) && null != $_product ) {
1158
  if (
1159
- 'yes' === get_option( 'wcj_multicurrency_per_product_make_empty', 'no' ) &&
1160
  'yes' === get_post_meta( $_product_id, '_' . 'wcj_multicurrency_per_product_make_empty_' . $this->get_current_currency_code(), true )
1161
  ) {
1162
  $price = '';
@@ -1192,9 +1248,9 @@ class WCJ_Multicurrency extends WCJ_Module {
1192
  // Global
1193
  if ( 1 != ( $currency_exchange_rate = $this->get_currency_exchange_rate( $this->get_current_currency_code() ) ) ) {
1194
  $price = (float) $price * (float) $currency_exchange_rate;
1195
- switch ( get_option( 'wcj_multicurrency_rounding', 'no_round' ) ) {
1196
  case 'round':
1197
- $price = round( $price, get_option( 'wcj_multicurrency_rounding_precision', absint( get_option( 'woocommerce_price_num_decimals', 2 ) ) ) );
1198
  break;
1199
  case 'round_up':
1200
  $price = ceil( $price );
@@ -1221,11 +1277,11 @@ class WCJ_Multicurrency extends WCJ_Module {
1221
  if ( null !== ( $session_value = wcj_session_get( 'wcj-currency' ) ) ) {
1222
  return $session_value;
1223
  } else {
1224
- $module_roles = get_option( 'wcj_multicurrency_role_defaults_roles', '' );
1225
  if ( ! empty( $module_roles ) ) {
1226
  $current_user_role = wcj_get_current_user_first_role();
1227
  if ( in_array( $current_user_role, $module_roles ) ) {
1228
- $roles_default_currency = get_option( 'wcj_multicurrency_role_defaults_' . $current_user_role, '' );
1229
  if ( '' != $roles_default_currency ) {
1230
  return $roles_default_currency;
1231
  }
@@ -1255,7 +1311,7 @@ class WCJ_Multicurrency extends WCJ_Module {
1255
  function change_price_shipping( $package_rates, $package ) {
1256
  if (
1257
  $this->do_revert() ||
1258
- 'no' === get_option( 'wcj_multicurrency_convert_shipping_values', 'yes' )
1259
  ) {
1260
  return $package_rates;
1261
  }
2
  /**
3
  * Booster for WooCommerce - Module - Multicurrency (Currency Switcher)
4
  *
5
+ * @version 5.3.4
6
  * @since 2.4.3
7
  * @author Pluggabl LLC.
8
  */
59
 
60
  $this->add_hooks();
61
 
62
+ if ( 'yes' === wcj_get_option( 'wcj_multicurrency_per_product_enabled' , 'yes' ) ) {
63
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
64
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
65
  }
83
  * @since 4.5.0
84
  */
85
  function init_bkg_process_class() {
86
+ if ( 'yes' === wcj_get_option( 'wcj_multicurrency_update_prices_on_exch_update', 'no' ) ) {
87
  require_once( wcj_plugin_path() . '/includes/background-process/class-wcj-multicurrency-price-updater.php' );
88
  $this->bkg_process_price_updater = new WCJ_Multicurrency_Price_Updater();
89
  }
90
  }
91
 
92
  /**
93
+ * Handles third party compatibility.
94
  *
95
+ * @version 5.3.3
96
  * @since 4.3.0
97
  */
98
  function handle_compatibility(){
99
  // "WooCommerce Smart Coupons" Compatibility
100
+ if ( 'yes' === wcj_get_option( 'wcj_multicurrency_compatibility_wc_smart_coupons' , 'yes' ) ) {
101
  add_filter( 'woocommerce_coupon_get_amount', array( $this, 'smart_coupons_get_amount' ), 10, 2 );
102
  }
103
 
106
  add_filter( 'woocommerce_get_shop_coupon_data', array( $this, 'fix_wc_coupon_discount_amount' ), 10, 3 );
107
 
108
  // WooCommerce Price Filter Widget
109
+ if ( 'yes' === wcj_get_option( 'wcj_multicurrency_compatibility_wc_price_filter' , 'no' ) ) {
110
  add_action( 'wp_footer', array( $this, 'add_compatibility_with_price_filter_widget' ) );
111
  add_action( 'wp_footer', array( $this, 'fix_price_filter_widget_currency_format' ) );
112
  add_filter( 'woocommerce_price_filter_sql', array( $this, 'get_price_filter_sql_compatible' ), 10, 3 );
118
  }
119
 
120
  // Sort by Price
121
+ if ( 'yes' === wcj_get_option( 'wcj_multicurrency_compatibility_price_sorting_per_product', 'no' ) ) {
122
  add_filter( 'woocommerce_get_catalog_ordering_args', array( $this, 'handle_per_product_opt_with_sort_by_price' ), 29, 3 );
123
  }
124
 
125
  // Fix WooCommerce Import
126
+ if ( 'yes' === wcj_get_option( 'wcj_multicurrency_compatibility_wc_import' , 'no' ) ) {
127
  add_filter( 'woocommerce_product_importer_parsed_data', array( $this, 'fix_wc_product_import' ), 10, 2 );
128
  }
129
 
130
  // WPC Product Bundles plugin
131
  add_action( 'woocommerce_init', function () {
132
+ if ( 'yes' === wcj_get_option( 'wcj_multicurrency_compatibility_wpc_product_bundle', 'no' ) ) {
133
  wcj_remove_class_filter( 'woocommerce_add_to_cart', 'WPcleverWoosb', 'woosb_add_to_cart' );
134
  }
135
  }, 99 );
151
  add_filter( 'woocommerce_product_addons_option_price_raw', array( $this, 'product_addons_option_price_raw' ), 10, 2 );
152
  add_filter( 'woocommerce_product_addons_price_raw', array( $this, 'product_addons_price_raw' ), 10, 2 );
153
 
154
+ // Free Shipping
155
+ add_filter( 'woocommerce_shipping_free_shipping_instance_option', array( $this, 'convert_free_shipping_min_amount' ), 10, 3 );
156
+ add_filter( 'woocommerce_shipping_free_shipping_option', array( $this, 'convert_free_shipping_min_amount' ), 10, 3 );
157
+
158
  //add_filter( 'wdp_get_product_price', array( $this, 'wdp_get_product_price' ) );
159
  }
160
 
161
+ /**
162
+ * convert_free_shipping_min_amount.
163
+ *
164
+ * @version 5.3.3
165
+ * @since 5.3.3
166
+ *
167
+ * @param $option
168
+ * @param $key
169
+ * @param $method
170
+ *
171
+ * @return mixed
172
+ */
173
+ function convert_free_shipping_min_amount( $option, $key, $method ) {
174
+ if (
175
+ 'no' === wcj_get_option( 'wcj_multicurrency_compatibility_free_shipping', 'no' )
176
+ || 'min_amount' !== $key
177
+ || ! is_numeric( $option )
178
+ || 0 === (float) $option
179
+ ) {
180
+ return $option;
181
+ }
182
+ $option = $this->change_price( $option, null );
183
+ return $option;
184
+ }
185
+
186
  /*function wdp_get_product_price( $price, $product, $price_mode, $item_meta ) {
187
  error_log('asd');
188
  if ( $product->is_on_sale( 'edit' ) ) {
212
  */
213
  function product_addons_price_raw( $price, $addon ) {
214
  if (
215
+ 'no' === wcj_get_option( 'wcj_multicurrency_compatibility_product_addons', 'no' )
216
  || ( 'quantity_based' != $addon['price_type'] && 'flat_fee' != $addon['price_type'] )
217
  ) {
218
  return $price;
232
  * @return mixed
233
  */
234
  function convert_pricing_deals_settings( $option ) {
235
+ if ( 'no' === wcj_get_option( 'wcj_multicurrency_compatibility_pricing_deals', 'no' ) ) {
236
  return $option;
237
  }
238
  foreach ( $option as $key => $value ) {
257
  function change_currency_by_country( $country, $currency ) {
258
  if (
259
  empty( $currency ) ||
260
+ 'no' === wcj_get_option( 'wcj_multicurrency_compatibility_price_by_country_module', 'no' )
261
  ) {
262
  return;
263
  }
274
  *
275
  */
276
  function flexible_shipping_compatibility( $value ) {
277
+ if ( 'yes' !== wcj_get_option( 'wcj_multicurrency_compatibility_flexible_shipping', 'no' ) ) {
278
  return $value;
279
  }
280
  $value *= $this->get_currency_exchange_rate( $this->get_current_currency_code() );
307
  * @return mixed
308
  */
309
  function convert_wc_tree_table_rate_settings( $option ) {
310
+ if ( 'no' === wcj_get_option( 'wcj_multicurrency_compatibility_wc_ttrs', 'no' ) ) {
311
  return $option;
312
  }
313
  $transition_name = 'wcj_wc_tree_table_opt_' . md5( current_filter() );
381
  * @throws Exception
382
  */
383
  function check_woocommerce_coupon_min_max_amount( $valid, WC_Coupon $coupon, WC_Discounts $wc_discounts ) {
384
+ if ( 'yes' !== wcj_get_option( 'wcj_multicurrency_compatibility_wc_coupons', 'no' ) ) {
385
  return $valid;
386
  }
387
  remove_filter( 'woocommerce_coupon_is_valid', array( $this, 'check_woocommerce_coupon_min_max_amount' ), 10 );
412
  */
413
  function fix_wc_coupon_discount_amount( $false, $data, $coupon ) {
414
  if (
415
+ 'yes' !== wcj_get_option( 'wcj_multicurrency_compatibility_wc_coupons', 'no' ) ||
416
  is_admin() ||
417
  empty( $coupon_id = wc_get_coupon_id_by_code( $data ) ) ||
418
  'fixed_cart' != get_post_meta( $coupon_id, 'discount_type', true )
441
  $orderby != 'price' ||
442
  is_admin() ||
443
  ! is_main_query() ||
444
+ 'no' === wcj_get_option( 'wcj_multicurrency_per_product_enabled', 'no' ) ||
445
  get_option( 'woocommerce_currency' ) === $this->get_current_currency_code() ||
446
  1 === $this->get_currency_exchange_rate( $this->get_current_currency_code()
447
  )
495
  function posts_clauses_price_filter_compatible( $args, $query ) {
496
  if (
497
  is_admin() ||
498
+ 'no' === wcj_get_option( 'wcj_multicurrency_per_product_enabled', 'no' ) ||
499
  get_option( 'woocommerce_currency' ) === $this->get_current_currency_code() ||
500
  1 === $this->get_currency_exchange_rate( $this->get_current_currency_code() ) ||
501
  ! isset( $args['where'] ) ||
541
  function get_price_filter_sql_compatible( $sql, $meta_query_sql, $tax_query_sql ) {
542
  if (
543
  is_admin() ||
544
+ 'no' === wcj_get_option( 'wcj_multicurrency_per_product_enabled', 'no' ) ||
545
  get_option( 'woocommerce_currency' ) === $this->get_current_currency_code() ||
546
  1 === $this->get_currency_exchange_rate( $this->get_current_currency_code() )
547
  ) {
784
  $this->handle_compatibility();
785
 
786
  // Additional Price Filters
787
+ $this->additional_price_filters = wcj_get_option( 'wcj_multicurrency_switcher_additional_price_filters', '' );
788
  if ( ! empty( $this->additional_price_filters ) ) {
789
  $this->additional_price_filters = array_map( 'trim', explode( PHP_EOL, $this->additional_price_filters ) );
790
  foreach ( $this->additional_price_filters as $additional_price_filter ) {
797
  } else {
798
  // Saves min and max price when product is updated
799
  add_action( 'woocommerce_update_product', function ( $post_id ) {
800
+ if ( 'no' === wcj_get_option( 'wcj_multicurrency_per_product_enabled', 'yes' ) ) {
801
  return;
802
  }
803
  $this->save_min_max_prices_per_product( $post_id );
822
  */
823
  function update_min_max_prices_on_exchange_rate_change( $option_name, $old_value, $option_value ) {
824
  if (
825
+ 'no' === wcj_get_option( 'wcj_multicurrency_update_prices_on_exch_update', 'no' ) ||
826
+ 'no' === wcj_get_option( 'wcj_multicurrency_per_product_enabled', 'yes' ) ||
827
  false === strpos( $option_name, 'wcj_multicurrency_exchange_rate_' )
828
  ) {
829
  return;
830
  }
831
  $currency_number = substr( $option_name, strrpos( $option_name, '_' ) + 1 );
832
+ $currency = wcj_get_option( 'wcj_multicurrency_currency_' . $currency_number );
833
  $product_ids = $this->get_products_by_per_product_currency( $currency );
834
  if ( is_array( $product_ids ) && count( $product_ids ) > 0 ) {
835
  $this->bkg_process_price_updater->cancel_process();
852
  */
853
  function get_products_by_per_product_currency( $currency ) {
854
  if ( empty( $currency ) ) {
855
+ $currency = wcj_get_option( 'woocommerce_currency' );
856
  }
857
 
858
  global $wpdb;
890
  $products[ $post_id ] = $product->get_price();
891
  }
892
  if ( empty( $currency_code_param ) ) {
893
+ $total_number = apply_filters( 'booster_option', 2, wcj_get_option( 'wcj_multicurrency_total_number', 2 ) );
894
  } else {
895
  $total_number = 1;
896
  }
897
 
898
  $per_product_prices = array();
899
  for ( $i = 1; $i <= $total_number; $i ++ ) {
900
+ $currency_code = empty( $currency_code_param ) ? wcj_get_option( 'wcj_multicurrency_currency_' . $i ) : $currency_code_param;
901
  $exchange_rate = $this->get_currency_exchange_rate( $currency_code );
902
  foreach ( $products as $product_id => $original_price ) {
903
  // Regular Price
949
  /**
950
  * init.
951
  *
952
+ * @version 5.3.4
953
  * @since 3.4.5
954
  */
955
  function init() {
956
  wcj_session_maybe_start();
957
+ if ( null == ( $session_value = wcj_session_get( 'wcj-currency' ) ) ) {
958
+ $currency = $this->get_default_currency();
959
+ }
960
  if ( isset( $_REQUEST['wcj-currency'] ) ) {
961
+ $currency = sanitize_text_field( $_REQUEST['wcj-currency'] );
962
+ }
963
+ if ( 'yes' === wcj_get_option( 'wcj_multicurrency_default_currency_force', 'no' ) ) {
964
+ $currency = $this->get_default_currency();
965
+ }
966
+ if ( isset( $currency ) ) {
967
+ wcj_session_set( 'wcj-currency', $currency );
968
  }
969
  }
970
 
971
+ /**
972
+ * get_default_currency.
973
+ *
974
+ * @version 5.3.4
975
+ * @since 5.3.4
976
+ *
977
+ * @return bool
978
+ */
979
+ function get_default_currency() {
980
+ $default_currency_number = wcj_get_option( 'wcj_multicurrency_default_currency', 1 );
981
+ $currency = wcj_get_option( 'wcj_multicurrency_currency_' . $default_currency_number, apply_filters( 'woocommerce_currency', get_option( 'woocommerce_currency' ) ) );
982
+ return $currency;
983
+ }
984
+
985
  /**
986
  * Converts add-ons plugin prices.
987
  *
994
  * @return float|int
995
  */
996
  function product_addons_option_price_raw( $price, $option ) {
997
+ if ( 'no' === wcj_get_option( 'wcj_multicurrency_compatibility_product_addons', 'no' ) ) {
998
  return $price;
999
  }
1000
  $price = $this->change_price( $price, null );
1013
  * @return mixed
1014
  */
1015
  function get_addons_item_data( $other_data, $cart_item ) {
1016
+ if ( 'no' === wcj_get_option( 'wcj_multicurrency_compatibility_product_addons', 'no' ) ) {
1017
  return $other_data;
1018
  }
1019
  if ( ! empty( $cart_item['addons'] ) ) {
1088
  */
1089
  function change_price_grouped( $price, $qty, $_product ) {
1090
  if ( $_product->is_type( 'grouped' ) ) {
1091
+ if ( 'yes' === wcj_get_option( 'wcj_multicurrency_per_product_enabled' , 'yes' ) ) {
1092
  foreach ( $_product->get_children() as $child_id ) {
1093
  $the_price = get_post_meta( $child_id, '_price', true );
1094
  $the_product = wc_get_product( $child_id );
1114
  $price_hash['wcj_multicurrency'] = array(
1115
  'currency' => $currency_code,
1116
  'exchange_rate' => $this->get_currency_exchange_rate( $currency_code ),
1117
+ 'per_product' => wcj_get_option( 'wcj_multicurrency_per_product_enabled', 'yes' ),
1118
+ 'per_product_make_empty' => wcj_get_option( 'wcj_multicurrency_per_product_make_empty', 'no' ),
1119
+ 'rounding' => wcj_get_option( 'wcj_multicurrency_rounding', 'no_round' ),
1120
+ 'rounding_precision' => wcj_get_option( 'wcj_multicurrency_rounding_precision', absint( wcj_get_option( 'woocommerce_price_num_decimals', 2 ) ) ),
1121
  );
1122
  return $price_hash;
1123
  }
1129
  */
1130
  function get_currency_exchange_rate( $currency_code ) {
1131
  $currency_exchange_rate = 1;
1132
+ $total_number = apply_filters( 'booster_option', 2, wcj_get_option( 'wcj_multicurrency_total_number', 2 ) );
1133
  for ( $i = 1; $i <= $total_number; $i++ ) {
1134
+ if ( $currency_code === wcj_get_option( 'wcj_multicurrency_currency_' . $i ) ) {
1135
+ $currency_exchange_rate = wcj_get_option( 'wcj_multicurrency_exchange_rate_' . $i );
1136
  break;
1137
  }
1138
  }
1146
  * @since 2.5.0
1147
  */
1148
  function do_revert() {
1149
+ switch ( wcj_get_option( 'wcj_multicurrency_revert', 'no' ) ) {
1150
  case 'cart_only':
1151
  return is_cart();
1152
  case 'yes': // checkout only
1174
  /**
1175
  * change_price.
1176
  *
1177
+ * @version 5.3.3
1178
  */
1179
+ function change_price( $price, $_product, $args = null ) {
1180
  //Pricing Deals
1181
  global $vtprd_cart;
1182
  if (
1183
+ 'yes' === wcj_get_option( 'wcj_multicurrency_compatibility_pricing_deals', 'no' ) &&
1184
  ( is_cart() || is_checkout() ) &&
1185
  ! empty( $vtprd_cart )
1186
  ) {
1195
  return $price;
1196
  }
1197
 
1198
+ $args = wp_parse_args( $args, array(
1199
+ 'do_save' => ( 'yes' === wcj_get_option( 'wcj_multicurrency_multicurrency_save_prices', 'no' ) )
1200
+ ) );
1201
+
1202
  $_product_id = wcj_get_product_id( $_product );
1203
+ $do_save = $args['do_save'];
1204
  $_current_filter = current_filter();
1205
  if ( '' == $_current_filter ) {
1206
  $_current_filter = 'wcj_filter__none';
1210
  }
1211
 
1212
  // Per product
1213
+ if ( 'yes' === wcj_get_option( 'wcj_multicurrency_per_product_enabled' , 'yes' ) && null != $_product ) {
1214
  if (
1215
+ 'yes' === wcj_get_option( 'wcj_multicurrency_per_product_make_empty', 'no' ) &&
1216
  'yes' === get_post_meta( $_product_id, '_' . 'wcj_multicurrency_per_product_make_empty_' . $this->get_current_currency_code(), true )
1217
  ) {
1218
  $price = '';
1248
  // Global
1249
  if ( 1 != ( $currency_exchange_rate = $this->get_currency_exchange_rate( $this->get_current_currency_code() ) ) ) {
1250
  $price = (float) $price * (float) $currency_exchange_rate;
1251
+ switch ( wcj_get_option( 'wcj_multicurrency_rounding', 'no_round' ) ) {
1252
  case 'round':
1253
+ $price = round( $price, wcj_get_option( 'wcj_multicurrency_rounding_precision', absint( wcj_get_option( 'woocommerce_price_num_decimals', 2 ) ) ) );
1254
  break;
1255
  case 'round_up':
1256
  $price = ceil( $price );
1277
  if ( null !== ( $session_value = wcj_session_get( 'wcj-currency' ) ) ) {
1278
  return $session_value;
1279
  } else {
1280
+ $module_roles = wcj_get_option( 'wcj_multicurrency_role_defaults_roles', '' );
1281
  if ( ! empty( $module_roles ) ) {
1282
  $current_user_role = wcj_get_current_user_first_role();
1283
  if ( in_array( $current_user_role, $module_roles ) ) {
1284
+ $roles_default_currency = wcj_get_option( 'wcj_multicurrency_role_defaults_' . $current_user_role, '' );
1285
  if ( '' != $roles_default_currency ) {
1286
  return $roles_default_currency;
1287
  }
1311
  function change_price_shipping( $package_rates, $package ) {
1312
  if (
1313
  $this->do_revert() ||
1314
+ 'no' === wcj_get_option( 'wcj_multicurrency_convert_shipping_values', 'yes' )
1315
  ) {
1316
  return $package_rates;
1317
  }
includes/class-wcj-my-account.php CHANGED
@@ -56,7 +56,7 @@ if ( ! class_exists( 'WCJ_My_Account' ) ) :
56
  add_action( 'wp_footer', array( $this, 'maybe_add_js_conformation' ) );
57
  add_action( 'init', array( $this, 'process_woocommerce_mark_order_status' ) );
58
  // Custom pages
59
- if ( 'yes' === get_option( 'wcj_my_account_custom_pages_enabled', 'no' ) ) {
60
  add_action( 'woocommerce_account_' . 'page' . '_endpoint', array( $this, 'customize_dashboard' ), PHP_INT_MAX );
61
  add_filter( 'the_title', array( $this, 'set_custom_page_title' ), PHP_INT_MAX );
62
  add_filter( 'the_title', array( $this, 'set_custom_page_title_with_endpoint' ) );
@@ -66,8 +66,8 @@ if ( ! class_exists( 'WCJ_My_Account' ) ) :
66
  $this->customize_dashboard_for_endpoints();
67
  }
68
  // Custom info
69
- if ( 'yes' === get_option( 'wcj_my_account_custom_info_enabled', 'no' ) ) {
70
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_my_account_custom_info_total_number', 1 ) );
71
  for ( $i = 1; $i <= $total_number; $i++ ) {
72
  add_action(
73
  get_option( 'wcj_my_account_custom_info_hook_' . $i, 'woocommerce_account_dashboard' ),
@@ -77,22 +77,22 @@ if ( ! class_exists( 'WCJ_My_Account' ) ) :
77
  }
78
  }
79
  // Registration extra fields
80
- if ( 'yes' === get_option( 'wcj_my_account_registration_extra_fields_user_role_enabled', 'no' ) ) {
81
  add_action( 'woocommerce_register_form', array( $this, 'add_registration_extra_fields' ), PHP_INT_MAX );
82
  add_action( 'woocommerce_created_customer', array( $this, 'process_registration_extra_fields' ), PHP_INT_MAX, 3 );
83
  }
84
  // Menu & Endpoints
85
- if ( 'yes' === get_option( 'wcj_my_account_menu_customize_enabled', 'no' ) ) {
86
  foreach ( $this->account_menu_endpoints as $account_menu_endpoint_id => $account_menu_endpoint_title ) {
87
  add_filter( 'woocommerce_endpoint_' . $account_menu_endpoint_id . '_title', array( $this, 'customize_endpoint_title' ), PHP_INT_MAX, 2 );
88
  }
89
  add_filter( 'woocommerce_account_menu_items', array( $this, 'customize_menu' ), PHP_INT_MAX );
90
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_my_account_menu_order_custom_items_enabled', 'no' ) ) ) {
91
  add_filter( 'woocommerce_get_endpoint_url', array( $this, 'customize_menu_custom_endpoints' ), PHP_INT_MAX, 4 );
92
  }
93
  }
94
  // Dashboard customization
95
- if ( 'yes' === get_option( 'wcj_my_account_custom_dashboard_enabled', 'no' ) ) {
96
  add_action( 'woocommerce_account_' . 'page' . '_endpoint', array( $this, 'customize_dashboard' ), PHP_INT_MAX );
97
  }
98
  }
@@ -142,10 +142,10 @@ if ( ! class_exists( 'WCJ_My_Account' ) ) :
142
  return $this->custom_pages;
143
  }
144
  $this->custom_pages = array();
145
- $title = get_option( 'wcj_my_account_custom_pages_title', array() );
146
- $content = get_option( 'wcj_my_account_custom_pages_content', array() );
147
- $endpoint = get_option( 'wcj_my_account_custom_pages_endpoint', array() );
148
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_my_account_custom_pages_total_number', 1 ) ); $i ++ ) {
149
  if ( ! empty( $title[ $i ] ) && ! empty( $content[ $i ] ) ) {
150
  $endpoint[ $i ] = isset( $endpoint[ $i ] ) ? $endpoint[ $i ] : '';
151
  $this->custom_pages[ sanitize_title( $title[ $i ] ) ] = array( 'endpoint' => $endpoint[ $i ], 'title' => $title[ $i ], 'content' => $content[ $i ] );
@@ -222,7 +222,7 @@ if ( ! class_exists( 'WCJ_My_Account' ) ) :
222
  if ( ! isset( $this->custom_pages ) ) {
223
  $this->get_custom_pages();
224
  }
225
- return ( isset( $this->custom_pages[ $endpoint ] ) && empty( $this->custom_pages[ $endpoint ]['endpoint'] ) && ( $myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' ) ) ? add_query_arg( 'section', $endpoint, get_permalink( $myaccount_page_id ) ) : $url );
226
  }
227
 
228
  /**
@@ -246,7 +246,7 @@ if ( ! class_exists( 'WCJ_My_Account' ) ) :
246
  * @since 3.8.0
247
  */
248
  function customize_menu_custom_endpoints( $url, $endpoint, $value, $permalink ) {
249
- $custom_items = array_map( 'trim', explode( PHP_EOL, get_option( 'wcj_my_account_menu_order_custom_items', '' ) ) );
250
  foreach ( $custom_items as $custom_item ) {
251
  $parts = array_map( 'trim', explode( '|', $custom_item, 3 ) );
252
  if ( 3 === count( $parts ) && $parts[0] === $endpoint ) {
@@ -266,7 +266,7 @@ if ( ! class_exists( 'WCJ_My_Account' ) ) :
266
  function customize_dashboard( $value ) {
267
 
268
  // Custom pages
269
- if ( 'yes' === get_option( 'wcj_my_account_custom_pages_enabled', 'no' ) ) {
270
  if ( isset( $_GET['section'] ) || 'woocommerce_account_page_endpoint' != current_filter() ) {
271
  if ( ! isset( $this->custom_pages ) ) {
272
  $this->get_custom_pages();
@@ -281,7 +281,7 @@ if ( ! class_exists( 'WCJ_My_Account' ) ) :
281
  return;
282
  }
283
  }
284
- if ( 'no' === get_option( 'wcj_my_account_custom_dashboard_enabled', 'no' ) ) {
285
  wc_get_template( 'myaccount/dashboard.php', array(
286
  'current_user' => get_user_by( 'id', get_current_user_id() ),
287
  ) );
@@ -292,11 +292,11 @@ if ( ! class_exists( 'WCJ_My_Account' ) ) :
292
  // Dashboard customization
293
  $current_user = get_user_by( 'id', get_current_user_id() );
294
 
295
- if ( '' != ( $custom_content = get_option( 'wcj_my_account_custom_dashboard_content', '' ) ) ) {
296
  echo do_shortcode( $custom_content );
297
  }
298
 
299
- if ( 'no' === get_option( 'wcj_my_account_custom_dashboard_hide_hello', 'no' ) ) {
300
  echo '<p>';
301
  /* translators: 1: user display name 2: logout url */
302
  printf(
@@ -307,7 +307,7 @@ if ( ! class_exists( 'WCJ_My_Account' ) ) :
307
  echo '</p>';
308
  }
309
 
310
- if ( 'no' === get_option( 'wcj_my_account_custom_dashboard_hide_info', 'no' ) ) {
311
  echo '<p>';
312
  printf(
313
  __( 'From your account dashboard you can view your <a href="%1$s">recent orders</a>, manage your <a href="%2$s">shipping and billing addresses</a>, and <a href="%3$s">edit your password and account details</a>.', 'woocommerce' ),
@@ -352,7 +352,7 @@ if ( ! class_exists( 'WCJ_My_Account' ) ) :
352
  * @todo (maybe) 'order-received' => __( 'Order received', 'woocommerce' )
353
  */
354
  function customize_endpoint_title( $title, $endpoint ) {
355
- $menu_titles = get_option( 'wcj_my_account_menu_title', array() );
356
  if ( ! empty( $menu_titles[ $endpoint ] ) ) {
357
  return $menu_titles[ $endpoint ];
358
  }
@@ -367,14 +367,14 @@ if ( ! class_exists( 'WCJ_My_Account' ) ) :
367
  * @todo (maybe) option to disable menu
368
  */
369
  function customize_menu( $items ) {
370
- $menu_titles = get_option( 'wcj_my_account_menu_title', array() );
371
  foreach ( $items as $item_id => $item_title ) {
372
  if ( ! empty( $menu_titles[ $item_id ] ) ) {
373
  $items[ $item_id ] = $menu_titles[ $item_id ];
374
  }
375
  }
376
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_my_account_menu_order_custom_items_enabled', 'no' ) ) ) {
377
- $custom_items = array_map( 'trim', explode( PHP_EOL, get_option( 'wcj_my_account_menu_order_custom_items', '' ) ) );
378
  foreach ( $custom_items as $custom_item ) {
379
  $parts = array_map( 'trim', explode( '|', $custom_item, 3 ) );
380
  if ( 3 === count( $parts ) ) {
@@ -382,8 +382,8 @@ if ( ! class_exists( 'WCJ_My_Account' ) ) :
382
  }
383
  }
384
  }
385
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_my_account_menu_order_customize_enabled', 'no' ) ) ) {
386
- $menu_order = array_map( 'trim', explode( PHP_EOL, get_option( 'wcj_my_account_menu_order', $this->menu_order_default ) ) );
387
  $menu_order = array_map( 'strtolower', $menu_order );
388
  $menu_order = array_filter( $menu_order, function ( $item ) use ( $items ) {
389
  return in_array( $item, array_keys( $items ) );
@@ -406,7 +406,7 @@ if ( ! class_exists( 'WCJ_My_Account' ) ) :
406
  $user_roles_options_html = '';
407
  $current_user_role_input = ! empty( $_POST['wcj_user_role'] ) ? $_POST['wcj_user_role'] :
408
  get_option( 'wcj_my_account_registration_extra_fields_user_role_default', 'customer' );
409
- $user_roles_options = get_option( 'wcj_my_account_registration_extra_fields_user_role_options', array( 'customer' ) );
410
  $all_user_roles = wcj_get_user_roles_options();
411
  foreach ( $user_roles_options as $user_role_id ) {
412
  $user_roles_options_html .= '<option value="' . $user_role_id . '" ' . selected( $user_role_id, $current_user_role_input, false ) . '>' .
@@ -427,7 +427,7 @@ if ( ! class_exists( 'WCJ_My_Account' ) ) :
427
  */
428
  function process_registration_extra_fields( $customer_id, $new_customer_data, $password_generated ) {
429
  if ( isset( $_POST['wcj_user_role'] ) && '' != $_POST['wcj_user_role'] ) {
430
- $user_roles_options = get_option( 'wcj_my_account_registration_extra_fields_user_role_options', array( 'customer' ) );
431
  if ( ! empty( $user_roles_options ) && in_array( $_POST['wcj_user_role'], $user_roles_options ) ) {
432
  wp_update_user( array( 'ID' => $customer_id, 'role' => $_POST['wcj_user_role'] ) );
433
  }
@@ -443,14 +443,14 @@ if ( ! class_exists( 'WCJ_My_Account' ) ) :
443
  function add_my_account_custom_info() {
444
  $current_filter = current_filter();
445
  $current_filter_priority = wcj_current_filter_priority();
446
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_my_account_custom_info_total_number', 1 ) );
447
  for ( $i = 1; $i <= $total_number; $i++ ) {
448
  if (
449
- '' != get_option( 'wcj_my_account_custom_info_content_' . $i ) &&
450
- $current_filter === get_option( 'wcj_my_account_custom_info_hook_' . $i, 'woocommerce_account_dashboard' ) &&
451
- $current_filter_priority == get_option( 'wcj_my_account_custom_info_priority_' . $i, 10 )
452
  ) {
453
- echo do_shortcode( get_option( 'wcj_my_account_custom_info_content_' . $i ) );
454
  }
455
  }
456
  }
@@ -463,7 +463,7 @@ if ( ! class_exists( 'WCJ_My_Account' ) ) :
463
  * @see http://snippet.fm/snippets/add-order-complete-action-to-woocommerce-my-orders-customer-table/
464
  */
465
  function maybe_add_my_account_order_actions( $actions, $order ) {
466
- $statuses_to_add = get_option( 'wcj_my_account_add_order_status_actions', '' );
467
  if ( ! empty( $statuses_to_add ) ) {
468
  $all_statuses = wcj_get_order_statuses();
469
  foreach ( $statuses_to_add as $status_to_add ) {
@@ -488,7 +488,7 @@ if ( ! class_exists( 'WCJ_My_Account' ) ) :
488
  * @since 2.9.0
489
  */
490
  function maybe_add_js_conformation() {
491
- $statuses_to_add = get_option( 'wcj_my_account_add_order_status_actions', '' );
492
  if ( ! empty( $statuses_to_add ) ) {
493
  echo '<script>';
494
  foreach ( $statuses_to_add as $status_to_add ) {
56
  add_action( 'wp_footer', array( $this, 'maybe_add_js_conformation' ) );
57
  add_action( 'init', array( $this, 'process_woocommerce_mark_order_status' ) );
58
  // Custom pages
59
+ if ( 'yes' === wcj_get_option( 'wcj_my_account_custom_pages_enabled', 'no' ) ) {
60
  add_action( 'woocommerce_account_' . 'page' . '_endpoint', array( $this, 'customize_dashboard' ), PHP_INT_MAX );
61
  add_filter( 'the_title', array( $this, 'set_custom_page_title' ), PHP_INT_MAX );
62
  add_filter( 'the_title', array( $this, 'set_custom_page_title_with_endpoint' ) );
66
  $this->customize_dashboard_for_endpoints();
67
  }
68
  // Custom info
69
+ if ( 'yes' === wcj_get_option( 'wcj_my_account_custom_info_enabled', 'no' ) ) {
70
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_my_account_custom_info_total_number', 1 ) );
71
  for ( $i = 1; $i <= $total_number; $i++ ) {
72
  add_action(
73
  get_option( 'wcj_my_account_custom_info_hook_' . $i, 'woocommerce_account_dashboard' ),
77
  }
78
  }
79
  // Registration extra fields
80
+ if ( 'yes' === wcj_get_option( 'wcj_my_account_registration_extra_fields_user_role_enabled', 'no' ) ) {
81
  add_action( 'woocommerce_register_form', array( $this, 'add_registration_extra_fields' ), PHP_INT_MAX );
82
  add_action( 'woocommerce_created_customer', array( $this, 'process_registration_extra_fields' ), PHP_INT_MAX, 3 );
83
  }
84
  // Menu & Endpoints
85
+ if ( 'yes' === wcj_get_option( 'wcj_my_account_menu_customize_enabled', 'no' ) ) {
86
  foreach ( $this->account_menu_endpoints as $account_menu_endpoint_id => $account_menu_endpoint_title ) {
87
  add_filter( 'woocommerce_endpoint_' . $account_menu_endpoint_id . '_title', array( $this, 'customize_endpoint_title' ), PHP_INT_MAX, 2 );
88
  }
89
  add_filter( 'woocommerce_account_menu_items', array( $this, 'customize_menu' ), PHP_INT_MAX );
90
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_my_account_menu_order_custom_items_enabled', 'no' ) ) ) {
91
  add_filter( 'woocommerce_get_endpoint_url', array( $this, 'customize_menu_custom_endpoints' ), PHP_INT_MAX, 4 );
92
  }
93
  }
94
  // Dashboard customization
95
+ if ( 'yes' === wcj_get_option( 'wcj_my_account_custom_dashboard_enabled', 'no' ) ) {
96
  add_action( 'woocommerce_account_' . 'page' . '_endpoint', array( $this, 'customize_dashboard' ), PHP_INT_MAX );
97
  }
98
  }
142
  return $this->custom_pages;
143
  }
144
  $this->custom_pages = array();
145
+ $title = wcj_get_option( 'wcj_my_account_custom_pages_title', array() );
146
+ $content = wcj_get_option( 'wcj_my_account_custom_pages_content', array() );
147
+ $endpoint = wcj_get_option( 'wcj_my_account_custom_pages_endpoint', array() );
148
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_my_account_custom_pages_total_number', 1 ) ); $i ++ ) {
149
  if ( ! empty( $title[ $i ] ) && ! empty( $content[ $i ] ) ) {
150
  $endpoint[ $i ] = isset( $endpoint[ $i ] ) ? $endpoint[ $i ] : '';
151
  $this->custom_pages[ sanitize_title( $title[ $i ] ) ] = array( 'endpoint' => $endpoint[ $i ], 'title' => $title[ $i ], 'content' => $content[ $i ] );
222
  if ( ! isset( $this->custom_pages ) ) {
223
  $this->get_custom_pages();
224
  }
225
+ return ( isset( $this->custom_pages[ $endpoint ] ) && empty( $this->custom_pages[ $endpoint ]['endpoint'] ) && ( $myaccount_page_id = wcj_get_option( 'woocommerce_myaccount_page_id' ) ) ? add_query_arg( 'section', $endpoint, get_permalink( $myaccount_page_id ) ) : $url );
226
  }
227
 
228
  /**
246
  * @since 3.8.0
247
  */
248
  function customize_menu_custom_endpoints( $url, $endpoint, $value, $permalink ) {
249
+ $custom_items = array_map( 'trim', explode( PHP_EOL, wcj_get_option( 'wcj_my_account_menu_order_custom_items', '' ) ) );
250
  foreach ( $custom_items as $custom_item ) {
251
  $parts = array_map( 'trim', explode( '|', $custom_item, 3 ) );
252
  if ( 3 === count( $parts ) && $parts[0] === $endpoint ) {
266
  function customize_dashboard( $value ) {
267
 
268
  // Custom pages
269
+ if ( 'yes' === wcj_get_option( 'wcj_my_account_custom_pages_enabled', 'no' ) ) {
270
  if ( isset( $_GET['section'] ) || 'woocommerce_account_page_endpoint' != current_filter() ) {
271
  if ( ! isset( $this->custom_pages ) ) {
272
  $this->get_custom_pages();
281
  return;
282
  }
283
  }
284
+ if ( 'no' === wcj_get_option( 'wcj_my_account_custom_dashboard_enabled', 'no' ) ) {
285
  wc_get_template( 'myaccount/dashboard.php', array(
286
  'current_user' => get_user_by( 'id', get_current_user_id() ),
287
  ) );
292
  // Dashboard customization
293
  $current_user = get_user_by( 'id', get_current_user_id() );
294
 
295
+ if ( '' != ( $custom_content = wcj_get_option( 'wcj_my_account_custom_dashboard_content', '' ) ) ) {
296
  echo do_shortcode( $custom_content );
297
  }
298
 
299
+ if ( 'no' === wcj_get_option( 'wcj_my_account_custom_dashboard_hide_hello', 'no' ) ) {
300
  echo '<p>';
301
  /* translators: 1: user display name 2: logout url */
302
  printf(
307
  echo '</p>';
308
  }
309
 
310
+ if ( 'no' === wcj_get_option( 'wcj_my_account_custom_dashboard_hide_info', 'no' ) ) {
311
  echo '<p>';
312
  printf(
313
  __( 'From your account dashboard you can view your <a href="%1$s">recent orders</a>, manage your <a href="%2$s">shipping and billing addresses</a>, and <a href="%3$s">edit your password and account details</a>.', 'woocommerce' ),
352
  * @todo (maybe) 'order-received' => __( 'Order received', 'woocommerce' )
353
  */
354
  function customize_endpoint_title( $title, $endpoint ) {
355
+ $menu_titles = wcj_get_option( 'wcj_my_account_menu_title', array() );
356
  if ( ! empty( $menu_titles[ $endpoint ] ) ) {
357
  return $menu_titles[ $endpoint ];
358
  }
367
  * @todo (maybe) option to disable menu
368
  */
369
  function customize_menu( $items ) {
370
+ $menu_titles = wcj_get_option( 'wcj_my_account_menu_title', array() );
371
  foreach ( $items as $item_id => $item_title ) {
372
  if ( ! empty( $menu_titles[ $item_id ] ) ) {
373
  $items[ $item_id ] = $menu_titles[ $item_id ];
374
  }
375
  }
376
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_my_account_menu_order_custom_items_enabled', 'no' ) ) ) {
377
+ $custom_items = array_map( 'trim', explode( PHP_EOL, wcj_get_option( 'wcj_my_account_menu_order_custom_items', '' ) ) );
378
  foreach ( $custom_items as $custom_item ) {
379
  $parts = array_map( 'trim', explode( '|', $custom_item, 3 ) );
380
  if ( 3 === count( $parts ) ) {
382
  }
383
  }
384
  }
385
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_my_account_menu_order_customize_enabled', 'no' ) ) ) {
386
+ $menu_order = array_map( 'trim', explode( PHP_EOL, wcj_get_option( 'wcj_my_account_menu_order', $this->menu_order_default ) ) );
387
  $menu_order = array_map( 'strtolower', $menu_order );
388
  $menu_order = array_filter( $menu_order, function ( $item ) use ( $items ) {
389
  return in_array( $item, array_keys( $items ) );
406
  $user_roles_options_html = '';
407
  $current_user_role_input = ! empty( $_POST['wcj_user_role'] ) ? $_POST['wcj_user_role'] :
408
  get_option( 'wcj_my_account_registration_extra_fields_user_role_default', 'customer' );
409
+ $user_roles_options = wcj_get_option( 'wcj_my_account_registration_extra_fields_user_role_options', array( 'customer' ) );
410
  $all_user_roles = wcj_get_user_roles_options();
411
  foreach ( $user_roles_options as $user_role_id ) {
412
  $user_roles_options_html .= '<option value="' . $user_role_id . '" ' . selected( $user_role_id, $current_user_role_input, false ) . '>' .
427
  */
428
  function process_registration_extra_fields( $customer_id, $new_customer_data, $password_generated ) {
429
  if ( isset( $_POST['wcj_user_role'] ) && '' != $_POST['wcj_user_role'] ) {
430
+ $user_roles_options = wcj_get_option( 'wcj_my_account_registration_extra_fields_user_role_options', array( 'customer' ) );
431
  if ( ! empty( $user_roles_options ) && in_array( $_POST['wcj_user_role'], $user_roles_options ) ) {
432
  wp_update_user( array( 'ID' => $customer_id, 'role' => $_POST['wcj_user_role'] ) );
433
  }
443
  function add_my_account_custom_info() {
444
  $current_filter = current_filter();
445
  $current_filter_priority = wcj_current_filter_priority();
446
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_my_account_custom_info_total_number', 1 ) );
447
  for ( $i = 1; $i <= $total_number; $i++ ) {
448
  if (
449
+ '' != wcj_get_option( 'wcj_my_account_custom_info_content_' . $i ) &&
450
+ $current_filter === wcj_get_option( 'wcj_my_account_custom_info_hook_' . $i, 'woocommerce_account_dashboard' ) &&
451
+ $current_filter_priority == wcj_get_option( 'wcj_my_account_custom_info_priority_' . $i, 10 )
452
  ) {
453
+ echo do_shortcode( wcj_get_option( 'wcj_my_account_custom_info_content_' . $i ) );
454
  }
455
  }
456
  }
463
  * @see http://snippet.fm/snippets/add-order-complete-action-to-woocommerce-my-orders-customer-table/
464
  */
465
  function maybe_add_my_account_order_actions( $actions, $order ) {
466
+ $statuses_to_add = wcj_get_option( 'wcj_my_account_add_order_status_actions', '' );
467
  if ( ! empty( $statuses_to_add ) ) {
468
  $all_statuses = wcj_get_order_statuses();
469
  foreach ( $statuses_to_add as $status_to_add ) {
488
  * @since 2.9.0
489
  */
490
  function maybe_add_js_conformation() {
491
+ $statuses_to_add = wcj_get_option( 'wcj_my_account_add_order_status_actions', '' );
492
  if ( ! empty( $statuses_to_add ) ) {
493
  echo '<script>';
494
  foreach ( $statuses_to_add as $status_to_add ) {
includes/class-wcj-offer-price.php CHANGED
@@ -40,24 +40,24 @@ class WCJ_Offer_Price extends WCJ_Module {
40
  parent::__construct();
41
 
42
  if ( $this->is_enabled() ) {
43
- if ( 'disable' != ( $_hook = get_option( 'wcj_offer_price_button_position', 'woocommerce_single_product_summary' ) ) ) {
44
  add_action(
45
  $_hook,
46
  array( $this, 'add_offer_price_button' ),
47
  get_option( 'wcj_offer_price_button_position_priority', 31 )
48
  );
49
  }
50
- if ( 'disable' != ( $_hook = apply_filters( 'booster_option', 'disable', get_option( 'wcj_offer_price_button_position_archives', 'disable' ) ) ) ) {
51
  add_action(
52
  $_hook,
53
  array( $this, 'add_offer_price_button' ),
54
  get_option( 'wcj_offer_price_button_position_priority_archives', 10 )
55
  );
56
  }
57
- $custom_hooks = apply_filters( 'booster_option', '', get_option( 'wcj_offer_price_button_position_custom', '' ) );
58
  if ( ! empty( $custom_hooks ) ) {
59
  $custom_hooks = array_filter( array_map( 'trim', explode( '|', $custom_hooks ) ) );
60
- $custom_hook_priorities = apply_filters( 'booster_option', '', get_option( 'wcj_offer_price_button_position_priority_custom', '' ) );
61
  $custom_hook_priorities = array_map( 'trim', explode( '|', $custom_hook_priorities ) );
62
  foreach ( $custom_hooks as $i => $custom_hook ) {
63
  add_action(
@@ -70,7 +70,7 @@ class WCJ_Offer_Price extends WCJ_Module {
70
  add_action( 'wp_footer', array( $this, 'add_offer_price_form' ) );
71
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
72
  add_action( 'init', array( $this, 'offer_price' ) );
73
- if ( in_array( apply_filters( 'booster_option', 'all_products', get_option( 'wcj_offer_price_enabled_type', 'all_products' ) ), array( 'per_product', 'per_product_and_per_category' ) ) ) {
74
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
75
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
76
  }
@@ -96,7 +96,7 @@ class WCJ_Offer_Price extends WCJ_Module {
96
  'form_footer_back_color' => '#5cb85c',
97
  'form_footer_text_color' => '#ffffff',
98
  );
99
- $styling_options = get_option( 'wcj_offer_price_styling', array() );
100
  foreach ( $styling_default as $option => $default ) {
101
  if ( ! isset( $styling_options[ $option ] ) ) {
102
  $styling_options[ $option ] = $default;
@@ -186,7 +186,7 @@ class WCJ_Offer_Price extends WCJ_Module {
186
  } else {
187
  $average_offers = array();
188
  $all_columns = $this->get_admin_meta_box_columns();
189
- $selected_columns = get_option( 'wcj_offer_price_admin_meta_box_columns',
190
  array( 'date', 'offered_price', 'customer_message', 'customer_name', 'customer_email', 'customer_id', 'user_ip', 'sent_to' ) );
191
  $table_data = array();
192
  $header = array();
@@ -194,7 +194,7 @@ class WCJ_Offer_Price extends WCJ_Module {
194
  $header[] = $all_columns[ $selected_column ];
195
  }
196
  $table_data[] = $header;
197
- $date_ant_time_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
198
  $price_offers = array_reverse( $price_offers );
199
  foreach ( $price_offers as $price_offer ) {
200
  $row = array();
@@ -271,7 +271,7 @@ class WCJ_Offer_Price extends WCJ_Module {
271
  * @since 2.9.0
272
  */
273
  function is_offer_price_enabled_for_product( $product_id ) {
274
- switch ( apply_filters( 'booster_option', 'all_products', get_option( 'wcj_offer_price_enabled_type', 'all_products' ) ) ) {
275
  case 'all_products':
276
  return true;
277
  case 'empty_prices':
@@ -280,9 +280,9 @@ class WCJ_Offer_Price extends WCJ_Module {
280
  case 'per_product':
281
  return ( 'yes' === get_post_meta( $product_id, '_' . 'wcj_offer_price_enabled', true ) );
282
  case 'per_category':
283
- return wcj_is_product_term( $product_id, get_option( 'wcj_offer_price_enabled_cats', array() ), 'product_cat' );
284
  case 'per_product_and_per_category':
285
- return ( 'yes' === get_post_meta( $product_id, '_' . 'wcj_offer_price_enabled', true ) || wcj_is_product_term( $product_id, get_option( 'wcj_offer_price_enabled_cats', array() ), 'product_cat' ) );
286
  }
287
  }
288
 
@@ -294,10 +294,10 @@ class WCJ_Offer_Price extends WCJ_Module {
294
  * @todo (maybe) rethink `str_replace( '\'', '"', ... )`
295
  */
296
  function get_wcj_data_array( $product_id ) {
297
- $is_per_product_enabled = ( in_array( apply_filters( 'booster_option', 'all_products', get_option( 'wcj_offer_price_enabled_type', 'all_products' ) ), array( 'per_product', 'per_product_and_per_category' ) ) );
298
  // Price input - price step
299
  $price_step = ( ! $is_per_product_enabled || '' === ( $price_step_per_product = get_post_meta( $product_id, '_' . 'wcj_offer_price_price_step', true ) ) ?
300
- get_option( 'wcj_offer_price_price_step', get_option( 'woocommerce_price_num_decimals' ) ) :
301
  $price_step_per_product
302
  );
303
  $price_step = sprintf( "%f", ( 1 / pow( 10, absint( $price_step ) ) ) );
@@ -372,30 +372,30 @@ class WCJ_Offer_Price extends WCJ_Module {
372
  '<span class="wcj-offer-price-form-close">&times;</span>' . '<div id="wcj-offer-form-header"></div>' .
373
  '</div>';
374
  // Footer
375
- $offer_form_footer = ( '' != ( $footer_template = get_option( 'wcj_offer_price_form_footer_template', '' ) ) ?
376
  '<div class="wcj-offer-price-modal-footer">' . /* do_shortcode */( $footer_template ) . '</div>' : '' );
377
  // Required HTML
378
- $required_html = get_option( 'wcj_offer_price_form_required_html', ' <abbr class="required" title="required">*</abbr>' );
379
  // Content - price
380
  $offer_form_content_price = '<label for="wcj-offer-price-price">' .
381
  '<span id="wcj-offer-price-price-label"></span>' . $required_html . '</label>' . '<br>' .
382
  '<input type="number" required id="wcj-offer-price-price" name="wcj-offer-price-price">';
383
  // Content - email
384
- $offer_form_content_email = '<label for="wcj-offer-price-customer-email">' . get_option( 'wcj_offer_price_customer_email', __( 'Your email', 'woocommerce-jetpack' ) ) .
385
  $required_html . '</label>' . '<br>' .
386
  '<input type="email" required id="wcj-offer-price-customer-email" name="wcj-offer-price-customer-email" value="' . $customer_email . '">';
387
  // Content - name
388
- $offer_form_content_name = '<label for="wcj-offer-price-customer-name">' . get_option( 'wcj_offer_price_customer_name', __( 'Your name', 'woocommerce-jetpack' ) ) .
389
  '</label>' . '<br>' .
390
  '<input type="text" id="wcj-offer-price-customer-name" name="wcj-offer-price-customer-name" value="' . $customer_name . '">';
391
  // Content - message
392
- $offer_form_content_message = '<label for="wcj-offer-price-message">' . get_option( 'wcj_offer_price_customer_message', __( 'Your message', 'woocommerce-jetpack' ) ) . '</label>' . '<br>' .
393
  '<textarea id="wcj-offer-price-message" name="wcj-offer-price-message"></textarea>';
394
  // Content - button
395
  $offer_form_content_button = '<input type="submit" id="wcj-offer-price-submit" name="wcj-offer-price-submit" value="' .
396
  get_option( 'wcj_offer_price_form_button_label', __( 'Send', 'woocommerce-jetpack' ) ) . '">';
397
  // Content - copy
398
- $offer_form_content_copy = '<label for="wcj-offer-price-customer-copy">' . get_option( 'wcj_offer_price_customer_copy', __( 'Send a copy to your email', 'woocommerce-jetpack' ) ) .
399
  '</label>' . ' ' .
400
  '<input type="checkbox" id="wcj-offer-price-customer-copy" name="wcj-offer-price-customer-copy" value="yes">';
401
  // Content
@@ -429,7 +429,7 @@ class WCJ_Offer_Price extends WCJ_Module {
429
  * @todo [dev] add more conditions to exclude (i.e. not only "out of stock")
430
  */
431
  function is_offer_price_excluded_for_product( $product_id ) {
432
- if ( 'yes' === get_option( 'wcj_offer_price_exclude_out_of_stock', 'no' ) ) {
433
  $product = wc_get_product( $product_id );
434
  if ( ! $product->is_in_stock() ) {
435
  return true;
@@ -451,7 +451,7 @@ class WCJ_Offer_Price extends WCJ_Module {
451
  return;
452
  }
453
  // The button
454
- if ( '' != $additional_class = get_option( 'wcj_offer_price_button_class', 'button' ) ) {
455
  $additional_class = ' ' . $additional_class;
456
  }
457
  echo '<p>' .
@@ -459,7 +459,7 @@ class WCJ_Offer_Price extends WCJ_Module {
459
  ' name="wcj-offer-price-button"' .
460
  ' class="wcj-offer-price-button' . $additional_class . '"' .
461
  ' value="' . $product_id . '"' .
462
- ' style="' . get_option( 'wcj_offer_price_button_style', '' ) . '"' .
463
  ' wcj_data=\'' . json_encode( $this->get_wcj_data_array( $product_id ) ) . '\'' .
464
  '>' .
465
  get_option( 'wcj_offer_price_button_label', __( 'Make an offer', 'woocommerce-jetpack' ) ) .
@@ -487,11 +487,11 @@ class WCJ_Offer_Price extends WCJ_Module {
487
  return;
488
  }
489
  // Email address
490
- $email_address = get_option( 'wcj_offer_price_email_address', '%admin_email%' );
491
  if ( '' == $email_address ) {
492
- $email_address = get_option( 'admin_email' );
493
  } else {
494
- $admin_email = get_option( 'admin_email' );
495
  if (
496
  ( $product_author_id = get_post_field( 'post_author', $product_id ) ) &&
497
  ( $product_user_info = get_userdata( $product_author_id ) ) &&
@@ -520,7 +520,7 @@ class WCJ_Offer_Price extends WCJ_Module {
520
  'sent_to' => $email_address,
521
  );
522
  // Email content
523
- $email_template = get_option( 'wcj_offer_price_email_template',
524
  sprintf( __( 'Product: %s', 'woocommerce-jetpack' ), '<a href="%product_edit_link%">%product_title%</a>' ) . '<br>' . PHP_EOL .
525
  sprintf( __( 'Offered price: %s', 'woocommerce-jetpack' ), '%offered_price%' ) . '<br>' . PHP_EOL .
526
  sprintf( __( 'From: %s %s', 'woocommerce-jetpack' ), '%customer_name%', '%customer_email%' ) . '<br>' . PHP_EOL .
@@ -538,7 +538,7 @@ class WCJ_Offer_Price extends WCJ_Module {
538
  );
539
  $email_content = str_replace( array_keys( $replaced_values ), array_values( $replaced_values ), $email_template );
540
  // Email subject and headers
541
- $email_subject = get_option( 'wcj_offer_price_email_subject', __( 'Price Offer', 'woocommerce-jetpack' ) );
542
  $email_headers = 'Content-Type: text/html' . "\r\n" .
543
  'From: ' . $price_offer['customer_name'] . ' <' . $price_offer['customer_email'] . '>' . "\r\n" .
544
  'Reply-To: ' . $price_offer['customer_email'] . "\r\n";
@@ -548,7 +548,7 @@ class WCJ_Offer_Price extends WCJ_Module {
548
  wc_mail( $price_offer['customer_email'], $email_subject, $email_content, $email_headers );
549
  }
550
  // Notice
551
- wc_add_notice( get_option( 'wcj_offer_price_customer_notice', __( 'Your price offer has been sent.', 'woocommerce-jetpack' ) ), 'notice' );
552
  // Product meta (Offer Price History)
553
  if ( '' == ( $price_offers = get_post_meta( $product_id, '_' . 'wcj_price_offers', true ) ) ) {
554
  $price_offers = array();
40
  parent::__construct();
41
 
42
  if ( $this->is_enabled() ) {
43
+ if ( 'disable' != ( $_hook = wcj_get_option( 'wcj_offer_price_button_position', 'woocommerce_single_product_summary' ) ) ) {
44
  add_action(
45
  $_hook,
46
  array( $this, 'add_offer_price_button' ),
47
  get_option( 'wcj_offer_price_button_position_priority', 31 )
48
  );
49
  }
50
+ if ( 'disable' != ( $_hook = apply_filters( 'booster_option', 'disable', wcj_get_option( 'wcj_offer_price_button_position_archives', 'disable' ) ) ) ) {
51
  add_action(
52
  $_hook,
53
  array( $this, 'add_offer_price_button' ),
54
  get_option( 'wcj_offer_price_button_position_priority_archives', 10 )
55
  );
56
  }
57
+ $custom_hooks = apply_filters( 'booster_option', '', wcj_get_option( 'wcj_offer_price_button_position_custom', '' ) );
58
  if ( ! empty( $custom_hooks ) ) {
59
  $custom_hooks = array_filter( array_map( 'trim', explode( '|', $custom_hooks ) ) );
60
+ $custom_hook_priorities = apply_filters( 'booster_option', '', wcj_get_option( 'wcj_offer_price_button_position_priority_custom', '' ) );
61
  $custom_hook_priorities = array_map( 'trim', explode( '|', $custom_hook_priorities ) );
62
  foreach ( $custom_hooks as $i => $custom_hook ) {
63
  add_action(
70
  add_action( 'wp_footer', array( $this, 'add_offer_price_form' ) );
71
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
72
  add_action( 'init', array( $this, 'offer_price' ) );
73
+ if ( in_array( apply_filters( 'booster_option', 'all_products', wcj_get_option( 'wcj_offer_price_enabled_type', 'all_products' ) ), array( 'per_product', 'per_product_and_per_category' ) ) ) {
74
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
75
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
76
  }
96
  'form_footer_back_color' => '#5cb85c',
97
  'form_footer_text_color' => '#ffffff',
98
  );
99
+ $styling_options = wcj_get_option( 'wcj_offer_price_styling', array() );
100
  foreach ( $styling_default as $option => $default ) {
101
  if ( ! isset( $styling_options[ $option ] ) ) {
102
  $styling_options[ $option ] = $default;
186
  } else {
187
  $average_offers = array();
188
  $all_columns = $this->get_admin_meta_box_columns();
189
+ $selected_columns = wcj_get_option( 'wcj_offer_price_admin_meta_box_columns',
190
  array( 'date', 'offered_price', 'customer_message', 'customer_name', 'customer_email', 'customer_id', 'user_ip', 'sent_to' ) );
191
  $table_data = array();
192
  $header = array();
194
  $header[] = $all_columns[ $selected_column ];
195
  }
196
  $table_data[] = $header;
197
+ $date_ant_time_format = wcj_get_option( 'date_format' ) . ' ' . wcj_get_option( 'time_format' );
198
  $price_offers = array_reverse( $price_offers );
199
  foreach ( $price_offers as $price_offer ) {
200
  $row = array();
271
  * @since 2.9.0
272
  */
273
  function is_offer_price_enabled_for_product( $product_id ) {
274
+ switch ( apply_filters( 'booster_option', 'all_products', wcj_get_option( 'wcj_offer_price_enabled_type', 'all_products' ) ) ) {
275
  case 'all_products':
276
  return true;
277
  case 'empty_prices':
280
  case 'per_product':
281
  return ( 'yes' === get_post_meta( $product_id, '_' . 'wcj_offer_price_enabled', true ) );
282
  case 'per_category':
283
+ return wcj_is_product_term( $product_id, wcj_get_option( 'wcj_offer_price_enabled_cats', array() ), 'product_cat' );
284
  case 'per_product_and_per_category':
285
+ return ( 'yes' === get_post_meta( $product_id, '_' . 'wcj_offer_price_enabled', true ) || wcj_is_product_term( $product_id, wcj_get_option( 'wcj_offer_price_enabled_cats', array() ), 'product_cat' ) );
286
  }
287
  }
288
 
294
  * @todo (maybe) rethink `str_replace( '\'', '"', ... )`
295
  */
296
  function get_wcj_data_array( $product_id ) {
297
+ $is_per_product_enabled = ( in_array( apply_filters( 'booster_option', 'all_products', wcj_get_option( 'wcj_offer_price_enabled_type', 'all_products' ) ), array( 'per_product', 'per_product_and_per_category' ) ) );
298
  // Price input - price step
299
  $price_step = ( ! $is_per_product_enabled || '' === ( $price_step_per_product = get_post_meta( $product_id, '_' . 'wcj_offer_price_price_step', true ) ) ?
300
+ get_option( 'wcj_offer_price_price_step', wcj_get_option( 'woocommerce_price_num_decimals' ) ) :
301
  $price_step_per_product
302
  );
303
  $price_step = sprintf( "%f", ( 1 / pow( 10, absint( $price_step ) ) ) );
372
  '<span class="wcj-offer-price-form-close">&times;</span>' . '<div id="wcj-offer-form-header"></div>' .
373
  '</div>';
374
  // Footer
375
+ $offer_form_footer = ( '' != ( $footer_template = wcj_get_option( 'wcj_offer_price_form_footer_template', '' ) ) ?
376
  '<div class="wcj-offer-price-modal-footer">' . /* do_shortcode */( $footer_template ) . '</div>' : '' );
377
  // Required HTML
378
+ $required_html = wcj_get_option( 'wcj_offer_price_form_required_html', ' <abbr class="required" title="required">*</abbr>' );
379
  // Content - price
380
  $offer_form_content_price = '<label for="wcj-offer-price-price">' .
381
  '<span id="wcj-offer-price-price-label"></span>' . $required_html . '</label>' . '<br>' .
382
  '<input type="number" required id="wcj-offer-price-price" name="wcj-offer-price-price">';
383
  // Content - email
384
+ $offer_form_content_email = '<label for="wcj-offer-price-customer-email">' . wcj_get_option( 'wcj_offer_price_customer_email', __( 'Your email', 'woocommerce-jetpack' ) ) .
385
  $required_html . '</label>' . '<br>' .
386
  '<input type="email" required id="wcj-offer-price-customer-email" name="wcj-offer-price-customer-email" value="' . $customer_email . '">';
387
  // Content - name
388
+ $offer_form_content_name = '<label for="wcj-offer-price-customer-name">' . wcj_get_option( 'wcj_offer_price_customer_name', __( 'Your name', 'woocommerce-jetpack' ) ) .
389
  '</label>' . '<br>' .
390
  '<input type="text" id="wcj-offer-price-customer-name" name="wcj-offer-price-customer-name" value="' . $customer_name . '">';
391
  // Content - message
392
+ $offer_form_content_message = '<label for="wcj-offer-price-message">' . wcj_get_option( 'wcj_offer_price_customer_message', __( 'Your message', 'woocommerce-jetpack' ) ) . '</label>' . '<br>' .
393
  '<textarea id="wcj-offer-price-message" name="wcj-offer-price-message"></textarea>';
394
  // Content - button
395
  $offer_form_content_button = '<input type="submit" id="wcj-offer-price-submit" name="wcj-offer-price-submit" value="' .
396
  get_option( 'wcj_offer_price_form_button_label', __( 'Send', 'woocommerce-jetpack' ) ) . '">';
397
  // Content - copy
398
+ $offer_form_content_copy = '<label for="wcj-offer-price-customer-copy">' . wcj_get_option( 'wcj_offer_price_customer_copy', __( 'Send a copy to your email', 'woocommerce-jetpack' ) ) .
399
  '</label>' . ' ' .
400
  '<input type="checkbox" id="wcj-offer-price-customer-copy" name="wcj-offer-price-customer-copy" value="yes">';
401
  // Content
429
  * @todo [dev] add more conditions to exclude (i.e. not only "out of stock")
430
  */
431
  function is_offer_price_excluded_for_product( $product_id ) {
432
+ if ( 'yes' === wcj_get_option( 'wcj_offer_price_exclude_out_of_stock', 'no' ) ) {
433
  $product = wc_get_product( $product_id );
434
  if ( ! $product->is_in_stock() ) {
435
  return true;
451
  return;
452
  }
453
  // The button
454
+ if ( '' != $additional_class = wcj_get_option( 'wcj_offer_price_button_class', 'button' ) ) {
455
  $additional_class = ' ' . $additional_class;
456
  }
457
  echo '<p>' .
459
  ' name="wcj-offer-price-button"' .
460
  ' class="wcj-offer-price-button' . $additional_class . '"' .
461
  ' value="' . $product_id . '"' .
462
+ ' style="' . wcj_get_option( 'wcj_offer_price_button_style', '' ) . '"' .
463
  ' wcj_data=\'' . json_encode( $this->get_wcj_data_array( $product_id ) ) . '\'' .
464
  '>' .
465
  get_option( 'wcj_offer_price_button_label', __( 'Make an offer', 'woocommerce-jetpack' ) ) .
487
  return;
488
  }
489
  // Email address
490
+ $email_address = wcj_get_option( 'wcj_offer_price_email_address', '%admin_email%' );
491
  if ( '' == $email_address ) {
492
+ $email_address = wcj_get_option( 'admin_email' );
493
  } else {
494
+ $admin_email = wcj_get_option( 'admin_email' );
495
  if (
496
  ( $product_author_id = get_post_field( 'post_author', $product_id ) ) &&
497
  ( $product_user_info = get_userdata( $product_author_id ) ) &&
520
  'sent_to' => $email_address,
521
  );
522
  // Email content
523
+ $email_template = wcj_get_option( 'wcj_offer_price_email_template',
524
  sprintf( __( 'Product: %s', 'woocommerce-jetpack' ), '<a href="%product_edit_link%">%product_title%</a>' ) . '<br>' . PHP_EOL .
525
  sprintf( __( 'Offered price: %s', 'woocommerce-jetpack' ), '%offered_price%' ) . '<br>' . PHP_EOL .
526
  sprintf( __( 'From: %s %s', 'woocommerce-jetpack' ), '%customer_name%', '%customer_email%' ) . '<br>' . PHP_EOL .
538
  );
539
  $email_content = str_replace( array_keys( $replaced_values ), array_values( $replaced_values ), $email_template );
540
  // Email subject and headers
541
+ $email_subject = wcj_get_option( 'wcj_offer_price_email_subject', __( 'Price Offer', 'woocommerce-jetpack' ) );
542
  $email_headers = 'Content-Type: text/html' . "\r\n" .
543
  'From: ' . $price_offer['customer_name'] . ' <' . $price_offer['customer_email'] . '>' . "\r\n" .
544
  'Reply-To: ' . $price_offer['customer_email'] . "\r\n";
548
  wc_mail( $price_offer['customer_email'], $email_subject, $email_content, $email_headers );
549
  }
550
  // Notice
551
+ wc_add_notice( wcj_get_option( 'wcj_offer_price_customer_notice', __( 'Your price offer has been sent.', 'woocommerce-jetpack' ) ), 'notice' );
552
  // Product meta (Offer Price History)
553
  if ( '' == ( $price_offers = get_post_meta( $product_id, '_' . 'wcj_price_offers', true ) ) ) {
554
  $price_offers = array();
includes/class-wcj-order-custom-statuses.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Module - Order Custom Statuses
4
  *
5
- * @version 5.2.0
6
  * @since 2.2.0
7
  * @author Pluggabl LLC.
8
  */
@@ -16,7 +16,7 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
16
  /**
17
  * Constructor.
18
  *
19
- * @version 5.2.0
20
  * @todo [feature] add options to change icon and icon's color for all statuses (i.e. not only custom)
21
  * @todo [dev] maybe rename module to "Custom Order Statuses"
22
  */
@@ -40,7 +40,7 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
40
 
41
  // Core
42
  add_filter( 'wc_order_statuses', array( $this, 'add_custom_statuses_to_filter' ), PHP_INT_MAX );
43
- if ( 'no' === get_option( 'wcj_load_modules_on_init', 'no' ) ) {
44
  add_action( 'init', array( $this, 'register_custom_post_statuses' ) );
45
  } else {
46
  $this->register_custom_post_statuses();
@@ -48,7 +48,7 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
48
 
49
  // CSS
50
  add_action( 'admin_head', array( $this, 'hook_statuses_icons_css' ) );
51
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_orders_custom_statuses_column_colored', 'no' ) ) ) {
52
  add_action( 'admin_head', array( $this, 'hook_statuses_column_css' ) );
53
  }
54
 
@@ -56,33 +56,33 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
56
  add_filter( 'woocommerce_default_order_status', array( $this, 'set_default_order_status' ), PHP_INT_MAX );
57
 
58
  // Add custom statuses to admin reports
59
- if ( 'yes' === get_option( 'wcj_orders_custom_statuses_add_to_reports' ) ) {
60
  add_filter( 'woocommerce_reports_order_statuses', array( $this, 'add_custom_order_statuses_to_reports' ), PHP_INT_MAX );
61
  }
62
 
63
  // Add all statuses to admin order bulk actions
64
- if ( 'yes' === get_option( 'wcj_orders_custom_statuses_add_to_bulk_actions' ) ) {
65
  add_action( 'admin_footer', array( $this, 'bulk_admin_footer' ), 11 );
66
  }
67
 
68
  // Order list actions
69
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_orders_custom_statuses_add_to_order_list_actions', 'no' ) ) ) {
70
  add_filter( 'woocommerce_admin_order_actions', array( $this, 'add_custom_status_actions_buttons' ), PHP_INT_MAX, 2 );
71
  add_action( 'admin_head', array( $this, 'add_custom_status_actions_buttons_css' ) );
72
  }
73
 
74
  // Order preview actions
75
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_orders_custom_statuses_add_to_order_preview_actions', 'no' ) ) ) {
76
  add_filter( 'woocommerce_admin_order_preview_actions', array( $this, 'add_custom_order_statuses_order_preview_actions' ), PHP_INT_MAX, 2 );
77
  }
78
 
79
  // "Processing" and "Complete" action buttons
80
- if ( 'hide' != apply_filters( 'booster_option', 'hide', get_option( 'wcj_orders_custom_statuses_processing_and_completed_actions', 'hide' ) ) ) {
81
  add_filter( 'woocommerce_admin_order_actions', array( $this, 'add_custom_status_to_processing_and_completed_actions' ), PHP_INT_MAX, 2 );
82
  }
83
 
84
  // Is order editable
85
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_orders_custom_statuses_is_order_editable', 'no' ) ) ) {
86
  add_filter( 'wc_order_is_editable', array( $this, 'add_custom_order_statuses_to_order_editable' ), PHP_INT_MAX, 2 );
87
  }
88
 
@@ -90,6 +90,10 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
90
  include_once( 'tools/class-wcj-order-statuses-tool.php' );
91
  $this->custom_statuses_tool = new WCJ_Order_Statuses_Tool( 'custom_statuses', $this );
92
 
 
 
 
 
93
  }
94
  }
95
 
@@ -100,7 +104,7 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
100
  * @since 3.1.2
101
  */
102
  function get_custom_order_statuses( $cut_prefix = false ) {
103
- $orders_custom_statuses = get_option( 'wcj_orders_custom_statuses_array', '' );
104
  if ( empty( $orders_custom_statuses ) ) {
105
  return array();
106
  } else {
@@ -203,7 +207,7 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
203
  }
204
  global $post;
205
  $default_actions = array();
206
- $show = apply_filters( 'booster_option', 'hide', get_option( 'wcj_orders_custom_statuses_processing_and_completed_actions', 'hide' ) );
207
  if (
208
  ( 'show_both' === $show || 'show_processing' === $show ) &&
209
  $_order->has_status( array_merge( array( 'pending', 'on-hold' ), $custom_order_statuses_without_wc_prefix ) )
@@ -262,7 +266,7 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
262
  'color' => '#999999',
263
  'text_color' => '#000000',
264
  );
265
- if ( '' != ( $icon_data = get_option( 'wcj_orders_custom_status_icon_data_' . $status_slug_without_wc_prefix, '' ) ) ) {
266
  $return['content'] = $icon_data['content'];
267
  $return['color'] = $icon_data['color'];
268
  if ( isset( $icon_data['text_color'] ) ) {
@@ -282,7 +286,7 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
282
  $custom_order_statuses = $this->get_custom_order_statuses( true );
283
  foreach ( $custom_order_statuses as $slug => $label ) {
284
  $icon_data = $this->get_status_icon_data( $slug );
285
- $color_style = ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_orders_custom_statuses_add_to_order_list_actions_colored', 'no' ) ) ) ?
286
  ' color: ' . $icon_data['color'] . ' !important;' : '';
287
  echo '<style>.view.' . $slug . '::after { font-family: WooCommerce !important;' . $color_style .
288
  ' content: "\\' . $icon_data['content'] . '" !important; }</style>';
@@ -308,7 +312,19 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
308
  * @version 3.2.2
309
  */
310
  function set_default_order_status( $status ) {
311
- return ( 'wcj_no_changes' != ( $default_status = get_option( 'wcj_orders_custom_statuses_default_status', 'pending' ) ) ? $default_status : $status );
 
 
 
 
 
 
 
 
 
 
 
 
312
  }
313
 
314
  /**
@@ -339,7 +355,7 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
339
  * @return mixed
340
  */
341
  function cut_prefix() {
342
- return filter_var( get_option( 'wcj_orders_custom_statuses_remove_prefix', 'no' ), FILTER_VALIDATE_BOOLEAN );
343
  }
344
 
345
  /**
2
  /**
3
  * Booster for WooCommerce - Module - Order Custom Statuses
4
  *
5
+ * @version 5.3.3
6
  * @since 2.2.0
7
  * @author Pluggabl LLC.
8
  */
16
  /**
17
  * Constructor.
18
  *
19
+ * @version 5.3.3
20
  * @todo [feature] add options to change icon and icon's color for all statuses (i.e. not only custom)
21
  * @todo [dev] maybe rename module to "Custom Order Statuses"
22
  */
40
 
41
  // Core
42
  add_filter( 'wc_order_statuses', array( $this, 'add_custom_statuses_to_filter' ), PHP_INT_MAX );
43
+ if ( 'no' === wcj_get_option( 'wcj_load_modules_on_init', 'no' ) ) {
44
  add_action( 'init', array( $this, 'register_custom_post_statuses' ) );
45
  } else {
46
  $this->register_custom_post_statuses();
48
 
49
  // CSS
50
  add_action( 'admin_head', array( $this, 'hook_statuses_icons_css' ) );
51
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_orders_custom_statuses_column_colored', 'no' ) ) ) {
52
  add_action( 'admin_head', array( $this, 'hook_statuses_column_css' ) );
53
  }
54
 
56
  add_filter( 'woocommerce_default_order_status', array( $this, 'set_default_order_status' ), PHP_INT_MAX );
57
 
58
  // Add custom statuses to admin reports
59
+ if ( 'yes' === wcj_get_option( 'wcj_orders_custom_statuses_add_to_reports' ) ) {
60
  add_filter( 'woocommerce_reports_order_statuses', array( $this, 'add_custom_order_statuses_to_reports' ), PHP_INT_MAX );
61
  }
62
 
63
  // Add all statuses to admin order bulk actions
64
+ if ( 'yes' === wcj_get_option( 'wcj_orders_custom_statuses_add_to_bulk_actions' ) ) {
65
  add_action( 'admin_footer', array( $this, 'bulk_admin_footer' ), 11 );
66
  }
67
 
68
  // Order list actions
69
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_orders_custom_statuses_add_to_order_list_actions', 'no' ) ) ) {
70
  add_filter( 'woocommerce_admin_order_actions', array( $this, 'add_custom_status_actions_buttons' ), PHP_INT_MAX, 2 );
71
  add_action( 'admin_head', array( $this, 'add_custom_status_actions_buttons_css' ) );
72
  }
73
 
74
  // Order preview actions
75
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_orders_custom_statuses_add_to_order_preview_actions', 'no' ) ) ) {
76
  add_filter( 'woocommerce_admin_order_preview_actions', array( $this, 'add_custom_order_statuses_order_preview_actions' ), PHP_INT_MAX, 2 );
77
  }
78
 
79
  // "Processing" and "Complete" action buttons
80
+ if ( 'hide' != apply_filters( 'booster_option', 'hide', wcj_get_option( 'wcj_orders_custom_statuses_processing_and_completed_actions', 'hide' ) ) ) {
81
  add_filter( 'woocommerce_admin_order_actions', array( $this, 'add_custom_status_to_processing_and_completed_actions' ), PHP_INT_MAX, 2 );
82
  }
83
 
84
  // Is order editable
85
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_orders_custom_statuses_is_order_editable', 'no' ) ) ) {
86
  add_filter( 'wc_order_is_editable', array( $this, 'add_custom_order_statuses_to_order_editable' ), PHP_INT_MAX, 2 );
87
  }
88
 
90
  include_once( 'tools/class-wcj-order-statuses-tool.php' );
91
  $this->custom_statuses_tool = new WCJ_Order_Statuses_Tool( 'custom_statuses', $this );
92
 
93
+ // Default order status forcefully
94
+ if ( 'yes' === wcj_get_option( 'wcj_orders_custom_statuses_default_status_forcefully', 'no' ) ) {
95
+ add_action( 'woocommerce_thankyou', array( $this, 'set_default_order_status_forcefully' ), PHP_INT_MAX, 1 );
96
+ }
97
  }
98
  }
99
 
104
  * @since 3.1.2
105
  */
106
  function get_custom_order_statuses( $cut_prefix = false ) {
107
+ $orders_custom_statuses = wcj_get_option( 'wcj_orders_custom_statuses_array', '' );
108
  if ( empty( $orders_custom_statuses ) ) {
109
  return array();
110
  } else {
207
  }
208
  global $post;
209
  $default_actions = array();
210
+ $show = apply_filters( 'booster_option', 'hide', wcj_get_option( 'wcj_orders_custom_statuses_processing_and_completed_actions', 'hide' ) );
211
  if (
212
  ( 'show_both' === $show || 'show_processing' === $show ) &&
213
  $_order->has_status( array_merge( array( 'pending', 'on-hold' ), $custom_order_statuses_without_wc_prefix ) )
266
  'color' => '#999999',
267
  'text_color' => '#000000',
268
  );
269
+ if ( '' != ( $icon_data = wcj_get_option( 'wcj_orders_custom_status_icon_data_' . $status_slug_without_wc_prefix, '' ) ) ) {
270
  $return['content'] = $icon_data['content'];
271
  $return['color'] = $icon_data['color'];
272
  if ( isset( $icon_data['text_color'] ) ) {
286
  $custom_order_statuses = $this->get_custom_order_statuses( true );
287
  foreach ( $custom_order_statuses as $slug => $label ) {
288
  $icon_data = $this->get_status_icon_data( $slug );
289
+ $color_style = ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_orders_custom_statuses_add_to_order_list_actions_colored', 'no' ) ) ) ?
290
  ' color: ' . $icon_data['color'] . ' !important;' : '';
291
  echo '<style>.view.' . $slug . '::after { font-family: WooCommerce !important;' . $color_style .
292
  ' content: "\\' . $icon_data['content'] . '" !important; }</style>';
312
  * @version 3.2.2
313
  */
314
  function set_default_order_status( $status ) {
315
+ return ( 'wcj_no_changes' != ( $default_status = wcj_get_option( 'wcj_orders_custom_statuses_default_status', 'pending' ) ) ? $default_status : $status );
316
+ }
317
+
318
+ /**
319
+ * set_default_order_status_forcefully.
320
+ *
321
+ * @version 5.3.3
322
+ * @since 5.3.3
323
+ */
324
+ function set_default_order_status_forcefully( $order_id ){
325
+ if( ! $order_id ) return;
326
+ $order = wc_get_order( $order_id );
327
+ $order->update_status( wcj_get_option( 'wcj_orders_custom_statuses_default_status' ) );
328
  }
329
 
330
  /**
355
  * @return mixed
356
  */
357
  function cut_prefix() {
358
+ return filter_var( wcj_get_option( 'wcj_orders_custom_statuses_remove_prefix', 'no' ), FILTER_VALIDATE_BOOLEAN );
359
  }
360
 
361
  /**
includes/class-wcj-order-min-amount.php CHANGED
@@ -45,11 +45,11 @@ class WCJ_Order_Min_Amount extends WCJ_Module {
45
  */
46
  function add_order_minimum_amount_hooks() {
47
  $is_order_minimum_amount_enabled = false;
48
- if ( get_option( 'wcj_order_minimum_amount', 0 ) > 0 ) {
49
  $is_order_minimum_amount_enabled = true;
50
  } else {
51
  foreach ( wcj_get_user_roles() as $role_key => $role_data ) {
52
- if ( get_option( 'wcj_order_minimum_amount_by_user_role_' . $role_key, 0 ) > 0 ) {
53
  $is_order_minimum_amount_enabled = true;
54
  break;
55
  }
@@ -58,7 +58,7 @@ class WCJ_Order_Min_Amount extends WCJ_Module {
58
  if ( $is_order_minimum_amount_enabled ) {
59
  add_action( 'woocommerce_checkout_process', array( $this, 'order_minimum_amount' ) );
60
  add_action( 'woocommerce_before_cart', array( $this, 'order_minimum_amount' ) );
61
- if ( 'yes' === get_option( 'wcj_order_minimum_amount_stop_from_seeing_checkout', 'no' ) ) {
62
  add_action( 'wp', array( $this, 'stop_from_seeing_checkout' ), 100 );
63
  }
64
  }
@@ -85,11 +85,11 @@ class WCJ_Order_Min_Amount extends WCJ_Module {
85
  * @since 2.5.3
86
  */
87
  function get_order_minimum_amount_with_user_roles() {
88
- $minimum = get_option( 'wcj_order_minimum_amount', 0 );
89
  $current_user_role = wcj_get_current_user_first_role();
90
  foreach ( wcj_get_user_roles() as $role_key => $role_data ) {
91
  if ( $role_key === $current_user_role ) {
92
- $order_minimum_amount_by_user_role = get_option( 'wcj_order_minimum_amount_by_user_role_' . $role_key, 0 );
93
  if ( $order_minimum_amount_by_user_role > 0 ) {
94
  $minimum = $order_minimum_amount_by_user_role;
95
  }
@@ -105,7 +105,7 @@ class WCJ_Order_Min_Amount extends WCJ_Module {
105
  $minimum = WCJ()->modules['price_by_country']->core->change_price( $minimum, null );
106
  }
107
  // WooCommerce Multilingual
108
- if ( 'yes' === get_option( 'wcj_order_minimum_compatibility_wpml_multilingual', 'no' ) ) {
109
  global $woocommerce_wpml;
110
  $minimum = ! empty( $woocommerce_wpml ) ? $woocommerce_wpml->multi_currency->prices->convert_price_amount( $minimum ) : $minimum;
111
  }
@@ -125,15 +125,15 @@ class WCJ_Order_Min_Amount extends WCJ_Module {
125
  }
126
  WC()->cart->calculate_totals();
127
  $cart_total = WC()->cart->total;
128
- if ( 'yes' === get_option( 'wcj_order_minimum_amount_exclude_shipping', 'no' ) ) {
129
  $shipping_total = isset( WC()->cart->shipping_total ) ? WC()->cart->shipping_total : 0;
130
  $shipping_tax_total = isset( WC()->cart->shipping_tax_total ) ? WC()->cart->shipping_tax_total : 0;
131
  $cart_total -= ( $shipping_total + $shipping_tax_total );
132
  }
133
- if ( 'yes' === get_option( 'wcj_order_minimum_amount_exclude_discounts', 'no' ) ) {
134
  $cart_total += ( WC()->cart->get_cart_discount_total() + WC()->cart->get_cart_discount_tax_total() );
135
  }
136
- if ('yes' === get_option( 'wcj_order_minimum_amount_exclude_yith_gift_card_discount', 'no' ) ) {
137
  $cart_total += $this->yith_gift_card_discount;
138
  }
139
  return $cart_total;
@@ -153,10 +153,10 @@ class WCJ_Order_Min_Amount extends WCJ_Module {
153
  $cart_total = $this->get_cart_total_for_minimal_order_amount();
154
  if ( $cart_total < $minimum ) {
155
  if ( is_cart() ) {
156
- if ( 'yes' === get_option( 'wcj_order_minimum_amount_cart_notice_enabled', 'no' ) ) {
157
- $notice_function = get_option( 'wcj_order_minimum_amount_cart_notice_function', 'wc_print_notice' );
158
  $notice_function(
159
- sprintf( apply_filters( 'booster_option', 'You must have an order with a minimum of %s to place your order, your current order total is %s.', get_option( 'wcj_order_minimum_amount_cart_notice_message' ) ),
160
  wc_price( $minimum ),
161
  wc_price( $cart_total )
162
  ),
@@ -165,7 +165,7 @@ class WCJ_Order_Min_Amount extends WCJ_Module {
165
  }
166
  } else {
167
  wc_add_notice(
168
- sprintf( apply_filters( 'booster_option', 'You must have an order with a minimum of %s to place your order, your current order total is %s.', get_option( 'wcj_order_minimum_amount_error_message' ) ),
169
  wc_price( $minimum ),
170
  wc_price( $cart_total )
171
  ),
45
  */
46
  function add_order_minimum_amount_hooks() {
47
  $is_order_minimum_amount_enabled = false;
48
+ if ( wcj_get_option( 'wcj_order_minimum_amount', 0 ) > 0 ) {
49
  $is_order_minimum_amount_enabled = true;
50
  } else {
51
  foreach ( wcj_get_user_roles() as $role_key => $role_data ) {
52
+ if ( wcj_get_option( 'wcj_order_minimum_amount_by_user_role_' . $role_key, 0 ) > 0 ) {
53
  $is_order_minimum_amount_enabled = true;
54
  break;
55
  }
58
  if ( $is_order_minimum_amount_enabled ) {
59
  add_action( 'woocommerce_checkout_process', array( $this, 'order_minimum_amount' ) );
60
  add_action( 'woocommerce_before_cart', array( $this, 'order_minimum_amount' ) );
61
+ if ( 'yes' === wcj_get_option( 'wcj_order_minimum_amount_stop_from_seeing_checkout', 'no' ) ) {
62
  add_action( 'wp', array( $this, 'stop_from_seeing_checkout' ), 100 );
63
  }
64
  }
85
  * @since 2.5.3
86
  */
87
  function get_order_minimum_amount_with_user_roles() {
88
+ $minimum = wcj_get_option( 'wcj_order_minimum_amount', 0 );
89
  $current_user_role = wcj_get_current_user_first_role();
90
  foreach ( wcj_get_user_roles() as $role_key => $role_data ) {
91
  if ( $role_key === $current_user_role ) {
92
+ $order_minimum_amount_by_user_role = wcj_get_option( 'wcj_order_minimum_amount_by_user_role_' . $role_key, 0 );
93
  if ( $order_minimum_amount_by_user_role > 0 ) {
94
  $minimum = $order_minimum_amount_by_user_role;
95
  }
105
  $minimum = WCJ()->modules['price_by_country']->core->change_price( $minimum, null );
106
  }
107
  // WooCommerce Multilingual
108
+ if ( 'yes' === wcj_get_option( 'wcj_order_minimum_compatibility_wpml_multilingual', 'no' ) ) {
109
  global $woocommerce_wpml;
110
  $minimum = ! empty( $woocommerce_wpml ) ? $woocommerce_wpml->multi_currency->prices->convert_price_amount( $minimum ) : $minimum;
111
  }
125
  }
126
  WC()->cart->calculate_totals();
127
  $cart_total = WC()->cart->total;
128
+ if ( 'yes' === wcj_get_option( 'wcj_order_minimum_amount_exclude_shipping', 'no' ) ) {
129
  $shipping_total = isset( WC()->cart->shipping_total ) ? WC()->cart->shipping_total : 0;
130
  $shipping_tax_total = isset( WC()->cart->shipping_tax_total ) ? WC()->cart->shipping_tax_total : 0;
131
  $cart_total -= ( $shipping_total + $shipping_tax_total );
132
  }
133
+ if ( 'yes' === wcj_get_option( 'wcj_order_minimum_amount_exclude_discounts', 'no' ) ) {
134
  $cart_total += ( WC()->cart->get_cart_discount_total() + WC()->cart->get_cart_discount_tax_total() );
135
  }
136
+ if ('yes' === wcj_get_option( 'wcj_order_minimum_amount_exclude_yith_gift_card_discount', 'no' ) ) {
137
  $cart_total += $this->yith_gift_card_discount;
138
  }
139
  return $cart_total;
153
  $cart_total = $this->get_cart_total_for_minimal_order_amount();
154
  if ( $cart_total < $minimum ) {
155
  if ( is_cart() ) {
156
+ if ( 'yes' === wcj_get_option( 'wcj_order_minimum_amount_cart_notice_enabled', 'no' ) ) {
157
+ $notice_function = wcj_get_option( 'wcj_order_minimum_amount_cart_notice_function', 'wc_print_notice' );
158
  $notice_function(
159
+ sprintf( apply_filters( 'booster_option', 'You must have an order with a minimum of %s to place your order, your current order total is %s.', wcj_get_option( 'wcj_order_minimum_amount_cart_notice_message' ) ),
160
  wc_price( $minimum ),
161
  wc_price( $cart_total )
162
  ),
165
  }
166
  } else {
167
  wc_add_notice(
168
+ sprintf( apply_filters( 'booster_option', 'You must have an order with a minimum of %s to place your order, your current order total is %s.', wcj_get_option( 'wcj_order_minimum_amount_error_message' ) ),
169
  wc_price( $minimum ),
170
  wc_price( $cart_total )
171
  ),
includes/class-wcj-order-numbers.php CHANGED
@@ -40,12 +40,12 @@ class WCJ_Order_Numbers extends WCJ_Module {
40
  add_action( 'wp_insert_post', array( $this, 'add_new_order_number' ), PHP_INT_MAX );
41
  add_filter( 'woocommerce_order_number', array( $this, 'display_order_number' ), PHP_INT_MAX, 2 );
42
  // Order tracking
43
- if ( 'yes' === get_option( 'wcj_order_number_order_tracking_enabled', 'yes' ) ) {
44
  add_filter( 'woocommerce_shortcode_order_tracking_order_id', array( $this, 'add_order_number_to_tracking' ), PHP_INT_MAX );
45
  add_action( 'init', array( $this, 'remove_order_tracking_sanitize_order_id_filter' ) );
46
  }
47
  // Search by custom number
48
- if ( 'yes' === get_option( 'wcj_order_number_search_by_custom_number_enabled', 'yes' ) ) {
49
  add_action( 'pre_get_posts', array( $this, 'search_by_custom_number' ) );
50
  }
51
  // "WooCommerce Subscriptions" plugin
@@ -54,7 +54,7 @@ class WCJ_Order_Numbers extends WCJ_Module {
54
  add_filter( 'wcs_' . $woocommerce_subscriptions_type . '_meta', array( $this, 'woocommerce_subscriptions_remove_meta_copy' ), PHP_INT_MAX, 3 );
55
  }
56
  // Editable order number
57
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_order_number_editable_order_number_meta_box_enabled', 'no' ) ) ) {
58
  $this->meta_box_screen = 'shop_order';
59
  $this->meta_box_context = 'side';
60
  $this->meta_box_priority = 'high';
@@ -64,7 +64,7 @@ class WCJ_Order_Numbers extends WCJ_Module {
64
 
65
  // Compatibility with WPNotif plugin
66
  add_action( 'admin_init', function () {
67
- if ( 'yes' === get_option( 'wcj_order_numbers_compatibility_wpnotif', 'no' ) ) {
68
  remove_filter( 'wpnotif_filter_message', 'wpnotif_add_tracking_details', 10, 2 );
69
  add_filter( 'wpnotif_filter_message', array( $this, 'wpnotif_add_tracking_details' ), 10, 2 );
70
  }
@@ -194,10 +194,10 @@ class WCJ_Order_Numbers extends WCJ_Module {
194
  remove_action( 'pre_get_posts', array( $this, 'search_by_custom_number' ) );
195
 
196
  // Get prefix and suffix options
197
- $prefix = do_shortcode( get_option( 'wcj_order_number_prefix', '' ) );
198
- $prefix .= date_i18n( get_option( 'wcj_order_number_date_prefix', '' ) );
199
- $suffix = do_shortcode( get_option( 'wcj_order_number_suffix', '' ) );
200
- $suffix .= date_i18n( get_option( 'wcj_order_number_date_suffix', '' ) );
201
 
202
  // Ignore suffix and prefix from search input
203
  $search_no_suffix = preg_replace( "/\A{$prefix}/i", '', $search );
@@ -283,18 +283,18 @@ class WCJ_Order_Numbers extends WCJ_Module {
283
  function display_order_number( $order_number, $order ) {
284
  $order_id = wcj_get_order_id( $order );
285
  $order_number_meta = get_post_meta( $order_id , '_wcj_order_number', true );
286
- if ( '' == $order_number_meta || 'no' === get_option( 'wcj_order_number_sequential_enabled', 'yes' ) ) {
287
  $order_number_meta = $order_id;
288
  }
289
  $order_timestamp = strtotime( ( WCJ_IS_WC_VERSION_BELOW_3 ? $order->post->post_date : $order->get_date_created() ) );
290
  $order_number = apply_filters( 'booster_option',
291
- sprintf( '%s%s', do_shortcode( get_option( 'wcj_order_number_prefix', '' ) ), $order_number_meta ),
292
- sprintf( '%s%s%0' . get_option( 'wcj_order_number_min_width', 0 ) . 's%s%s',
293
- do_shortcode( get_option( 'wcj_order_number_prefix', '' ) ),
294
- date_i18n( get_option( 'wcj_order_number_date_prefix', '' ), $order_timestamp ),
295
  $order_number_meta,
296
- do_shortcode( get_option( 'wcj_order_number_suffix', '' ) ),
297
- date_i18n( get_option( 'wcj_order_number_date_suffix', '' ), $order_timestamp )
298
  )
299
  );
300
  if ( false !== strpos( $order_number, '%order_items_skus%' ) ) {
@@ -316,9 +316,9 @@ class WCJ_Order_Numbers extends WCJ_Module {
316
  $this->renumerate_orders();
317
  $result_message = '<p><div class="updated"><p><strong>' . __( 'Orders successfully renumerated!', 'woocommerce-jetpack' ) . '</strong></p></div></p>';
318
  } else {
319
- if ( 'yes' === get_option( 'wcj_order_number_sequential_enabled', 'yes' ) ) {
320
  $result_message .= '<p>' . sprintf( __( 'Sequential number generation is enabled. Next order number will be %s.', 'woocommerce-jetpack' ),
321
- '<code>' . get_option( 'wcj_order_number_counter', 1 ) . '</code>' ) . '</p>';
322
  }
323
  }
324
  $html = '';
@@ -354,8 +354,8 @@ class WCJ_Order_Numbers extends WCJ_Module {
354
  * @todo use transactions on `wcj_order_number_use_mysql_transaction_enabled`
355
  */
356
  function maybe_reset_sequential_counter( $current_order_number, $order_id ) {
357
- if ( 'no' != ( $reset_period = get_option( 'wcj_order_number_counter_reset_enabled', 'no' ) ) ) {
358
- $previous_order_date = get_option( 'wcj_order_number_counter_previous_order_date', 0 );
359
  $current_order_date = strtotime( wcj_get_order_date( wc_get_order( $order_id ) ) );
360
  update_option( 'wcj_order_number_counter_previous_order_date', $current_order_date );
361
  if ( 0 != $previous_order_date ) {
@@ -392,17 +392,17 @@ class WCJ_Order_Numbers extends WCJ_Module {
392
  * Add/update order_number meta to order.
393
  *
394
  * @version 4.0.0
395
- * @todo (maybe) save order ID instead of `$current_order_number = ''` (if `'no' === get_option( 'wcj_order_number_sequential_enabled', 'yes' )`)
396
  */
397
  function add_order_number_meta( $order_id, $do_overwrite ) {
398
  if ( 'shop_order' !== get_post_type( $order_id ) || 'auto-draft' === get_post_status( $order_id ) ) {
399
  return;
400
  }
401
  if ( true === $do_overwrite || 0 == get_post_meta( $order_id, '_wcj_order_number', true ) ) {
402
- if ( $order_id < get_option( 'wcj_order_numbers_min_order_id', 0 ) ) {
403
  return;
404
  }
405
- if ( 'yes' === get_option( 'wcj_order_number_sequential_enabled', 'yes' ) && 'yes' === get_option( 'wcj_order_number_use_mysql_transaction_enabled', 'yes' ) ) {
406
  global $wpdb;
407
  $wpdb->query( 'START TRANSACTION' );
408
  $wp_options_table = $wpdb->prefix . 'options';
@@ -420,12 +420,12 @@ class WCJ_Order_Numbers extends WCJ_Module {
420
  $wpdb->query( 'ROLLBACK' ); // something went wrong, Rollback
421
  }
422
  } else {
423
- if ( 'hash_crc32' === get_option( 'wcj_order_number_sequential_enabled', 'yes' ) ) {
424
  $current_order_number = sprintf( "%u", crc32( $order_id ) );
425
- } elseif ( 'yes' === get_option( 'wcj_order_number_sequential_enabled', 'yes' ) ) {
426
- $current_order_number = $this->maybe_reset_sequential_counter( get_option( 'wcj_order_number_counter', 1 ), $order_id );
427
  update_option( 'wcj_order_number_counter', ( $current_order_number + 1 ) );
428
- } else { // 'no' === get_option( 'wcj_order_number_sequential_enabled', 'yes' ) // order ID
429
  $current_order_number = '';
430
  }
431
  update_post_meta( $order_id, '_wcj_order_number', apply_filters( 'wcj_order_number_meta', $current_order_number, $order_id ) );
@@ -442,7 +442,7 @@ class WCJ_Order_Numbers extends WCJ_Module {
442
  * @todo (maybe) set default value for `wcj_order_numbers_renumerate_tool_orderby` to `ID` (instead of `date`)
443
  */
444
  function renumerate_orders() {
445
- if ( 'yes' === get_option( 'wcj_order_number_sequential_enabled', 'yes' ) && 'no' != get_option( 'wcj_order_number_counter_reset_enabled', 'no' ) ) {
446
  update_option( 'wcj_order_number_counter_previous_order_date', 0 );
447
  }
448
  $offset = 0;
@@ -452,8 +452,8 @@ class WCJ_Order_Numbers extends WCJ_Module {
452
  'post_type' => 'shop_order',
453
  'post_status' => 'any',
454
  'posts_per_page' => $block_size,
455
- 'orderby' => get_option( 'wcj_order_numbers_renumerate_tool_orderby', 'date' ),
456
- 'order' => get_option( 'wcj_order_numbers_renumerate_tool_order', 'ASC' ),
457
  'offset' => $offset,
458
  'fields' => 'ids',
459
  );
40
  add_action( 'wp_insert_post', array( $this, 'add_new_order_number' ), PHP_INT_MAX );
41
  add_filter( 'woocommerce_order_number', array( $this, 'display_order_number' ), PHP_INT_MAX, 2 );
42
  // Order tracking
43
+ if ( 'yes' === wcj_get_option( 'wcj_order_number_order_tracking_enabled', 'yes' ) ) {
44
  add_filter( 'woocommerce_shortcode_order_tracking_order_id', array( $this, 'add_order_number_to_tracking' ), PHP_INT_MAX );
45
  add_action( 'init', array( $this, 'remove_order_tracking_sanitize_order_id_filter' ) );
46
  }
47
  // Search by custom number
48
+ if ( 'yes' === wcj_get_option( 'wcj_order_number_search_by_custom_number_enabled', 'yes' ) ) {
49
  add_action( 'pre_get_posts', array( $this, 'search_by_custom_number' ) );
50
  }
51
  // "WooCommerce Subscriptions" plugin
54
  add_filter( 'wcs_' . $woocommerce_subscriptions_type . '_meta', array( $this, 'woocommerce_subscriptions_remove_meta_copy' ), PHP_INT_MAX, 3 );
55
  }
56
  // Editable order number
57
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_order_number_editable_order_number_meta_box_enabled', 'no' ) ) ) {
58
  $this->meta_box_screen = 'shop_order';
59
  $this->meta_box_context = 'side';
60
  $this->meta_box_priority = 'high';
64
 
65
  // Compatibility with WPNotif plugin
66
  add_action( 'admin_init', function () {
67
+ if ( 'yes' === wcj_get_option( 'wcj_order_numbers_compatibility_wpnotif', 'no' ) ) {
68
  remove_filter( 'wpnotif_filter_message', 'wpnotif_add_tracking_details', 10, 2 );
69
  add_filter( 'wpnotif_filter_message', array( $this, 'wpnotif_add_tracking_details' ), 10, 2 );
70
  }
194
  remove_action( 'pre_get_posts', array( $this, 'search_by_custom_number' ) );
195
 
196
  // Get prefix and suffix options
197
+ $prefix = do_shortcode( wcj_get_option( 'wcj_order_number_prefix', '' ) );
198
+ $prefix .= date_i18n( wcj_get_option( 'wcj_order_number_date_prefix', '' ) );
199
+ $suffix = do_shortcode( wcj_get_option( 'wcj_order_number_suffix', '' ) );
200
+ $suffix .= date_i18n( wcj_get_option( 'wcj_order_number_date_suffix', '' ) );
201
 
202
  // Ignore suffix and prefix from search input
203
  $search_no_suffix = preg_replace( "/\A{$prefix}/i", '', $search );
283
  function display_order_number( $order_number, $order ) {
284
  $order_id = wcj_get_order_id( $order );
285
  $order_number_meta = get_post_meta( $order_id , '_wcj_order_number', true );
286
+ if ( '' == $order_number_meta || 'no' === wcj_get_option( 'wcj_order_number_sequential_enabled', 'yes' ) ) {
287
  $order_number_meta = $order_id;
288
  }
289
  $order_timestamp = strtotime( ( WCJ_IS_WC_VERSION_BELOW_3 ? $order->post->post_date : $order->get_date_created() ) );
290
  $order_number = apply_filters( 'booster_option',
291
+ sprintf( '%s%s', do_shortcode( wcj_get_option( 'wcj_order_number_prefix', '' ) ), $order_number_meta ),
292
+ sprintf( '%s%s%0' . wcj_get_option( 'wcj_order_number_min_width', 0 ) . 's%s%s',
293
+ do_shortcode( wcj_get_option( 'wcj_order_number_prefix', '' ) ),
294
+ date_i18n( wcj_get_option( 'wcj_order_number_date_prefix', '' ), $order_timestamp ),
295
  $order_number_meta,
296
+ do_shortcode( wcj_get_option( 'wcj_order_number_suffix', '' ) ),
297
+ date_i18n( wcj_get_option( 'wcj_order_number_date_suffix', '' ), $order_timestamp )
298
  )
299
  );
300
  if ( false !== strpos( $order_number, '%order_items_skus%' ) ) {
316
  $this->renumerate_orders();
317
  $result_message = '<p><div class="updated"><p><strong>' . __( 'Orders successfully renumerated!', 'woocommerce-jetpack' ) . '</strong></p></div></p>';
318
  } else {
319
+ if ( 'yes' === wcj_get_option( 'wcj_order_number_sequential_enabled', 'yes' ) ) {
320
  $result_message .= '<p>' . sprintf( __( 'Sequential number generation is enabled. Next order number will be %s.', 'woocommerce-jetpack' ),
321
+ '<code>' . wcj_get_option( 'wcj_order_number_counter', 1 ) . '</code>' ) . '</p>';
322
  }
323
  }
324
  $html = '';
354
  * @todo use transactions on `wcj_order_number_use_mysql_transaction_enabled`
355
  */
356
  function maybe_reset_sequential_counter( $current_order_number, $order_id ) {
357
+ if ( 'no' != ( $reset_period = wcj_get_option( 'wcj_order_number_counter_reset_enabled', 'no' ) ) ) {
358
+ $previous_order_date = wcj_get_option( 'wcj_order_number_counter_previous_order_date', 0 );
359
  $current_order_date = strtotime( wcj_get_order_date( wc_get_order( $order_id ) ) );
360
  update_option( 'wcj_order_number_counter_previous_order_date', $current_order_date );
361
  if ( 0 != $previous_order_date ) {
392
  * Add/update order_number meta to order.
393
  *
394
  * @version 4.0.0
395
+ * @todo (maybe) save order ID instead of `$current_order_number = ''` (if `'no' === wcj_get_option( 'wcj_order_number_sequential_enabled', 'yes' )`)
396
  */
397
  function add_order_number_meta( $order_id, $do_overwrite ) {
398
  if ( 'shop_order' !== get_post_type( $order_id ) || 'auto-draft' === get_post_status( $order_id ) ) {
399
  return;
400
  }
401
  if ( true === $do_overwrite || 0 == get_post_meta( $order_id, '_wcj_order_number', true ) ) {
402
+ if ( $order_id < wcj_get_option( 'wcj_order_numbers_min_order_id', 0 ) ) {
403
  return;
404
  }
405
+ if ( 'yes' === wcj_get_option( 'wcj_order_number_sequential_enabled', 'yes' ) && 'yes' === wcj_get_option( 'wcj_order_number_use_mysql_transaction_enabled', 'yes' ) ) {
406
  global $wpdb;
407
  $wpdb->query( 'START TRANSACTION' );
408
  $wp_options_table = $wpdb->prefix . 'options';
420
  $wpdb->query( 'ROLLBACK' ); // something went wrong, Rollback
421
  }
422
  } else {
423
+ if ( 'hash_crc32' === wcj_get_option( 'wcj_order_number_sequential_enabled', 'yes' ) ) {
424
  $current_order_number = sprintf( "%u", crc32( $order_id ) );
425
+ } elseif ( 'yes' === wcj_get_option( 'wcj_order_number_sequential_enabled', 'yes' ) ) {
426
+ $current_order_number = $this->maybe_reset_sequential_counter( wcj_get_option( 'wcj_order_number_counter', 1 ), $order_id );
427
  update_option( 'wcj_order_number_counter', ( $current_order_number + 1 ) );
428
+ } else { // 'no' === wcj_get_option( 'wcj_order_number_sequential_enabled', 'yes' ) // order ID
429
  $current_order_number = '';
430
  }
431
  update_post_meta( $order_id, '_wcj_order_number', apply_filters( 'wcj_order_number_meta', $current_order_number, $order_id ) );
442
  * @todo (maybe) set default value for `wcj_order_numbers_renumerate_tool_orderby` to `ID` (instead of `date`)
443
  */
444
  function renumerate_orders() {
445
+ if ( 'yes' === wcj_get_option( 'wcj_order_number_sequential_enabled', 'yes' ) && 'no' != wcj_get_option( 'wcj_order_number_counter_reset_enabled', 'no' ) ) {
446
  update_option( 'wcj_order_number_counter_previous_order_date', 0 );
447
  }
448
  $offset = 0;
452
  'post_type' => 'shop_order',
453
  'post_status' => 'any',
454
  'posts_per_page' => $block_size,
455
+ 'orderby' => wcj_get_option( 'wcj_order_numbers_renumerate_tool_orderby', 'date' ),
456
+ 'order' => wcj_get_option( 'wcj_order_numbers_renumerate_tool_order', 'ASC' ),
457
  'offset' => $offset,
458
  'fields' => 'ids',
459
  );
includes/class-wcj-order-quantities.php CHANGED
@@ -35,43 +35,43 @@ class WCJ_Order_Quantities extends WCJ_Module {
35
  if ( $this->is_enabled() ) {
36
  // Validation
37
  if (
38
- 'yes' === get_option( 'wcj_order_quantities_max_section_enabled', 'no' ) || 'yes' === get_option( 'wcj_order_quantities_min_section_enabled', 'no' ) ||
39
- 'yes' === get_option( 'wcj_order_quantities_step_section_enabled', 'no' )
40
  ) {
41
  add_action( 'woocommerce_checkout_process', array( $this, 'check_order_quantities' ) );
42
  add_action( 'woocommerce_before_cart', array( $this, 'check_order_quantities' ) );
43
- if ( 'yes' === get_option( 'wcj_order_quantities_stop_from_seeing_checkout', 'no' ) ) {
44
  add_action( 'wp', array( $this, 'stop_from_seeing_checkout' ), PHP_INT_MAX );
45
  }
46
  }
47
  // Min/max quantities
48
- if ( 'yes' === get_option( 'wcj_order_quantities_max_section_enabled', 'no' ) || 'yes' === get_option( 'wcj_order_quantities_min_section_enabled', 'no' ) ) {
49
  add_filter( 'woocommerce_available_variation', array( $this, 'set_quantity_input_min_max_variation' ), PHP_INT_MAX, 3 );
50
- if ( 'yes' === get_option( 'wcj_order_quantities_min_section_enabled', 'no' ) ) {
51
  add_filter( 'woocommerce_quantity_input_min', array( $this, 'set_quantity_input_min' ), PHP_INT_MAX, 2 );
52
  }
53
- if ( 'yes' === get_option( 'wcj_order_quantities_max_section_enabled', 'no' ) ) {
54
  add_filter( 'woocommerce_quantity_input_max', array( $this, 'set_quantity_input_max' ), PHP_INT_MAX, 2 );
55
  }
56
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_script' ) );
57
  }
58
  // Quantity step
59
- if ( 'yes' === get_option( 'wcj_order_quantities_step_section_enabled', 'no' ) ) {
60
  add_filter( 'woocommerce_quantity_input_step', array( $this, 'set_quantity_input_step' ), PHP_INT_MAX, 2 );
61
  }
62
  // Meta box
63
- $this->is_min_per_product_enabled = ( 'yes' === get_option( 'wcj_order_quantities_min_section_enabled', 'no' ) &&
64
- 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_order_quantities_min_per_item_quantity_per_product', 'no' ) ) );
65
- $this->is_max_per_product_enabled = ( 'yes' === get_option( 'wcj_order_quantities_max_section_enabled', 'no' ) &&
66
- 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_order_quantities_max_per_item_quantity_per_product', 'no' ) ) );
67
- $this->is_step_per_product_enabled = ( 'yes' === get_option( 'wcj_order_quantities_step_section_enabled', 'no' ) &&
68
- 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_order_quantities_step_per_product', 'no' ) ) );
69
  if ( $this->is_min_per_product_enabled || $this->is_max_per_product_enabled || $this->is_step_per_product_enabled ) {
70
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
71
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
72
  }
73
  // Limit cart items (i.e. "Single Item Cart" Mode)
74
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_order_quantities_single_item_cart_enabled', 'no' ) ) ) {
75
  add_filter( 'woocommerce_add_to_cart_validation', array( $this, 'single_item_cart' ), PHP_INT_MAX, 4 );
76
  }
77
  // For cart and `input_value`
@@ -81,7 +81,7 @@ class WCJ_Order_Quantities extends WCJ_Module {
81
  add_action( 'wp_footer', array( $this, 'sync_qty_input_with_add_to_cart_btn_on_loop' ) );
82
  add_filter( 'woocommerce_loop_add_to_cart_link', array( $this, 'replace_quantity_attribute_on_loop_cart_link' ), PHP_INT_MAX, 2 );
83
  // Decimal qty
84
- if ( 'yes' === get_option( 'wcj_order_quantities_decimal_qty_enabled', 'no' ) ) {
85
  add_action( 'init', array( $this, 'float_stock_amount' ) );
86
  add_action( 'woocommerce_quantity_input_pattern', array( $this, 'float_quantity_input_pattern' ) );
87
  }
@@ -214,16 +214,16 @@ class WCJ_Order_Quantities extends WCJ_Module {
214
  * @since 3.7.0
215
  */
216
  function set_quantity_input_args( $args, $product ) {
217
- if ( 'yes' === get_option( 'wcj_order_quantities_min_section_enabled', 'no' ) ) {
218
  $args['min_value'] = $this->set_quantity_input_min( $args['min_value'], $product );
219
  }
220
- if ( 'yes' === get_option( 'wcj_order_quantities_max_section_enabled', 'no' ) ) {
221
  $args['max_value'] = $this->set_quantity_input_max( $args['max_value'], $product );
222
  }
223
- if ( 'yes' === get_option( 'wcj_order_quantities_step_section_enabled', 'no' ) ) {
224
  $args['step'] = $this->set_quantity_input_step( $args['step'], $product );
225
  }
226
- if ( 'disabled' != ( $force_on_single = get_option( 'wcj_order_quantities_force_on_single', 'disabled' ) ) && is_product() ) {
227
  $args['input_value'] = ( 'min' === $force_on_single ?
228
  $this->set_quantity_input_min( $args['min_value'], $product ) : $this->set_quantity_input_max( $args['max_value'], $product ) );
229
  }
@@ -237,12 +237,12 @@ class WCJ_Order_Quantities extends WCJ_Module {
237
  * @since 3.7.0
238
  */
239
  function set_quantity_input_step( $qty, $product ) {
240
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_order_quantities_step_per_product', 'no' ) ) ) {
241
  if ( '' != ( $step = get_post_meta( wcj_get_product_id_or_variation_parent_id( $product ), '_' . 'wcj_order_quantities_step', true ) ) && 0 != $step ) {
242
  return $step;
243
  }
244
  }
245
- return ( 0 != ( $step = get_option( 'wcj_order_quantities_step', 1 ) ) ? $step : $qty );
246
  }
247
 
248
  /**
@@ -256,7 +256,7 @@ class WCJ_Order_Quantities extends WCJ_Module {
256
  if ( is_array( WC()->cart->cart_contents ) && 1 == count( WC()->cart->cart_contents ) && wcj_is_product_in_cart( ( 0 != $variation_id ? $variation_id : $product_id ) ) ) {
257
  return $passed;
258
  } else {
259
- wc_add_notice( get_option( 'wcj_order_quantities_single_item_cart_message',
260
  __( 'Only one item can be added to the cart. Clear the cart or finish the order, before adding another item to the cart.', 'woocommerce-jetpack' ) ), 'error' );
261
  return false;
262
  }
@@ -276,9 +276,9 @@ class WCJ_Order_Quantities extends WCJ_Module {
276
  $_product = wc_get_product();
277
  if ( $_product && $_product->is_type( 'variable' ) ) {
278
  $quantities_options = array(
279
- 'reset_to_min' => ( 'reset_to_min' === get_option( 'wcj_order_quantities_variable_variation_change', 'do_nothing' ) ),
280
- 'reset_to_max' => ( 'reset_to_max' === get_option( 'wcj_order_quantities_variable_variation_change', 'do_nothing' ) ),
281
- 'force_on_add_to_cart' => ( 'yes' === get_option( 'wcj_order_quantities_variable_force_on_add_to_cart', 'no' ) ),
282
  );
283
  $product_quantities = array();
284
  foreach ( $_product->get_available_variations() as $variation ) {
@@ -300,15 +300,15 @@ class WCJ_Order_Quantities extends WCJ_Module {
300
  * @since 3.2.2
301
  */
302
  function get_product_quantity( $min_or_max, $_product, $default_qty ) {
303
- if ( 'no' === get_option( 'wcj_order_quantities_' . $min_or_max . '_section_enabled', 'no' ) ) {
304
  return $default_qty;
305
  }
306
  if (
307
- 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_order_quantities_' . $min_or_max . '_per_item_quantity_per_product', 'no' ) ) &&
308
  0 != ( $max_or_max_per_item_quantity_per_product = get_post_meta( wcj_get_product_id( $_product ), '_' . 'wcj_order_quantities_' . $min_or_max, true ) )
309
  ) {
310
  return $max_or_max_per_item_quantity_per_product;
311
- } elseif ( 0 != ( $max_or_max_per_item_quantity = apply_filters( 'booster_option', 0, get_option( 'wcj_order_quantities_' . $min_or_max . '_per_item_quantity', 0 ) ) ) ) {
312
  return $max_or_max_per_item_quantity;
313
  } else {
314
  return $default_qty;
@@ -387,19 +387,19 @@ class WCJ_Order_Quantities extends WCJ_Module {
387
  return;
388
  }
389
  $cart_total_quantity = array_sum( $cart_item_quantities );
390
- if ( 'yes' === get_option( 'wcj_order_quantities_max_section_enabled', 'no' ) ) {
391
  if ( ! $this->check_quantities( 'max', $cart_item_quantities, $cart_total_quantity, false, true ) ) {
392
  wp_safe_redirect( wc_get_cart_url() );
393
  exit;
394
  }
395
  }
396
- if ( 'yes' === get_option( 'wcj_order_quantities_min_section_enabled', 'no' ) ) {
397
  if ( ! $this->check_quantities( 'min', $cart_item_quantities, $cart_total_quantity, false, true ) ) {
398
  wp_safe_redirect( wc_get_cart_url() );
399
  exit;
400
  }
401
  }
402
- if ( 'yes' === get_option( 'wcj_order_quantities_step_section_enabled', 'no' ) ) {
403
  if ( ! $this->check_quantities_step( $cart_item_quantities, false, true ) ) {
404
  wp_safe_redirect( wc_get_cart_url() );
405
  exit;
@@ -415,7 +415,7 @@ class WCJ_Order_Quantities extends WCJ_Module {
415
  */
416
  function print_message( $message_type, $_is_cart, $required_quantity, $total_quantity, $_product_id = 0 ) {
417
  if ( $_is_cart ) {
418
- if ( 'no' === get_option( 'wcj_order_quantities_cart_notice_enabled', 'no' ) ) {
419
  return;
420
  }
421
  }
@@ -425,7 +425,7 @@ class WCJ_Order_Quantities extends WCJ_Module {
425
  '%max_cart_total_quantity%' => $required_quantity,
426
  '%cart_total_quantity%' => $total_quantity,
427
  );
428
- $message_template = get_option( 'wcj_order_quantities_max_cart_total_message',
429
  __( 'Maximum allowed order quantity is %max_cart_total_quantity%. Your current order quantity is %cart_total_quantity%.', 'woocommerce-jetpack' ) );
430
  break;
431
  case 'min_cart_total_quantity':
@@ -433,7 +433,7 @@ class WCJ_Order_Quantities extends WCJ_Module {
433
  '%min_cart_total_quantity%' => $required_quantity,
434
  '%cart_total_quantity%' => $total_quantity,
435
  );
436
- $message_template = get_option( 'wcj_order_quantities_min_cart_total_message',
437
  __( 'Minimum allowed order quantity is %min_cart_total_quantity%. Your current order quantity is %cart_total_quantity%.', 'woocommerce-jetpack' ) );
438
  break;
439
  case 'max_per_item_quantity':
@@ -443,7 +443,7 @@ class WCJ_Order_Quantities extends WCJ_Module {
443
  '%item_quantity%' => $total_quantity,
444
  '%product_title%' => $_product->get_title(),
445
  );
446
- $message_template = get_option( 'wcj_order_quantities_max_per_item_message',
447
  __( 'Maximum allowed quantity for %product_title% is %max_per_item_quantity%. Your current item quantity is %item_quantity%.', 'woocommerce-jetpack' ) );
448
  break;
449
  case 'min_per_item_quantity':
@@ -453,7 +453,7 @@ class WCJ_Order_Quantities extends WCJ_Module {
453
  '%item_quantity%' => $total_quantity,
454
  '%product_title%' => $_product->get_title(),
455
  );
456
- $message_template = get_option( 'wcj_order_quantities_min_per_item_message',
457
  __( 'Minimum allowed quantity for %product_title% is %min_per_item_quantity%. Your current item quantity is %item_quantity%.', 'woocommerce-jetpack' ) );
458
  break;
459
  case 'step':
@@ -463,7 +463,7 @@ class WCJ_Order_Quantities extends WCJ_Module {
463
  '%item_quantity%' => $total_quantity,
464
  '%product_title%' => $_product->get_title(),
465
  );
466
- $message_template = get_option( 'wcj_order_quantities_step_message',
467
  __( 'Required step for %product_title% is %required_step%. Your current item quantity is %item_quantity%.', 'woocommerce-jetpack' ) );
468
  break;
469
  }
@@ -483,7 +483,7 @@ class WCJ_Order_Quantities extends WCJ_Module {
483
  */
484
  function check_step( $product_id, $product_qty_step, $quantity ) {
485
  $min_value = $this->get_product_quantity( 'min', wc_get_product( $product_id ), 0 );
486
- if ( 'yes' === get_option( 'wcj_order_quantities_decimal_qty_enabled', 'no' ) ) {
487
  $multiplier = floatval( 1000000 );
488
  $_min_value = intval( round( floatval( $min_value ) * $multiplier ) );
489
  $_quantity = intval( round( floatval( $quantity ) * $multiplier ) );
@@ -505,7 +505,7 @@ class WCJ_Order_Quantities extends WCJ_Module {
505
  * @since 4.2.0
506
  */
507
  function check_quantities_step( $cart_item_quantities, $_is_cart, $_return ) {
508
- if ( 'yes' != get_option( 'wcj_order_quantities_step_additional_validation_enabled', 'no' ) ) {
509
  return true;
510
  }
511
  if ( $this->is_step_per_product_enabled ) {
@@ -533,7 +533,7 @@ class WCJ_Order_Quantities extends WCJ_Module {
533
  }
534
  if (
535
  empty( $step ) &&
536
- 0 != ( $step = get_option( 'wcj_order_quantities_step', 1 ) )
537
  ) {
538
  foreach ( $cart_item_quantities as $_product_id => $cart_item_quantity ) {
539
  if ( $this->is_step_per_product_enabled && 0 != get_post_meta( $_product_id, '_' . 'wcj_order_quantities_step', true ) ) {
@@ -560,7 +560,7 @@ class WCJ_Order_Quantities extends WCJ_Module {
560
  * @since 2.9.0
561
  */
562
  function check_quantities( $min_or_max, $cart_item_quantities, $cart_total_quantity, $_is_cart, $_return ) {
563
- if ( 0 != ( $min_or_max_cart_total_quantity = get_option( 'wcj_order_quantities_' . $min_or_max . '_cart_total_quantity', 0 ) ) ) {
564
  if (
565
  ( 'max' === $min_or_max && $cart_total_quantity > $min_or_max_cart_total_quantity ) ||
566
  ( 'min' === $min_or_max && $cart_total_quantity < $min_or_max_cart_total_quantity )
@@ -572,7 +572,7 @@ class WCJ_Order_Quantities extends WCJ_Module {
572
  }
573
  }
574
  }
575
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_order_quantities_' . $min_or_max . '_per_item_quantity_per_product', 'no' ) ) ) {
576
  foreach ( $cart_item_quantities as $_product_id => $cart_item_quantity ) {
577
  if ( 0 != ( $max_or_max_per_item_quantity = get_post_meta( $_product_id, '_' . 'wcj_order_quantities_' . $min_or_max, true ) ) ) {
578
  if (
@@ -588,10 +588,10 @@ class WCJ_Order_Quantities extends WCJ_Module {
588
  }
589
  }
590
  }
591
- if ( 0 != ( $max_or_max_per_item_quantity = apply_filters( 'booster_option', 0, get_option( 'wcj_order_quantities_' . $min_or_max . '_per_item_quantity', 0 ) ) ) ) {
592
  foreach ( $cart_item_quantities as $_product_id => $cart_item_quantity ) {
593
  if (
594
- 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_order_quantities_' . $min_or_max . '_per_item_quantity_per_product', 'no' ) ) &&
595
  0 != get_post_meta( $_product_id, '_' . 'wcj_order_quantities_' . $min_or_max, true )
596
  ) {
597
  continue;
@@ -629,13 +629,13 @@ class WCJ_Order_Quantities extends WCJ_Module {
629
  }
630
  $cart_total_quantity = array_sum( $cart_item_quantities );
631
  $_is_cart = is_cart();
632
- if ( 'yes' === get_option( 'wcj_order_quantities_max_section_enabled', 'no' ) ) {
633
  $this->check_quantities( 'max', $cart_item_quantities, $cart_total_quantity, $_is_cart, false );
634
  }
635
- if ( 'yes' === get_option( 'wcj_order_quantities_min_section_enabled', 'no' ) ) {
636
  $this->check_quantities( 'min', $cart_item_quantities, $cart_total_quantity, $_is_cart, false );
637
  }
638
- if ( 'yes' === get_option( 'wcj_order_quantities_step_section_enabled', 'no' ) ) {
639
  $this->check_quantities_step( $cart_item_quantities, $_is_cart, false );
640
  }
641
  }
35
  if ( $this->is_enabled() ) {
36
  // Validation
37
  if (
38
+ 'yes' === wcj_get_option( 'wcj_order_quantities_max_section_enabled', 'no' ) || 'yes' === wcj_get_option( 'wcj_order_quantities_min_section_enabled', 'no' ) ||
39
+ 'yes' === wcj_get_option( 'wcj_order_quantities_step_section_enabled', 'no' )
40
  ) {
41
  add_action( 'woocommerce_checkout_process', array( $this, 'check_order_quantities' ) );
42
  add_action( 'woocommerce_before_cart', array( $this, 'check_order_quantities' ) );
43
+ if ( 'yes' === wcj_get_option( 'wcj_order_quantities_stop_from_seeing_checkout', 'no' ) ) {
44
  add_action( 'wp', array( $this, 'stop_from_seeing_checkout' ), PHP_INT_MAX );
45
  }
46
  }
47
  // Min/max quantities
48
+ if ( 'yes' === wcj_get_option( 'wcj_order_quantities_max_section_enabled', 'no' ) || 'yes' === wcj_get_option( 'wcj_order_quantities_min_section_enabled', 'no' ) ) {
49
  add_filter( 'woocommerce_available_variation', array( $this, 'set_quantity_input_min_max_variation' ), PHP_INT_MAX, 3 );
50
+ if ( 'yes' === wcj_get_option( 'wcj_order_quantities_min_section_enabled', 'no' ) ) {
51
  add_filter( 'woocommerce_quantity_input_min', array( $this, 'set_quantity_input_min' ), PHP_INT_MAX, 2 );
52
  }
53
+ if ( 'yes' === wcj_get_option( 'wcj_order_quantities_max_section_enabled', 'no' ) ) {
54
  add_filter( 'woocommerce_quantity_input_max', array( $this, 'set_quantity_input_max' ), PHP_INT_MAX, 2 );
55
  }
56
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_script' ) );
57
  }
58
  // Quantity step
59
+ if ( 'yes' === wcj_get_option( 'wcj_order_quantities_step_section_enabled', 'no' ) ) {
60
  add_filter( 'woocommerce_quantity_input_step', array( $this, 'set_quantity_input_step' ), PHP_INT_MAX, 2 );
61
  }
62
  // Meta box
63
+ $this->is_min_per_product_enabled = ( 'yes' === wcj_get_option( 'wcj_order_quantities_min_section_enabled', 'no' ) &&
64
+ 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_order_quantities_min_per_item_quantity_per_product', 'no' ) ) );
65
+ $this->is_max_per_product_enabled = ( 'yes' === wcj_get_option( 'wcj_order_quantities_max_section_enabled', 'no' ) &&
66
+ 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_order_quantities_max_per_item_quantity_per_product', 'no' ) ) );
67
+ $this->is_step_per_product_enabled = ( 'yes' === wcj_get_option( 'wcj_order_quantities_step_section_enabled', 'no' ) &&
68
+ 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_order_quantities_step_per_product', 'no' ) ) );
69
  if ( $this->is_min_per_product_enabled || $this->is_max_per_product_enabled || $this->is_step_per_product_enabled ) {
70
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
71
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
72
  }
73
  // Limit cart items (i.e. "Single Item Cart" Mode)
74
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_order_quantities_single_item_cart_enabled', 'no' ) ) ) {
75
  add_filter( 'woocommerce_add_to_cart_validation', array( $this, 'single_item_cart' ), PHP_INT_MAX, 4 );
76
  }
77
  // For cart and `input_value`
81
  add_action( 'wp_footer', array( $this, 'sync_qty_input_with_add_to_cart_btn_on_loop' ) );
82
  add_filter( 'woocommerce_loop_add_to_cart_link', array( $this, 'replace_quantity_attribute_on_loop_cart_link' ), PHP_INT_MAX, 2 );
83
  // Decimal qty
84
+ if ( 'yes' === wcj_get_option( 'wcj_order_quantities_decimal_qty_enabled', 'no' ) ) {
85
  add_action( 'init', array( $this, 'float_stock_amount' ) );
86
  add_action( 'woocommerce_quantity_input_pattern', array( $this, 'float_quantity_input_pattern' ) );
87
  }
214
  * @since 3.7.0
215
  */
216
  function set_quantity_input_args( $args, $product ) {
217
+ if ( 'yes' === wcj_get_option( 'wcj_order_quantities_min_section_enabled', 'no' ) ) {
218
  $args['min_value'] = $this->set_quantity_input_min( $args['min_value'], $product );
219
  }
220
+ if ( 'yes' === wcj_get_option( 'wcj_order_quantities_max_section_enabled', 'no' ) ) {
221
  $args['max_value'] = $this->set_quantity_input_max( $args['max_value'], $product );
222
  }
223
+ if ( 'yes' === wcj_get_option( 'wcj_order_quantities_step_section_enabled', 'no' ) ) {
224
  $args['step'] = $this->set_quantity_input_step( $args['step'], $product );
225
  }
226
+ if ( 'disabled' != ( $force_on_single = wcj_get_option( 'wcj_order_quantities_force_on_single', 'disabled' ) ) && is_product() ) {
227
  $args['input_value'] = ( 'min' === $force_on_single ?
228
  $this->set_quantity_input_min( $args['min_value'], $product ) : $this->set_quantity_input_max( $args['max_value'], $product ) );
229
  }
237
  * @since 3.7.0
238
  */
239
  function set_quantity_input_step( $qty, $product ) {
240
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_order_quantities_step_per_product', 'no' ) ) ) {
241
  if ( '' != ( $step = get_post_meta( wcj_get_product_id_or_variation_parent_id( $product ), '_' . 'wcj_order_quantities_step', true ) ) && 0 != $step ) {
242
  return $step;
243
  }
244
  }
245
+ return ( 0 != ( $step = wcj_get_option( 'wcj_order_quantities_step', 1 ) ) ? $step : $qty );
246
  }
247
 
248
  /**
256
  if ( is_array( WC()->cart->cart_contents ) && 1 == count( WC()->cart->cart_contents ) && wcj_is_product_in_cart( ( 0 != $variation_id ? $variation_id : $product_id ) ) ) {
257
  return $passed;
258
  } else {
259
+ wc_add_notice( wcj_get_option( 'wcj_order_quantities_single_item_cart_message',
260
  __( 'Only one item can be added to the cart. Clear the cart or finish the order, before adding another item to the cart.', 'woocommerce-jetpack' ) ), 'error' );
261
  return false;
262
  }
276
  $_product = wc_get_product();
277
  if ( $_product && $_product->is_type( 'variable' ) ) {
278
  $quantities_options = array(
279
+ 'reset_to_min' => ( 'reset_to_min' === wcj_get_option( 'wcj_order_quantities_variable_variation_change', 'do_nothing' ) ),
280
+ 'reset_to_max' => ( 'reset_to_max' === wcj_get_option( 'wcj_order_quantities_variable_variation_change', 'do_nothing' ) ),
281
+ 'force_on_add_to_cart' => ( 'yes' === wcj_get_option( 'wcj_order_quantities_variable_force_on_add_to_cart', 'no' ) ),
282
  );
283
  $product_quantities = array();
284
  foreach ( $_product->get_available_variations() as $variation ) {
300
  * @since 3.2.2
301
  */
302
  function get_product_quantity( $min_or_max, $_product, $default_qty ) {
303
+ if ( 'no' === wcj_get_option( 'wcj_order_quantities_' . $min_or_max . '_section_enabled', 'no' ) ) {
304
  return $default_qty;
305
  }
306
  if (
307
+ 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_order_quantities_' . $min_or_max . '_per_item_quantity_per_product', 'no' ) ) &&
308
  0 != ( $max_or_max_per_item_quantity_per_product = get_post_meta( wcj_get_product_id( $_product ), '_' . 'wcj_order_quantities_' . $min_or_max, true ) )
309
  ) {
310
  return $max_or_max_per_item_quantity_per_product;
311
+ } elseif ( 0 != ( $max_or_max_per_item_quantity = apply_filters( 'booster_option', 0, wcj_get_option( 'wcj_order_quantities_' . $min_or_max . '_per_item_quantity', 0 ) ) ) ) {
312
  return $max_or_max_per_item_quantity;
313
  } else {
314
  return $default_qty;
387
  return;
388
  }
389
  $cart_total_quantity = array_sum( $cart_item_quantities );
390
+ if ( 'yes' === wcj_get_option( 'wcj_order_quantities_max_section_enabled', 'no' ) ) {
391
  if ( ! $this->check_quantities( 'max', $cart_item_quantities, $cart_total_quantity, false, true ) ) {
392
  wp_safe_redirect( wc_get_cart_url() );
393
  exit;
394
  }
395
  }
396
+ if ( 'yes' === wcj_get_option( 'wcj_order_quantities_min_section_enabled', 'no' ) ) {
397
  if ( ! $this->check_quantities( 'min', $cart_item_quantities, $cart_total_quantity, false, true ) ) {
398
  wp_safe_redirect( wc_get_cart_url() );
399
  exit;
400
  }
401
  }
402
+ if ( 'yes' === wcj_get_option( 'wcj_order_quantities_step_section_enabled', 'no' ) ) {
403
  if ( ! $this->check_quantities_step( $cart_item_quantities, false, true ) ) {
404
  wp_safe_redirect( wc_get_cart_url() );
405
  exit;
415
  */
416
  function print_message( $message_type, $_is_cart, $required_quantity, $total_quantity, $_product_id = 0 ) {
417
  if ( $_is_cart ) {
418
+ if ( 'no' === wcj_get_option( 'wcj_order_quantities_cart_notice_enabled', 'no' ) ) {
419
  return;
420
  }
421
  }
425
  '%max_cart_total_quantity%' => $required_quantity,
426
  '%cart_total_quantity%' => $total_quantity,
427
  );
428
+ $message_template = wcj_get_option( 'wcj_order_quantities_max_cart_total_message',
429
  __( 'Maximum allowed order quantity is %max_cart_total_quantity%. Your current order quantity is %cart_total_quantity%.', 'woocommerce-jetpack' ) );
430
  break;
431
  case 'min_cart_total_quantity':
433
  '%min_cart_total_quantity%' => $required_quantity,
434
  '%cart_total_quantity%' => $total_quantity,
435
  );
436
+ $message_template = wcj_get_option( 'wcj_order_quantities_min_cart_total_message',
437
  __( 'Minimum allowed order quantity is %min_cart_total_quantity%. Your current order quantity is %cart_total_quantity%.', 'woocommerce-jetpack' ) );
438
  break;
439
  case 'max_per_item_quantity':
443
  '%item_quantity%' => $total_quantity,
444
  '%product_title%' => $_product->get_title(),
445
  );
446
+ $message_template = wcj_get_option( 'wcj_order_quantities_max_per_item_message',
447
  __( 'Maximum allowed quantity for %product_title% is %max_per_item_quantity%. Your current item quantity is %item_quantity%.', 'woocommerce-jetpack' ) );
448
  break;
449
  case 'min_per_item_quantity':
453
  '%item_quantity%' => $total_quantity,
454
  '%product_title%' => $_product->get_title(),
455
  );
456
+ $message_template = wcj_get_option( 'wcj_order_quantities_min_per_item_message',
457
  __( 'Minimum allowed quantity for %product_title% is %min_per_item_quantity%. Your current item quantity is %item_quantity%.', 'woocommerce-jetpack' ) );
458
  break;
459
  case 'step':
463
  '%item_quantity%' => $total_quantity,
464
  '%product_title%' => $_product->get_title(),
465
  );
466
+ $message_template = wcj_get_option( 'wcj_order_quantities_step_message',
467
  __( 'Required step for %product_title% is %required_step%. Your current item quantity is %item_quantity%.', 'woocommerce-jetpack' ) );
468
  break;
469
  }
483
  */
484
  function check_step( $product_id, $product_qty_step, $quantity ) {
485
  $min_value = $this->get_product_quantity( 'min', wc_get_product( $product_id ), 0 );
486
+ if ( 'yes' === wcj_get_option( 'wcj_order_quantities_decimal_qty_enabled', 'no' ) ) {
487
  $multiplier = floatval( 1000000 );
488
  $_min_value = intval( round( floatval( $min_value ) * $multiplier ) );
489
  $_quantity = intval( round( floatval( $quantity ) * $multiplier ) );
505
  * @since 4.2.0
506
  */
507
  function check_quantities_step( $cart_item_quantities, $_is_cart, $_return ) {
508
+ if ( 'yes' != wcj_get_option( 'wcj_order_quantities_step_additional_validation_enabled', 'no' ) ) {
509
  return true;
510
  }
511
  if ( $this->is_step_per_product_enabled ) {
533
  }
534
  if (
535
  empty( $step ) &&
536
+ 0 != ( $step = wcj_get_option( 'wcj_order_quantities_step', 1 ) )
537
  ) {
538
  foreach ( $cart_item_quantities as $_product_id => $cart_item_quantity ) {
539
  if ( $this->is_step_per_product_enabled && 0 != get_post_meta( $_product_id, '_' . 'wcj_order_quantities_step', true ) ) {
560
  * @since 2.9.0
561
  */
562
  function check_quantities( $min_or_max, $cart_item_quantities, $cart_total_quantity, $_is_cart, $_return ) {
563
+ if ( 0 != ( $min_or_max_cart_total_quantity = wcj_get_option( 'wcj_order_quantities_' . $min_or_max . '_cart_total_quantity', 0 ) ) ) {
564
  if (
565
  ( 'max' === $min_or_max && $cart_total_quantity > $min_or_max_cart_total_quantity ) ||
566
  ( 'min' === $min_or_max && $cart_total_quantity < $min_or_max_cart_total_quantity )
572
  }
573
  }
574
  }
575
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_order_quantities_' . $min_or_max . '_per_item_quantity_per_product', 'no' ) ) ) {
576
  foreach ( $cart_item_quantities as $_product_id => $cart_item_quantity ) {
577
  if ( 0 != ( $max_or_max_per_item_quantity = get_post_meta( $_product_id, '_' . 'wcj_order_quantities_' . $min_or_max, true ) ) ) {
578
  if (
588
  }
589
  }
590
  }
591
+ if ( 0 != ( $max_or_max_per_item_quantity = apply_filters( 'booster_option', 0, wcj_get_option( 'wcj_order_quantities_' . $min_or_max . '_per_item_quantity', 0 ) ) ) ) {
592
  foreach ( $cart_item_quantities as $_product_id => $cart_item_quantity ) {
593
  if (
594
+ 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_order_quantities_' . $min_or_max . '_per_item_quantity_per_product', 'no' ) ) &&
595
  0 != get_post_meta( $_product_id, '_' . 'wcj_order_quantities_' . $min_or_max, true )
596
  ) {
597
  continue;
629
  }
630
  $cart_total_quantity = array_sum( $cart_item_quantities );
631
  $_is_cart = is_cart();
632
+ if ( 'yes' === wcj_get_option( 'wcj_order_quantities_max_section_enabled', 'no' ) ) {
633
  $this->check_quantities( 'max', $cart_item_quantities, $cart_total_quantity, $_is_cart, false );
634
  }
635
+ if ( 'yes' === wcj_get_option( 'wcj_order_quantities_min_section_enabled', 'no' ) ) {
636
  $this->check_quantities( 'min', $cart_item_quantities, $cart_total_quantity, $_is_cart, false );
637
  }
638
+ if ( 'yes' === wcj_get_option( 'wcj_order_quantities_step_section_enabled', 'no' ) ) {
639
  $this->check_quantities_step( $cart_item_quantities, $_is_cart, false );
640
  }
641
  }
includes/class-wcj-orders.php CHANGED
@@ -32,26 +32,26 @@ class WCJ_Orders extends WCJ_Module {
32
  if ( $this->is_enabled() ) {
33
 
34
  // Order auto complete
35
- if ( 'yes' === get_option( 'wcj_order_auto_complete_enabled', 'no' ) ) {
36
  add_action( 'woocommerce_thankyou', array( $this, 'auto_complete_order' ), PHP_INT_MAX );
37
  add_action( 'woocommerce_payment_complete', array( $this, 'auto_complete_order' ), PHP_INT_MAX );
38
  }
39
 
40
  // Order currency
41
- if ( 'yes' === get_option( 'wcj_order_admin_currency', 'no' ) ) {
42
  $this->meta_box_screen = 'shop_order';
43
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
44
  add_action( 'save_post_shop_order', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
45
- if ( 'filter' === get_option( 'wcj_order_admin_currency_method', 'filter' ) ) {
46
  $woocommerce_get_order_currency_filter = ( WCJ_IS_WC_VERSION_BELOW_3 ? 'woocommerce_get_order_currency' : 'woocommerce_order_get_currency' );
47
  add_filter( $woocommerce_get_order_currency_filter, array( $this, 'change_order_currency' ), PHP_INT_MAX, 2 );
48
  }
49
  }
50
 
51
  // Bulk Regenerate Download Permissions
52
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_order_bulk_regenerate_download_permissions_enabled', 'no' ) ) ) {
53
  // Actions
54
- if ( 'yes' === get_option( 'wcj_order_bulk_regenerate_download_permissions_actions', 'no' ) ) {
55
  add_filter( 'bulk_actions-edit-shop_order', array( $this, 'register_bulk_actions_regenerate_download_permissions' ), PHP_INT_MAX );
56
  add_filter( 'handle_bulk_actions-edit-shop_order', array( $this, 'handle_bulk_actions_regenerate_download_permissions' ), 10, 3 );
57
  }
@@ -60,7 +60,7 @@ class WCJ_Orders extends WCJ_Module {
60
  // Admin notices
61
  add_filter( 'admin_notices', array( $this, 'admin_notice_regenerate_download_permissions' ) );
62
  // All orders - Cron
63
- if ( 'disabled' != apply_filters( 'booster_option', 'disabled', get_option( 'wcj_order_bulk_regenerate_download_permissions_all_orders_cron', 'disabled' ) ) ) {
64
  add_action( 'init', array( $this, 'schedule_bulk_regenerate_download_permissions_all_orders_cron' ) );
65
  add_action( 'admin_init', array( $this, 'schedule_bulk_regenerate_download_permissions_all_orders_cron' ) );
66
  add_filter( 'cron_schedules', 'wcj_crons_add_custom_intervals' );
@@ -69,18 +69,18 @@ class WCJ_Orders extends WCJ_Module {
69
  }
70
 
71
  // Country by IP
72
- if ( 'yes' === get_option( 'wcj_orders_country_by_ip_enabled', 'no' ) ) {
73
  add_action( 'add_meta_boxes', array( $this, 'add_country_by_ip_meta_box' ) );
74
  }
75
 
76
  // Orders navigation
77
- if ( 'yes' === get_option( 'wcj_orders_navigation_enabled', 'no' ) ) {
78
  add_action( 'add_meta_boxes', array( $this, 'add_orders_navigation_meta_box' ) );
79
  add_action( 'admin_init', array( $this, 'handle_orders_navigation' ) );
80
  }
81
 
82
  // Editable orders
83
- if ( 'yes' === get_option( 'wcj_orders_editable_status_enabled', 'no' ) ) {
84
  add_filter( 'wc_order_is_editable', array( $this, 'editable_status' ), PHP_INT_MAX, 2 );
85
  }
86
 
@@ -94,7 +94,7 @@ class WCJ_Orders extends WCJ_Module {
94
  * @since 4.0.0
95
  */
96
  function editable_status( $is_editable, $order ) {
97
- return in_array( $order->get_status(), get_option( 'wcj_orders_editable_status', array( 'pending', 'on-hold', 'auto-draft' ) ), true );
98
  }
99
 
100
  /**
@@ -191,7 +191,7 @@ class WCJ_Orders extends WCJ_Module {
191
  function schedule_bulk_regenerate_download_permissions_all_orders_cron() {
192
  wcj_crons_schedule_the_events(
193
  'wcj_bulk_regenerate_download_permissions_all_orders_cron',
194
- apply_filters( 'booster_option', 'disabled', get_option( 'wcj_order_bulk_regenerate_download_permissions_all_orders_cron', 'disabled' ) )
195
  );
196
  }
197
 
@@ -286,7 +286,7 @@ class WCJ_Orders extends WCJ_Module {
286
  * @since 3.2.0
287
  */
288
  function maybe_bulk_regenerate_download_permissions_all_orders() {
289
- if ( 'yes' === get_option( 'wcj_order_bulk_regenerate_download_permissions_all_orders', 'no' ) ) {
290
  update_option( 'wcj_order_bulk_regenerate_download_permissions_all_orders', 'no' );
291
  $total_orders = $this->bulk_regenerate_download_permissions_all_orders();
292
  wp_safe_redirect( add_query_arg( 'wcj_bulk_regenerated_download_permissions', $total_orders ) );
@@ -316,7 +316,7 @@ class WCJ_Orders extends WCJ_Module {
316
  return;
317
  }
318
  $order = wc_get_order( $order_id );
319
- $payment_methods = apply_filters( 'booster_option', '', get_option( 'wcj_order_auto_complete_payment_methods', array() ) );
320
  if ( ! empty( $payment_methods ) && ! in_array( $order->get_payment_method(), $payment_methods ) ) {
321
  return;
322
  }
32
  if ( $this->is_enabled() ) {
33
 
34
  // Order auto complete
35
+ if ( 'yes' === wcj_get_option( 'wcj_order_auto_complete_enabled', 'no' ) ) {
36
  add_action( 'woocommerce_thankyou', array( $this, 'auto_complete_order' ), PHP_INT_MAX );
37
  add_action( 'woocommerce_payment_complete', array( $this, 'auto_complete_order' ), PHP_INT_MAX );
38
  }
39
 
40
  // Order currency
41
+ if ( 'yes' === wcj_get_option( 'wcj_order_admin_currency', 'no' ) ) {
42
  $this->meta_box_screen = 'shop_order';
43
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
44
  add_action( 'save_post_shop_order', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
45
+ if ( 'filter' === wcj_get_option( 'wcj_order_admin_currency_method', 'filter' ) ) {
46
  $woocommerce_get_order_currency_filter = ( WCJ_IS_WC_VERSION_BELOW_3 ? 'woocommerce_get_order_currency' : 'woocommerce_order_get_currency' );
47
  add_filter( $woocommerce_get_order_currency_filter, array( $this, 'change_order_currency' ), PHP_INT_MAX, 2 );
48
  }
49
  }
50
 
51
  // Bulk Regenerate Download Permissions
52
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_order_bulk_regenerate_download_permissions_enabled', 'no' ) ) ) {
53
  // Actions
54
+ if ( 'yes' === wcj_get_option( 'wcj_order_bulk_regenerate_download_permissions_actions', 'no' ) ) {
55
  add_filter( 'bulk_actions-edit-shop_order', array( $this, 'register_bulk_actions_regenerate_download_permissions' ), PHP_INT_MAX );
56
  add_filter( 'handle_bulk_actions-edit-shop_order', array( $this, 'handle_bulk_actions_regenerate_download_permissions' ), 10, 3 );
57
  }
60
  // Admin notices
61
  add_filter( 'admin_notices', array( $this, 'admin_notice_regenerate_download_permissions' ) );
62
  // All orders - Cron
63
+ if ( 'disabled' != apply_filters( 'booster_option', 'disabled', wcj_get_option( 'wcj_order_bulk_regenerate_download_permissions_all_orders_cron', 'disabled' ) ) ) {
64
  add_action( 'init', array( $this, 'schedule_bulk_regenerate_download_permissions_all_orders_cron' ) );
65
  add_action( 'admin_init', array( $this, 'schedule_bulk_regenerate_download_permissions_all_orders_cron' ) );
66
  add_filter( 'cron_schedules', 'wcj_crons_add_custom_intervals' );
69
  }
70
 
71
  // Country by IP
72
+ if ( 'yes' === wcj_get_option( 'wcj_orders_country_by_ip_enabled', 'no' ) ) {
73
  add_action( 'add_meta_boxes', array( $this, 'add_country_by_ip_meta_box' ) );
74
  }
75
 
76
  // Orders navigation
77
+ if ( 'yes' === wcj_get_option( 'wcj_orders_navigation_enabled', 'no' ) ) {
78
  add_action( 'add_meta_boxes', array( $this, 'add_orders_navigation_meta_box' ) );
79
  add_action( 'admin_init', array( $this, 'handle_orders_navigation' ) );
80
  }
81
 
82
  // Editable orders
83
+ if ( 'yes' === wcj_get_option( 'wcj_orders_editable_status_enabled', 'no' ) ) {
84
  add_filter( 'wc_order_is_editable', array( $this, 'editable_status' ), PHP_INT_MAX, 2 );
85
  }
86
 
94
  * @since 4.0.0
95
  */
96
  function editable_status( $is_editable, $order ) {
97
+ return in_array( $order->get_status(), wcj_get_option( 'wcj_orders_editable_status', array( 'pending', 'on-hold', 'auto-draft' ) ), true );
98
  }
99
 
100
  /**
191
  function schedule_bulk_regenerate_download_permissions_all_orders_cron() {
192
  wcj_crons_schedule_the_events(
193
  'wcj_bulk_regenerate_download_permissions_all_orders_cron',
194
+ apply_filters( 'booster_option', 'disabled', wcj_get_option( 'wcj_order_bulk_regenerate_download_permissions_all_orders_cron', 'disabled' ) )
195
  );
196
  }
197
 
286
  * @since 3.2.0
287
  */
288
  function maybe_bulk_regenerate_download_permissions_all_orders() {
289
+ if ( 'yes' === wcj_get_option( 'wcj_order_bulk_regenerate_download_permissions_all_orders', 'no' ) ) {
290
  update_option( 'wcj_order_bulk_regenerate_download_permissions_all_orders', 'no' );
291
  $total_orders = $this->bulk_regenerate_download_permissions_all_orders();
292
  wp_safe_redirect( add_query_arg( 'wcj_bulk_regenerated_download_permissions', $total_orders ) );
316
  return;
317
  }
318
  $order = wc_get_order( $order_id );
319
+ $payment_methods = apply_filters( 'booster_option', '', wcj_get_option( 'wcj_order_auto_complete_payment_methods', array() ) );
320
  if ( ! empty( $payment_methods ) && ! in_array( $order->get_payment_method(), $payment_methods ) ) {
321
  return;
322
  }
includes/class-wcj-payment-gateways-by-country.php CHANGED
@@ -41,7 +41,7 @@ class WCJ_Payment_Gateways_By_Country extends WCJ_Module {
41
  function get_location( $type ) {
42
  switch ( $type ) {
43
  case 'country':
44
- $country_type = get_option( 'wcj_gateways_by_location_country_type', 'billing' );
45
  switch( $country_type ) {
46
  case 'by_ip':
47
  return wcj_get_country_by_ip();
@@ -51,7 +51,7 @@ class WCJ_Payment_Gateways_By_Country extends WCJ_Module {
51
  return ( ! empty( $_REQUEST['country'] ) ? $_REQUEST['country'] : ( isset( WC()->customer ) ? wcj_customer_get_country() : '' ) );
52
  }
53
  case 'state':
54
- $state_type = get_option( 'wcj_gateways_by_location_state_type', 'billing' );
55
  switch( $state_type ) {
56
  case 'shipping':
57
  return ( ! empty( $_REQUEST['s_state'] ) ? $_REQUEST['s_state'] : ( isset( WC()->customer ) ? WC()->customer->get_shipping_state() : '' ) );
@@ -59,7 +59,7 @@ class WCJ_Payment_Gateways_By_Country extends WCJ_Module {
59
  return ( ! empty( $_REQUEST['state'] ) ? $_REQUEST['state'] : ( isset( WC()->customer ) ? wcj_customer_get_country_state() : '' ) );
60
  }
61
  case 'postcode':
62
- $postcodes_type = get_option( 'wcj_gateways_by_location_postcodes_type', 'billing' );
63
  switch ( $postcodes_type ) {
64
  case 'shipping':
65
  return ( ! empty( $_REQUEST['s_postcode'] ) ? strtoupper( $_REQUEST['s_postcode'] ) : ( ! empty( $_REQUEST['shipping_postcode'] ) ? strtoupper( $_REQUEST['shipping_postcode'] ) : strtoupper( WC()->countries->get_base_postcode() ) ) );
@@ -85,31 +85,31 @@ class WCJ_Payment_Gateways_By_Country extends WCJ_Module {
85
  $postcode = $this->get_location( 'postcode' );
86
  foreach ( $_available_gateways as $key => $gateway ) {
87
  if ( '' != $customer_country ) {
88
- $include_countries = wcj_maybe_add_european_union_countries( get_option( 'wcj_gateways_countries_include_' . $key, '' ) );
89
  if ( ! empty( $include_countries ) && ! in_array( $customer_country, $include_countries ) ) {
90
  unset( $_available_gateways[ $key ] );
91
  continue;
92
  }
93
- $exclude_countries = get_option( 'wcj_gateways_countries_exclude_' . $key, '' );
94
  if ( ! empty( $exclude_countries ) && in_array( $customer_country, $exclude_countries ) ) {
95
  unset( $_available_gateways[ $key ] );
96
  continue;
97
  }
98
  }
99
  if ( '' != $customer_state ) {
100
- $include_states = get_option( 'wcj_gateways_states_include_' . $key, '' );
101
  if ( ! empty( $include_states ) && ! in_array( $customer_state, $include_states ) ) {
102
  unset( $_available_gateways[ $key ] );
103
  continue;
104
  }
105
- $exclude_states = get_option( 'wcj_gateways_states_exclude_' . $key, '' );
106
  if ( ! empty( $exclude_states ) && in_array( $customer_state, $exclude_states ) ) {
107
  unset( $_available_gateways[ $key ] );
108
  continue;
109
  }
110
  }
111
  if ( '' != $postcode ) {
112
- $include_postcodes = get_option( 'wcj_gateways_postcodes_include_' . $key, '' );
113
  if ( ! empty( $include_postcodes ) ) {
114
  $include_postcodes = array_filter( array_map( 'strtoupper', array_map( 'wc_clean', explode( "\n", $include_postcodes ) ) ) );
115
  if ( ! wcj_check_postcode( $postcode, $include_postcodes ) ) {
@@ -117,7 +117,7 @@ class WCJ_Payment_Gateways_By_Country extends WCJ_Module {
117
  continue;
118
  }
119
  }
120
- $exclude_postcodes = get_option( 'wcj_gateways_postcodes_exclude_' . $key, '' );
121
  if ( ! empty( $exclude_postcodes ) ) {
122
  $exclude_postcodes = array_filter( array_map( 'strtoupper', array_map( 'wc_clean', explode( "\n", $exclude_postcodes ) ) ) );
123
  if ( wcj_check_postcode( $postcode, $exclude_postcodes ) ) {
41
  function get_location( $type ) {
42
  switch ( $type ) {
43
  case 'country':
44
+ $country_type = wcj_get_option( 'wcj_gateways_by_location_country_type', 'billing' );
45
  switch( $country_type ) {
46
  case 'by_ip':
47
  return wcj_get_country_by_ip();
51
  return ( ! empty( $_REQUEST['country'] ) ? $_REQUEST['country'] : ( isset( WC()->customer ) ? wcj_customer_get_country() : '' ) );
52
  }
53
  case 'state':
54
+ $state_type = wcj_get_option( 'wcj_gateways_by_location_state_type', 'billing' );
55
  switch( $state_type ) {
56
  case 'shipping':
57
  return ( ! empty( $_REQUEST['s_state'] ) ? $_REQUEST['s_state'] : ( isset( WC()->customer ) ? WC()->customer->get_shipping_state() : '' ) );
59
  return ( ! empty( $_REQUEST['state'] ) ? $_REQUEST['state'] : ( isset( WC()->customer ) ? wcj_customer_get_country_state() : '' ) );
60
  }
61
  case 'postcode':
62
+ $postcodes_type = wcj_get_option( 'wcj_gateways_by_location_postcodes_type', 'billing' );
63
  switch ( $postcodes_type ) {
64
  case 'shipping':
65
  return ( ! empty( $_REQUEST['s_postcode'] ) ? strtoupper( $_REQUEST['s_postcode'] ) : ( ! empty( $_REQUEST['shipping_postcode'] ) ? strtoupper( $_REQUEST['shipping_postcode'] ) : strtoupper( WC()->countries->get_base_postcode() ) ) );
85
  $postcode = $this->get_location( 'postcode' );
86
  foreach ( $_available_gateways as $key => $gateway ) {
87
  if ( '' != $customer_country ) {
88
+ $include_countries = wcj_maybe_add_european_union_countries( wcj_get_option( 'wcj_gateways_countries_include_' . $key, '' ) );
89
  if ( ! empty( $include_countries ) && ! in_array( $customer_country, $include_countries ) ) {
90
  unset( $_available_gateways[ $key ] );
91
  continue;
92
  }
93
+ $exclude_countries = wcj_get_option( 'wcj_gateways_countries_exclude_' . $key, '' );
94
  if ( ! empty( $exclude_countries ) && in_array( $customer_country, $exclude_countries ) ) {
95
  unset( $_available_gateways[ $key ] );
96
  continue;
97
  }
98
  }
99
  if ( '' != $customer_state ) {
100
+ $include_states = wcj_get_option( 'wcj_gateways_states_include_' . $key, '' );
101
  if ( ! empty( $include_states ) && ! in_array( $customer_state, $include_states ) ) {
102
  unset( $_available_gateways[ $key ] );
103
  continue;
104
  }
105
+ $exclude_states = wcj_get_option( 'wcj_gateways_states_exclude_' . $key, '' );
106
  if ( ! empty( $exclude_states ) && in_array( $customer_state, $exclude_states ) ) {
107
  unset( $_available_gateways[ $key ] );
108
  continue;
109
  }
110
  }
111
  if ( '' != $postcode ) {
112
+ $include_postcodes = wcj_get_option( 'wcj_gateways_postcodes_include_' . $key, '' );
113
  if ( ! empty( $include_postcodes ) ) {
114
  $include_postcodes = array_filter( array_map( 'strtoupper', array_map( 'wc_clean', explode( "\n", $include_postcodes ) ) ) );
115
  if ( ! wcj_check_postcode( $postcode, $include_postcodes ) ) {
117
  continue;
118
  }
119
  }
120
+ $exclude_postcodes = wcj_get_option( 'wcj_gateways_postcodes_exclude_' . $key, '' );
121
  if ( ! empty( $exclude_postcodes ) ) {
122
  $exclude_postcodes = array_filter( array_map( 'strtoupper', array_map( 'wc_clean', explode( "\n", $exclude_postcodes ) ) ) );
123
  if ( wcj_check_postcode( $postcode, $exclude_postcodes ) ) {
includes/class-wcj-payment-gateways-by-currency.php CHANGED
@@ -41,12 +41,12 @@ class WCJ_Payment_Gateways_By_Currency extends WCJ_Module {
41
  function available_payment_gateways( $_available_gateways ) {
42
  $current_currency = get_woocommerce_currency();
43
  foreach ( $_available_gateways as $key => $gateway ) {
44
- $allowed_currencies = get_option( 'wcj_gateways_by_currency_allowed_' . $key, '' );
45
  if ( ! empty( $allowed_currencies ) && ! in_array( $current_currency, $allowed_currencies ) ) {
46
  unset( $_available_gateways[ $key ] );
47
  continue;
48
  }
49
- $denied_currencies = get_option( 'wcj_gateways_by_currency_denied_' . $key, '' );
50
  if ( ! empty( $denied_currencies ) && in_array( $current_currency, $denied_currencies ) ) {
51
  unset( $_available_gateways[ $key ] );
52
  continue;
41
  function available_payment_gateways( $_available_gateways ) {
42
  $current_currency = get_woocommerce_currency();
43
  foreach ( $_available_gateways as $key => $gateway ) {
44
+ $allowed_currencies = wcj_get_option( 'wcj_gateways_by_currency_allowed_' . $key, '' );
45
  if ( ! empty( $allowed_currencies ) && ! in_array( $current_currency, $allowed_currencies ) ) {
46
  unset( $_available_gateways[ $key ] );
47
  continue;
48
  }
49
+ $denied_currencies = wcj_get_option( 'wcj_gateways_by_currency_denied_' . $key, '' );
50
  if ( ! empty( $denied_currencies ) && in_array( $current_currency, $denied_currencies ) ) {
51
  unset( $_available_gateways[ $key ] );
52
  continue;
includes/class-wcj-payment-gateways-by-shipping.php CHANGED
@@ -29,7 +29,7 @@ class WCJ_Payment_Gateways_By_Shipping extends WCJ_Module {
29
  parent::__construct();
30
 
31
  if ( $this->is_enabled() ) {
32
- $this->use_shipping_instance = ( 'yes' === get_option( 'wcj_payment_gateways_by_shipping_use_shipping_instance', 'no' ) );
33
  add_filter( 'woocommerce_available_payment_gateways', array( $this, 'available_payment_gateways' ), PHP_INT_MAX, 1 );
34
  }
35
  }
29
  parent::__construct();
30
 
31
  if ( $this->is_enabled() ) {
32
+ $this->use_shipping_instance = ( 'yes' === wcj_get_option( 'wcj_payment_gateways_by_shipping_use_shipping_instance', 'no' ) );
33
  add_filter( 'woocommerce_available_payment_gateways', array( $this, 'available_payment_gateways' ), PHP_INT_MAX, 1 );
34
  }
35
  }
includes/class-wcj-payment-gateways-by-user-role.php CHANGED
@@ -38,14 +38,14 @@ class WCJ_Payment_Gateways_By_User_Role extends WCJ_Module {
38
  * @since 2.5.3
39
  */
40
  function available_payment_gateways( $_available_gateways ) {
41
- $customer_roles = 'no' === ( $multi_role_check = get_option( 'wcj_payment_gateways_by_user_role_multi_role_check', 'no' ) ) ? array( wcj_get_current_user_first_role() ) : wcj_get_current_user_all_roles();
42
  foreach ( $_available_gateways as $key => $gateway ) {
43
- $include_roles = get_option( 'wcj_gateways_user_roles_include_' . $key, '' );
44
  if ( ! empty( $include_roles ) && ! array_intersect( $customer_roles, $include_roles ) ) {
45
  unset( $_available_gateways[ $key ] );
46
  continue;
47
  }
48
- $exclude_roles = get_option( 'wcj_gateways_user_roles_exclude_' . $key, '' );
49
  if ( ! empty( $exclude_roles ) && array_intersect( $customer_roles, $exclude_roles ) ) {
50
  unset( $_available_gateways[ $key ] );
51
  continue;
38
  * @since 2.5.3
39
  */
40
  function available_payment_gateways( $_available_gateways ) {
41
+ $customer_roles = 'no' === ( $multi_role_check = wcj_get_option( 'wcj_payment_gateways_by_user_role_multi_role_check', 'no' ) ) ? array( wcj_get_current_user_first_role() ) : wcj_get_current_user_all_roles();
42
  foreach ( $_available_gateways as $key => $gateway ) {
43
+ $include_roles = wcj_get_option( 'wcj_gateways_user_roles_include_' . $key, '' );
44
  if ( ! empty( $include_roles ) && ! array_intersect( $customer_roles, $include_roles ) ) {
45
  unset( $_available_gateways[ $key ] );
46
  continue;
47
  }
48
+ $exclude_roles = wcj_get_option( 'wcj_gateways_user_roles_exclude_' . $key, '' );
49
  if ( ! empty( $exclude_roles ) && array_intersect( $customer_roles, $exclude_roles ) ) {
50
  unset( $_available_gateways[ $key ] );
51
  continue;
includes/class-wcj-payment-gateways-currency.php CHANGED
@@ -29,12 +29,12 @@ class WCJ_Payment_Gateways_Currency extends WCJ_Module {
29
  parent::__construct();
30
 
31
  if ( $this->is_enabled() ) {
32
- $this->page_scope = get_option( 'wcj_gateways_currency_page_scope', 'cart_and_checkout' );
33
  $this->add_hooks();
34
  if ( is_admin() ) {
35
  include_once( 'reports/class-wcj-currency-reports.php' );
36
  }
37
- if ( 'yes' === get_option( 'wcj_gateways_currency_fix_chosen_payment_method', 'no' ) ) {
38
  add_action( 'woocommerce_checkout_update_order_review', array( $this, 'fix_chosen_payment_method' ) );
39
  }
40
  }
@@ -99,7 +99,7 @@ class WCJ_Payment_Gateways_Currency extends WCJ_Module {
99
  if ( $this->is_cart_or_checkout() ) {
100
  $current_gateway = $this->get_chosen_payment_method();
101
  if ( '' != $current_gateway ) {
102
- $gateway_currency_exchange_rate = get_option( 'wcj_gateways_currency_exchange_rate_' . $current_gateway );
103
  return wcj_change_price_shipping_package_rates( $package_rates, $gateway_currency_exchange_rate );
104
  }
105
  }
@@ -138,7 +138,7 @@ class WCJ_Payment_Gateways_Currency extends WCJ_Module {
138
  if ( $this->is_cart_or_checkout() ) {
139
  $current_gateway = $this->get_chosen_payment_method();
140
  if ( '' != $current_gateway ) {
141
- $gateway_currency_exchange_rate = get_option( 'wcj_gateways_currency_exchange_rate_' . $current_gateway );
142
  $gateway_currency_exchange_rate = str_replace( ',', '.', $gateway_currency_exchange_rate );
143
  $price = $price * $gateway_currency_exchange_rate;
144
  }
@@ -156,7 +156,7 @@ class WCJ_Payment_Gateways_Currency extends WCJ_Module {
156
  if ( $this->is_cart_or_checkout() ) {
157
  $current_gateway = $this->get_chosen_payment_method();
158
  if ( '' != $current_gateway ) {
159
- $gateway_currency = get_option( 'wcj_gateways_currency_' . $current_gateway );
160
  if ( 'no_changes' != $gateway_currency ) {
161
  $supported_currencies[] = $gateway_currency;
162
  }
@@ -175,7 +175,7 @@ class WCJ_Payment_Gateways_Currency extends WCJ_Module {
175
  if ( $this->is_cart_or_checkout() ) {
176
  $current_gateway = $this->get_chosen_payment_method();
177
  if ( '' != $current_gateway ) {
178
- $gateway_currency = get_option( 'wcj_gateways_currency_' . $current_gateway );
179
  if ( 'no_changes' != $gateway_currency ) {
180
  return $gateway_currency;
181
  }
29
  parent::__construct();
30
 
31
  if ( $this->is_enabled() ) {
32
+ $this->page_scope = wcj_get_option( 'wcj_gateways_currency_page_scope', 'cart_and_checkout' );
33
  $this->add_hooks();
34
  if ( is_admin() ) {
35
  include_once( 'reports/class-wcj-currency-reports.php' );
36
  }
37
+ if ( 'yes' === wcj_get_option( 'wcj_gateways_currency_fix_chosen_payment_method', 'no' ) ) {
38
  add_action( 'woocommerce_checkout_update_order_review', array( $this, 'fix_chosen_payment_method' ) );
39
  }
40
  }
99
  if ( $this->is_cart_or_checkout() ) {
100
  $current_gateway = $this->get_chosen_payment_method();
101
  if ( '' != $current_gateway ) {
102
+ $gateway_currency_exchange_rate = wcj_get_option( 'wcj_gateways_currency_exchange_rate_' . $current_gateway );
103
  return wcj_change_price_shipping_package_rates( $package_rates, $gateway_currency_exchange_rate );
104
  }
105
  }
138
  if ( $this->is_cart_or_checkout() ) {
139
  $current_gateway = $this->get_chosen_payment_method();
140
  if ( '' != $current_gateway ) {
141
+ $gateway_currency_exchange_rate = wcj_get_option( 'wcj_gateways_currency_exchange_rate_' . $current_gateway );
142
  $gateway_currency_exchange_rate = str_replace( ',', '.', $gateway_currency_exchange_rate );
143
  $price = $price * $gateway_currency_exchange_rate;
144
  }
156
  if ( $this->is_cart_or_checkout() ) {
157
  $current_gateway = $this->get_chosen_payment_method();
158
  if ( '' != $current_gateway ) {
159
+ $gateway_currency = wcj_get_option( 'wcj_gateways_currency_' . $current_gateway );
160
  if ( 'no_changes' != $gateway_currency ) {
161
  $supported_currencies[] = $gateway_currency;
162
  }
175
  if ( $this->is_cart_or_checkout() ) {
176
  $current_gateway = $this->get_chosen_payment_method();
177
  if ( '' != $current_gateway ) {
178
+ $gateway_currency = wcj_get_option( 'wcj_gateways_currency_' . $current_gateway );
179
  if ( 'no_changes' != $gateway_currency ) {
180
  return $gateway_currency;
181
  }
includes/class-wcj-payment-gateways-fees.php CHANGED
@@ -29,7 +29,7 @@ class WCJ_Payment_Gateways_Fees extends WCJ_Module {
29
  parent::__construct();
30
 
31
  if ( $this->is_enabled() ) {
32
- if ( 'no' === ( $modules_on_init = get_option( 'wcj_load_modules_on_init', 'no' ) ) ) {
33
  add_action( 'init', array( $this, 'init_options' ) );
34
  } elseif ( 'yes' === $modules_on_init && 'init' === current_filter() ) {
35
  $this->init_options();
@@ -47,19 +47,19 @@ class WCJ_Payment_Gateways_Fees extends WCJ_Module {
47
  */
48
  function init_options() {
49
  $this->options = array(
50
- 'text' => get_option( 'wcj_gateways_fees_text', array() ),
51
- 'type' => get_option( 'wcj_gateways_fees_type', array() ),
52
- 'value' => get_option( 'wcj_gateways_fees_value', array() ),
53
- 'min_cart_amount' => get_option( 'wcj_gateways_fees_min_cart_amount', array() ),
54
- 'max_cart_amount' => get_option( 'wcj_gateways_fees_max_cart_amount', array() ),
55
- 'round' => get_option( 'wcj_gateways_fees_round', array() ),
56
- 'round_precision' => get_option( 'wcj_gateways_fees_round_precision', array() ),
57
- 'is_taxable' => get_option( 'wcj_gateways_fees_is_taxable', array() ),
58
- 'tax_class_id' => get_option( 'wcj_gateways_fees_tax_class_id', array() ),
59
- 'exclude_shipping' => get_option( 'wcj_gateways_fees_exclude_shipping', array() ),
60
- 'include_taxes' => get_option( 'wcj_gateways_fees_include_taxes', array() ),
61
- 'include_products' => apply_filters( 'booster_option', array(), get_option( 'wcj_gateways_fees_include_products', array() ) ),
62
- 'exclude_products' => apply_filters( 'booster_option', array(), get_option( 'wcj_gateways_fees_exclude_products', array() ) ),
63
  );
64
  $this->defaults = array(
65
  'text' => '',
@@ -68,7 +68,7 @@ class WCJ_Payment_Gateways_Fees extends WCJ_Module {
68
  'min_cart_amount' => 0,
69
  'max_cart_amount' => 0,
70
  'round' => 'no',
71
- 'round_precision' => get_option( 'woocommerce_price_num_decimals', 2 ),
72
  'is_taxable' => 'no',
73
  'tax_class_id' => '',
74
  'exclude_shipping' => 'no',
@@ -154,7 +154,7 @@ class WCJ_Payment_Gateways_Fees extends WCJ_Module {
154
  // Pre-sets the default available payment gateway on cart and checkout pages.
155
  if (
156
  empty( $gateway ) &&
157
- 'yes' === get_option( 'wcj_gateways_fees_force_default_payment_gateway', 'no' ) &&
158
  ( is_checkout() || is_cart() )
159
  ) {
160
  $gateways = WC()->payment_gateways->get_available_payment_gateways();
29
  parent::__construct();
30
 
31
  if ( $this->is_enabled() ) {
32
+ if ( 'no' === ( $modules_on_init = wcj_get_option( 'wcj_load_modules_on_init', 'no' ) ) ) {
33
  add_action( 'init', array( $this, 'init_options' ) );
34
  } elseif ( 'yes' === $modules_on_init && 'init' === current_filter() ) {
35
  $this->init_options();
47
  */
48
  function init_options() {
49
  $this->options = array(
50
+ 'text' => wcj_get_option( 'wcj_gateways_fees_text', array() ),
51
+ 'type' => wcj_get_option( 'wcj_gateways_fees_type', array() ),
52
+ 'value' => wcj_get_option( 'wcj_gateways_fees_value', array() ),
53
+ 'min_cart_amount' => wcj_get_option( 'wcj_gateways_fees_min_cart_amount', array() ),
54
+ 'max_cart_amount' => wcj_get_option( 'wcj_gateways_fees_max_cart_amount', array() ),
55
+ 'round' => wcj_get_option( 'wcj_gateways_fees_round', array() ),
56
+ 'round_precision' => wcj_get_option( 'wcj_gateways_fees_round_precision', array() ),
57
+ 'is_taxable' => wcj_get_option( 'wcj_gateways_fees_is_taxable', array() ),
58
+ 'tax_class_id' => wcj_get_option( 'wcj_gateways_fees_tax_class_id', array() ),
59
+ 'exclude_shipping' => wcj_get_option( 'wcj_gateways_fees_exclude_shipping', array() ),
60
+ 'include_taxes' => wcj_get_option( 'wcj_gateways_fees_include_taxes', array() ),
61
+ 'include_products' => apply_filters( 'booster_option', array(), wcj_get_option( 'wcj_gateways_fees_include_products', array() ) ),
62
+ 'exclude_products' => apply_filters( 'booster_option', array(), wcj_get_option( 'wcj_gateways_fees_exclude_products', array() ) ),
63
  );
64
  $this->defaults = array(
65
  'text' => '',
68
  'min_cart_amount' => 0,
69
  'max_cart_amount' => 0,
70
  'round' => 'no',
71
+ 'round_precision' => wcj_get_option( 'woocommerce_price_num_decimals', 2 ),
72
  'is_taxable' => 'no',
73
  'tax_class_id' => '',
74
  'exclude_shipping' => 'no',
154
  // Pre-sets the default available payment gateway on cart and checkout pages.
155
  if (
156
  empty( $gateway ) &&
157
+ 'yes' === wcj_get_option( 'wcj_gateways_fees_force_default_payment_gateway', 'no' ) &&
158
  ( is_checkout() || is_cart() )
159
  ) {
160
  $gateways = WC()->payment_gateways->get_available_payment_gateways();
includes/class-wcj-payment-gateways-icons.php CHANGED
@@ -32,7 +32,7 @@ class WCJ_Payment_Gateways_Icons extends WCJ_Module {
32
  // compatibility with 2.3.0 or below
33
  $default_gateways = array( 'cod', 'cheque', 'bacs', 'mijireh_checkout', 'paypal' );
34
  foreach ( $default_gateways as $key ) {
35
- $deprecated_option = get_option( 'wcj_payment_gateways_icons_' . 'woocommerce_' . $key . '_icon', '' );
36
  if ( '' != $deprecated_option ) {
37
  update_option( 'wcj_gateways_icons_' . $key . '_icon', $deprecated_option );
38
  delete_option( 'wcj_payment_gateways_icons_' . 'woocommerce_' . $key . '_icon' );
@@ -51,10 +51,10 @@ class WCJ_Payment_Gateways_Icons extends WCJ_Module {
51
  if ( ! empty( $default_gateways ) && ! in_array( $key, $default_gateways ) ) {
52
  return $icon;
53
  }
54
- if ( 'yes' === get_option( 'wcj_gateways_icons_' . $key . '_icon_remove', 'no' ) ) {
55
  return '';
56
  }
57
- $custom_icon_url = get_option( 'wcj_gateways_icons_' . $key . '_icon', '' );
58
  return ( '' == $custom_icon_url ) ? $icon : '<img src="' . $custom_icon_url . '" alt="' . $key . '" />';
59
  }
60
 
32
  // compatibility with 2.3.0 or below
33
  $default_gateways = array( 'cod', 'cheque', 'bacs', 'mijireh_checkout', 'paypal' );
34
  foreach ( $default_gateways as $key ) {
35
+ $deprecated_option = wcj_get_option( 'wcj_payment_gateways_icons_' . 'woocommerce_' . $key . '_icon', '' );
36
  if ( '' != $deprecated_option ) {
37
  update_option( 'wcj_gateways_icons_' . $key . '_icon', $deprecated_option );
38
  delete_option( 'wcj_payment_gateways_icons_' . 'woocommerce_' . $key . '_icon' );
51
  if ( ! empty( $default_gateways ) && ! in_array( $key, $default_gateways ) ) {
52
  return $icon;
53
  }
54
+ if ( 'yes' === wcj_get_option( 'wcj_gateways_icons_' . $key . '_icon_remove', 'no' ) ) {
55
  return '';
56
  }
57
+ $custom_icon_url = wcj_get_option( 'wcj_gateways_icons_' . $key . '_icon', '' );
58
  return ( '' == $custom_icon_url ) ? $icon : '<img src="' . $custom_icon_url . '" alt="' . $key . '" />';
59
  }
60
 
includes/class-wcj-payment-gateways-min-max.php CHANGED
@@ -53,8 +53,8 @@ class WCJ_Payment_Gateways_Min_Max extends WCJ_Module {
53
  }
54
  WC()->payment_gateways->get_available_payment_gateways();
55
  $notices = $this->notices;
56
- if ( function_exists( 'is_checkout' ) && is_checkout() && 'yes' === get_option( 'wcj_payment_gateways_min_max_notices_enable', 'yes' ) && ! empty( $notices ) ) {
57
- $notice_type = get_option( 'wcj_payment_gateways_min_max_notices_type', 'notice' );
58
  foreach ( $notices as $notice ) {
59
  if ( ! wc_has_notice( $notice, $notice_type ) ) {
60
  wc_add_notice( $notice, $notice_type );
@@ -81,18 +81,18 @@ class WCJ_Payment_Gateways_Min_Max extends WCJ_Module {
81
  );
82
  }
83
  $total_in_cart = WC()->cart->cart_contents_total;
84
- if ( 'no' === get_option( 'wcj_payment_gateways_min_max_exclude_shipping', 'no' ) ) {
85
  $total_in_cart += WC()->cart->shipping_total;
86
  }
87
  $notices = array();
88
- $notices_template_min = get_option( 'wcj_payment_gateways_min_max_notices_template_min', __( 'Minimum amount for %gateway_title% is %min_amount%', 'woocommerce-jetpack' ) );
89
- $notices_template_max = get_option( 'wcj_payment_gateways_min_max_notices_template_max', __( 'Maximum amount for %gateway_title% is %max_amount%', 'woocommerce-jetpack' ) );
90
  foreach ( $_available_gateways as $key => $gateway ) {
91
- $min = get_option( 'wcj_payment_gateways_min_' . $key, 0 );
92
- $max = get_option( 'wcj_payment_gateways_max_' . $key, 0 );
93
 
94
  // Compatibility with other modules
95
- if ( 'yes' === get_option( 'wcj_payment_gateways_min_max_comp_mc', 'no' ) ) {
96
  if ( wcj_is_module_enabled( 'multicurrency' ) ) {
97
  $min = WCJ()->modules['multicurrency']->change_price( $min, null );
98
  $max = WCJ()->modules['multicurrency']->change_price( $max, null );
53
  }
54
  WC()->payment_gateways->get_available_payment_gateways();
55
  $notices = $this->notices;
56
+ if ( function_exists( 'is_checkout' ) && is_checkout() && 'yes' === wcj_get_option( 'wcj_payment_gateways_min_max_notices_enable', 'yes' ) && ! empty( $notices ) ) {
57
+ $notice_type = wcj_get_option( 'wcj_payment_gateways_min_max_notices_type', 'notice' );
58
  foreach ( $notices as $notice ) {
59
  if ( ! wc_has_notice( $notice, $notice_type ) ) {
60
  wc_add_notice( $notice, $notice_type );
81
  );
82
  }
83
  $total_in_cart = WC()->cart->cart_contents_total;
84
+ if ( 'no' === wcj_get_option( 'wcj_payment_gateways_min_max_exclude_shipping', 'no' ) ) {
85
  $total_in_cart += WC()->cart->shipping_total;
86
  }
87
  $notices = array();
88
+ $notices_template_min = wcj_get_option( 'wcj_payment_gateways_min_max_notices_template_min', __( 'Minimum amount for %gateway_title% is %min_amount%', 'woocommerce-jetpack' ) );
89
+ $notices_template_max = wcj_get_option( 'wcj_payment_gateways_min_max_notices_template_max', __( 'Maximum amount for %gateway_title% is %max_amount%', 'woocommerce-jetpack' ) );
90
  foreach ( $_available_gateways as $key => $gateway ) {
91
+ $min = wcj_get_option( 'wcj_payment_gateways_min_' . $key, 0 );
92
+ $max = wcj_get_option( 'wcj_payment_gateways_max_' . $key, 0 );
93
 
94
  // Compatibility with other modules
95
+ if ( 'yes' === wcj_get_option( 'wcj_payment_gateways_min_max_comp_mc', 'no' ) ) {
96
  if ( wcj_is_module_enabled( 'multicurrency' ) ) {
97
  $min = WCJ()->modules['multicurrency']->change_price( $min, null );
98
  $max = WCJ()->modules['multicurrency']->change_price( $max, null );
includes/class-wcj-payment-gateways-per-category.php CHANGED
@@ -30,7 +30,7 @@ class WCJ_Payment_Gateways_Per_Category extends WCJ_Module {
30
 
31
  if ( $this->is_enabled() ) {
32
  add_filter( 'woocommerce_available_payment_gateways', array( $this, 'filter_available_payment_gateways_per_category' ), 100 );
33
- $this->do_use_variations = ( 'yes' === get_option( 'wcj_gateways_per_category_use_variations', 'no' ) );
34
  }
35
 
36
  }
@@ -48,7 +48,7 @@ class WCJ_Payment_Gateways_Per_Category extends WCJ_Module {
48
  */
49
  function is_gateway_allowed( $gateway_id, $products = array() ) {
50
  // Including by categories
51
- $categories_in = $this->get_option( 'wcj_gateways_per_category_' . $gateway_id );
52
  if ( ! empty( $categories_in ) ) {
53
  $current_check = false;
54
  foreach ( $products as $product_id ) {
@@ -69,7 +69,7 @@ class WCJ_Payment_Gateways_Per_Category extends WCJ_Module {
69
  }
70
 
71
  // Excluding by categories
72
- $categories_excl = $this->get_option( 'wcj_gateways_per_category_excl_' . $gateway_id );
73
  if ( ! empty( $categories_excl ) ) {
74
  $current_check = true;
75
  foreach ( $products as $product_id ) {
@@ -90,7 +90,7 @@ class WCJ_Payment_Gateways_Per_Category extends WCJ_Module {
90
  }
91
 
92
  // Including by products
93
- $products_in = wcj_maybe_convert_string_to_array( apply_filters( 'booster_option', array(), $this->get_option( 'wcj_gateways_per_products_' . $gateway_id ) ) );
94
  if ( ! empty( $products_in ) ) {
95
  $current_check = false;
96
  foreach ( $products as $product_id ) {
@@ -106,7 +106,7 @@ class WCJ_Payment_Gateways_Per_Category extends WCJ_Module {
106
  }
107
 
108
  // Excluding by products
109
- $products_excl = wcj_maybe_convert_string_to_array( apply_filters( 'booster_option', array(), $this->get_option( 'wcj_gateways_per_products_excl_' . $gateway_id ) ) );
110
  if ( ! empty( $products_excl ) ) {
111
  $current_check = true;
112
  foreach ( $products as $product_id ) {
30
 
31
  if ( $this->is_enabled() ) {
32
  add_filter( 'woocommerce_available_payment_gateways', array( $this, 'filter_available_payment_gateways_per_category' ), 100 );
33
+ $this->do_use_variations = ( 'yes' === wcj_get_option( 'wcj_gateways_per_category_use_variations', 'no' ) );
34
  }
35
 
36
  }
48
  */
49
  function is_gateway_allowed( $gateway_id, $products = array() ) {
50
  // Including by categories
51
+ $categories_in = wcj_get_option( 'wcj_gateways_per_category_' . $gateway_id );
52
  if ( ! empty( $categories_in ) ) {
53
  $current_check = false;
54
  foreach ( $products as $product_id ) {
69
  }
70
 
71
  // Excluding by categories
72
+ $categories_excl = wcj_get_option( 'wcj_gateways_per_category_excl_' . $gateway_id );
73
  if ( ! empty( $categories_excl ) ) {
74
  $current_check = true;
75
  foreach ( $products as $product_id ) {
90
  }
91
 
92
  // Including by products
93
+ $products_in = wcj_maybe_convert_string_to_array( apply_filters( 'booster_option', array(), wcj_get_option( 'wcj_gateways_per_products_' . $gateway_id ) ) );
94
  if ( ! empty( $products_in ) ) {
95
  $current_check = false;
96
  foreach ( $products as $product_id ) {
106
  }
107
 
108
  // Excluding by products
109
+ $products_excl = wcj_maybe_convert_string_to_array( apply_filters( 'booster_option', array(), wcj_get_option( 'wcj_gateways_per_products_excl_' . $gateway_id ) ) );
110
  if ( ! empty( $products_excl ) ) {
111
  $current_check = true;
112
  foreach ( $products as $product_id ) {
includes/class-wcj-payment-gateways.php CHANGED
@@ -113,7 +113,7 @@ class WCJ_Payment_Gateways extends WCJ_Module {
113
  $table_data[] = array( $name, $value );
114
  }
115
  $html .= wcj_get_table_html( $table_data, array( 'table_class' => 'widefat striped', 'table_heading_type' => 'vertical', ) );
116
- if ( 'yes' === get_option( 'wcj_custom_payment_gateways_input_fields_delete_button', 'no' ) ) {
117
  $html .= '<p><a style="color:#a00;" href="' . add_query_arg( 'wcj_delete_payment_gateway_input_fields', $order_id ) . '"' . wcj_get_js_confirmation() . '>' .
118
  __( 'Delete', 'woocommerce-jetpack' ) . '</a></p>';
119
  }
113
  $table_data[] = array( $name, $value );
114
  }
115
  $html .= wcj_get_table_html( $table_data, array( 'table_class' => 'widefat striped', 'table_heading_type' => 'vertical', ) );
116
+ if ( 'yes' === wcj_get_option( 'wcj_custom_payment_gateways_input_fields_delete_button', 'no' ) ) {
117
  $html .= '<p><a style="color:#a00;" href="' . add_query_arg( 'wcj_delete_payment_gateway_input_fields', $order_id ) . '"' . wcj_get_js_confirmation() . '>' .
118
  __( 'Delete', 'woocommerce-jetpack' ) . '</a></p>';
119
  }
includes/class-wcj-pdf-invoicing.php CHANGED
@@ -71,7 +71,7 @@ class WCJ_PDF_Invoicing extends WCJ_Module {
71
  }
72
 
73
  // Editable numbers in meta box
74
- if ( 'yes' === get_option( 'wcj_invoicing_add_order_meta_box_numbering', 'yes' ) ) {
75
  add_action( 'save_post_shop_order', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
76
  }
77
 
@@ -273,7 +273,7 @@ class WCJ_PDF_Invoicing extends WCJ_Module {
273
  $fpdi_pdf->useImportedPage( $page_id );
274
  }
275
  }
276
- $fpdi_pdf->Output( 'docs.pdf', ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type_id . '_save_as_enabled', 'no' ) ? 'D' : 'I' ) );
277
  die();
278
  }
279
 
@@ -417,7 +417,7 @@ class WCJ_PDF_Invoicing extends WCJ_Module {
417
  if ( $allow_order_owner && get_current_user_id() == intval( get_post_meta( $this->order_id, '_customer_user', true ) ) ) {
418
  return true;
419
  }
420
- $allowed_user_roles = get_option( 'wcj_invoicing_' . $this->invoice_type_id . '_roles', array( 'administrator', 'shop_manager' ) );
421
  if ( empty( $allowed_user_roles ) ) {
422
  $allowed_user_roles = array( 'administrator' );
423
  }
@@ -452,7 +452,7 @@ class WCJ_PDF_Invoicing extends WCJ_Module {
452
  // Get PDF
453
  $the_invoice = wcj_get_pdf_invoice( $this->order_id, $this->invoice_type_id );
454
  $dest = ( true === $this->save_as_pdf ? 'D' : 'I' );
455
- if ( 'yes' === get_option( 'wcj_general_advanced_disable_output_buffer', 'no' ) ) {
456
  ob_clean();
457
  ob_flush();
458
  $the_invoice->get_pdf( $dest );
71
  }
72
 
73
  // Editable numbers in meta box
74
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_add_order_meta_box_numbering', 'yes' ) ) {
75
  add_action( 'save_post_shop_order', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
76
  }
77
 
273
  $fpdi_pdf->useImportedPage( $page_id );
274
  }
275
  }
276
+ $fpdi_pdf->Output( 'docs.pdf', ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type_id . '_save_as_enabled', 'no' ) ? 'D' : 'I' ) );
277
  die();
278
  }
279
 
417
  if ( $allow_order_owner && get_current_user_id() == intval( get_post_meta( $this->order_id, '_customer_user', true ) ) ) {
418
  return true;
419
  }
420
+ $allowed_user_roles = wcj_get_option( 'wcj_invoicing_' . $this->invoice_type_id . '_roles', array( 'administrator', 'shop_manager' ) );
421
  if ( empty( $allowed_user_roles ) ) {
422
  $allowed_user_roles = array( 'administrator' );
423
  }
452
  // Get PDF
453
  $the_invoice = wcj_get_pdf_invoice( $this->order_id, $this->invoice_type_id );
454
  $dest = ( true === $this->save_as_pdf ? 'D' : 'I' );
455
+ if ( 'yes' === wcj_get_option( 'wcj_general_advanced_disable_output_buffer', 'no' ) ) {
456
  ob_clean();
457
  ob_flush();
458
  $the_invoice->get_pdf( $dest );
includes/class-wcj-price-by-country.php CHANGED
@@ -57,10 +57,10 @@ class WCJ_Price_By_Country extends WCJ_Module {
57
  if ( is_admin() ) {
58
  // Backend
59
  include_once( 'reports/class-wcj-currency-reports.php' );
60
- if ( 'yes' === get_option( 'wcj_price_by_country_local_enabled', 'yes' ) ) {
61
- $backend_user_roles = get_option( 'wcj_price_by_country_backend_user_roles', '' );
62
  if ( empty( $backend_user_roles ) || wcj_is_user_role( $backend_user_roles ) ) {
63
- if ( 'inline' === get_option( 'wcj_price_by_country_local_options_style', 'inline' ) ) {
64
  include_once( 'price-by-country/class-wcj-price-by-country-local.php' );
65
  } else {
66
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
@@ -74,7 +74,7 @@ class WCJ_Price_By_Country extends WCJ_Module {
74
  }
75
 
76
  // Price Filter Widget
77
- if ( 'yes' === get_option( 'wcj_price_by_country_price_filter_widget_support_enabled', 'no' ) ) {
78
  add_action( 'save_post_product', array( $this, 'update_products_price_by_country_product_saved' ), PHP_INT_MAX, 2 );
79
  add_action( 'woocommerce_ajax_save_product_variations', array( $this, 'update_products_price_by_country_product_saved_ajax' ), PHP_INT_MAX, 1 );
80
  }
@@ -91,7 +91,7 @@ class WCJ_Price_By_Country extends WCJ_Module {
91
  }
92
 
93
  // Price Filter Widget
94
- if ( 'yes' === get_option( 'wcj_price_by_country_price_filter_widget_support_enabled', 'no' ) ) {
95
  add_action( 'woojetpack_after_settings_save', array( $this, 'update_products_price_by_country_module_saved' ), PHP_INT_MAX, 2 );
96
  }
97
 
@@ -127,7 +127,7 @@ class WCJ_Price_By_Country extends WCJ_Module {
127
  */
128
  function fix_wc_coupon_currency( $amount, $discount, $cart_item, $single, $wc_coupon ) {
129
  if (
130
- 'yes' !== get_option( 'wcj_price_by_country_compatibility_wc_coupons', 'no' ) ||
131
  'fixed_cart' !== $wc_coupon->get_discount_type()
132
  ) {
133
  return $amount;
57
  if ( is_admin() ) {
58
  // Backend
59
  include_once( 'reports/class-wcj-currency-reports.php' );
60
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_country_local_enabled', 'yes' ) ) {
61
+ $backend_user_roles = wcj_get_option( 'wcj_price_by_country_backend_user_roles', '' );
62
  if ( empty( $backend_user_roles ) || wcj_is_user_role( $backend_user_roles ) ) {
63
+ if ( 'inline' === wcj_get_option( 'wcj_price_by_country_local_options_style', 'inline' ) ) {
64
  include_once( 'price-by-country/class-wcj-price-by-country-local.php' );
65
  } else {
66
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
74
  }
75
 
76
  // Price Filter Widget
77
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_country_price_filter_widget_support_enabled', 'no' ) ) {
78
  add_action( 'save_post_product', array( $this, 'update_products_price_by_country_product_saved' ), PHP_INT_MAX, 2 );
79
  add_action( 'woocommerce_ajax_save_product_variations', array( $this, 'update_products_price_by_country_product_saved_ajax' ), PHP_INT_MAX, 1 );
80
  }
91
  }
92
 
93
  // Price Filter Widget
94
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_country_price_filter_widget_support_enabled', 'no' ) ) {
95
  add_action( 'woojetpack_after_settings_save', array( $this, 'update_products_price_by_country_module_saved' ), PHP_INT_MAX, 2 );
96
  }
97
 
127
  */
128
  function fix_wc_coupon_currency( $amount, $discount, $cart_item, $single, $wc_coupon ) {
129
  if (
130
+ 'yes' !== wcj_get_option( 'wcj_price_by_country_compatibility_wc_coupons', 'no' ) ||
131
  'fixed_cart' !== $wc_coupon->get_discount_type()
132
  ) {
133
  return $amount;
includes/class-wcj-price-by-user-role.php CHANGED
@@ -31,14 +31,14 @@ class WCJ_Price_By_User_Role extends WCJ_Module {
31
 
32
  if ( $this->is_enabled() ) {
33
  $this->price_hooks_priority = wcj_get_module_price_hooks_priority( 'price_by_user_role' );
34
- if ( 'yes' === get_option( 'wcj_price_by_user_role_per_product_enabled', 'yes' ) ) {
35
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
36
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
37
  }
38
  if ( wcj_is_frontend() ) {
39
- if ( 'no' === get_option( 'wcj_price_by_user_role_for_bots_disabled', 'no' ) || ! wcj_is_bot() ) {
40
  wcj_add_change_price_hooks( $this, $this->price_hooks_priority );
41
- if ( ( $this->disable_for_regular_price = ( 'yes' === get_option( 'wcj_price_by_user_role_disable_for_regular_price', 'no' ) ) ) ) {
42
  add_filter( 'woocommerce_product_is_on_sale', array( $this, 'maybe_make_on_sale' ), PHP_INT_MAX, 2 );
43
  }
44
  }
@@ -69,7 +69,7 @@ class WCJ_Price_By_User_Role extends WCJ_Module {
69
  */
70
  function change_bundle_product_price( $change, $price, $_product ) {
71
  if (
72
- 'yes' !== get_option( 'wcj_price_by_user_role_compatibility_wc_product_bundles', 'no' )
73
  || ! function_exists( 'wc_pb_get_bundled_product_map' )
74
  || ! $_product
75
  || $price > 0
@@ -92,10 +92,10 @@ class WCJ_Price_By_User_Role extends WCJ_Module {
92
  if ( ! empty( $product->get_price() ) ) {
93
  return;
94
  }
95
- if ( 'yes' === get_option( 'wcj_price_by_user_role_remove_single_variation', 'no' ) ) {
96
  remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation', apply_filters( 'wcj_remove_single_variation_priority', 10 ) );
97
  }
98
- if ( 'yes' === get_option( 'wcj_price_by_user_role_remove_add_to_cart_btn', 'no' ) ) {
99
  remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', apply_filters( 'wcj_remove_single_variation_add_to_cart_button_priority', 20 ) );
100
  }
101
  }
@@ -112,7 +112,7 @@ class WCJ_Price_By_User_Role extends WCJ_Module {
112
  */
113
  function show_empty_price_variations( $hide ) {
114
  if (
115
- 'no' === get_option( 'wcj_price_by_user_role_show_empty_price_variations', 'no' )
116
  ) {
117
  return $hide;
118
  }
@@ -243,9 +243,9 @@ class WCJ_Price_By_User_Role extends WCJ_Module {
243
  * @since 2.5.0
244
  */
245
  function change_price_shipping( $package_rates, $package ) {
246
- if ( 'yes' === get_option( 'wcj_price_by_user_role_shipping_enabled', 'no' ) ) {
247
  $current_user_role = wcj_get_current_user_first_role();
248
- $koef = get_option( 'wcj_price_by_user_role_' . $current_user_role, 1 );
249
  return wcj_change_price_shipping_package_rates( $package_rates, $koef );
250
  }
251
  return $package_rates;
@@ -259,7 +259,7 @@ class WCJ_Price_By_User_Role extends WCJ_Module {
259
  */
260
  function change_price_grouped( $price, $qty, $_product ) {
261
  if ( $_product->is_type( 'grouped' ) ) {
262
- if ( 'yes' === get_option( 'wcj_price_by_user_role_per_product_enabled', 'yes' ) ) {
263
  foreach ( $_product->get_children() as $child_id ) {
264
  $the_price = get_post_meta( $child_id, '_price', true );
265
  $the_product = wc_get_product( $child_id );
@@ -293,7 +293,7 @@ class WCJ_Price_By_User_Role extends WCJ_Module {
293
  return $price;
294
  }
295
 
296
- if ( 'yes' === get_option( 'wcj_price_by_user_role_check_for_product_changes_price', 'no' ) && $_product ) {
297
  $product_changes = $_product->get_changes();
298
  if ( ! empty( $product_changes ) && isset( $product_changes['price'] ) ) {
299
  return $price;
@@ -301,13 +301,13 @@ class WCJ_Price_By_User_Role extends WCJ_Module {
301
  }
302
 
303
  // Per product
304
- if ( 'yes' === get_option( 'wcj_price_by_user_role_per_product_enabled', 'yes' ) ) {
305
  if ( 'yes' === get_post_meta( wcj_maybe_get_product_id_wpml( wcj_get_product_id_or_variation_parent_id( $_product ) ), '_' . 'wcj_price_by_user_role_per_product_settings_enabled', true ) ) {
306
  $_product_id = wcj_maybe_get_product_id_wpml( wcj_get_product_id( $_product ) );
307
  if ( 'yes' === get_post_meta( $_product_id, '_' . 'wcj_price_by_user_role_empty_price_' . $current_user_role, true ) ) {
308
  return '';
309
  }
310
- if ( 'multiplier' === get_option( 'wcj_price_by_user_role_per_product_type', 'fixed' ) ) {
311
  if ( '' !== ( $multiplier_per_product = get_post_meta( $_product_id, '_' . 'wcj_price_by_user_role_multiplier_' . $current_user_role, true ) ) ) {
312
  // Maybe disable for regular price hooks
313
  if ( $this->disable_for_regular_price && in_array( $_current_filter, array(
@@ -352,7 +352,7 @@ class WCJ_Price_By_User_Role extends WCJ_Module {
352
  }
353
 
354
  // Maybe disable for products on sale
355
- if ( 'yes' === get_option( 'wcj_price_by_user_role_disable_for_products_on_sale', 'no' ) ) {
356
  wcj_remove_change_price_hooks( $this, $this->price_hooks_priority );
357
  if ( $_product && $_product->is_on_sale() ) {
358
  wcj_add_change_price_hooks( $this, $this->price_hooks_priority );
@@ -372,7 +372,7 @@ class WCJ_Price_By_User_Role extends WCJ_Module {
372
  }
373
 
374
  // By category
375
- $categories = apply_filters( 'booster_option', '', get_option( 'wcj_price_by_user_role_categories', '' ) );
376
  if ( ! empty( $categories ) ) {
377
  $product_categories = get_the_terms( wcj_maybe_get_product_id_wpml( wcj_get_product_id_or_variation_parent_id( $_product ) ), 'product_cat' );
378
  if ( ! empty( $product_categories ) ) {
@@ -381,14 +381,14 @@ class WCJ_Price_By_User_Role extends WCJ_Module {
381
  if (
382
  $product_category->term_id == $category ||
383
  (
384
- 'yes' === get_option( 'wcj_price_by_user_role_check_child_categories', 'no' ) &&
385
  term_is_ancestor_of( $category, $product_category->term_id, 'product_cat' )
386
  )
387
  ) {
388
- if ( 'yes' === get_option( 'wcj_price_by_user_role_cat_empty_price_' . $category . '_' . $current_user_role, 'no' ) ) {
389
  return '';
390
  }
391
- if ( ( $koef_category = get_option( 'wcj_price_by_user_role_cat_' . $category . '_' . $current_user_role, -1 ) ) >= 0 ) {
392
  return ( '' === $price ) ? $price : $price * (float) $koef_category;
393
  }
394
  }
@@ -398,17 +398,17 @@ class WCJ_Price_By_User_Role extends WCJ_Module {
398
  }
399
 
400
  // By tag
401
- $tags = apply_filters( 'booster_option', '', get_option( 'wcj_price_by_user_role_tags', '' ) );
402
  if ( ! empty( $tags ) ) {
403
  $product_tags = get_the_terms( wcj_maybe_get_product_id_wpml( wcj_get_product_id_or_variation_parent_id( $_product ) ), 'product_tag' );
404
  if ( ! empty( $product_tags ) ) {
405
  foreach ( $product_tags as $product_tag ) {
406
  foreach ( $tags as $tag ) {
407
  if ( $product_tag->term_id == $tag ) {
408
- if ( 'yes' === get_option( 'wcj_price_by_user_role_tag_empty_price_' . $tag . '_' . $current_user_role, 'no' ) ) {
409
  return '';
410
  }
411
- if ( ( $koef_tag = get_option( 'wcj_price_by_user_role_tag_' . $tag . '_' . $current_user_role, -1 ) ) >= 0 ) {
412
  return ( '' === $price ) ? $price : $price * (float) $koef_tag;
413
  }
414
  }
@@ -418,10 +418,10 @@ class WCJ_Price_By_User_Role extends WCJ_Module {
418
  }
419
 
420
  // Global
421
- if ( 'yes' === get_option( 'wcj_price_by_user_role_empty_price_' . $current_user_role, 'no' ) ) {
422
  return '';
423
  }
424
- if ( 1 != ( $koef = get_option( 'wcj_price_by_user_role_' . $current_user_role, 1 ) ) ) {
425
  return ( '' === $price ) ? $price : $price * (float) $koef;
426
  }
427
 
@@ -439,8 +439,8 @@ class WCJ_Price_By_User_Role extends WCJ_Module {
439
  */
440
  function get_variation_prices_hash( $price_hash, $_product, $display ) {
441
  $user_role = wcj_get_current_user_first_role();
442
- $categories = apply_filters( 'booster_option', '', get_option( 'wcj_price_by_user_role_categories', '' ) );
443
- $tags = apply_filters( 'booster_option', '', get_option( 'wcj_price_by_user_role_tags', '' ) );
444
  $price_hash['wcj_user_role'] = array(
445
  $user_role,
446
  get_option( 'wcj_price_by_user_role_' . $user_role, 1 ),
@@ -454,14 +454,14 @@ class WCJ_Price_By_User_Role extends WCJ_Module {
454
  );
455
  if ( ! empty( $categories ) ) {
456
  foreach ( $categories as $category ) {
457
- $price_hash['wcj_user_role'][] = get_option( 'wcj_price_by_user_role_cat_empty_price_' . $category . '_' . $user_role, 'no' );
458
- $price_hash['wcj_user_role'][] = get_option( 'wcj_price_by_user_role_cat_' . $category . '_' . $user_role, -1 );
459
  }
460
  }
461
  if ( ! empty( $tags ) ) {
462
  foreach ( $tags as $tag ) {
463
- $price_hash['wcj_user_role'][] = get_option( 'wcj_price_by_user_role_tag_empty_price_' . $tag . '_' . $user_role, 'no' );
464
- $price_hash['wcj_user_role'][] = get_option( 'wcj_price_by_user_role_tag_' . $tag . '_' . $user_role, -1 );
465
  }
466
  }
467
  return $price_hash;
31
 
32
  if ( $this->is_enabled() ) {
33
  $this->price_hooks_priority = wcj_get_module_price_hooks_priority( 'price_by_user_role' );
34
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_user_role_per_product_enabled', 'yes' ) ) {
35
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
36
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
37
  }
38
  if ( wcj_is_frontend() ) {
39
+ if ( 'no' === wcj_get_option( 'wcj_price_by_user_role_for_bots_disabled', 'no' ) || ! wcj_is_bot() ) {
40
  wcj_add_change_price_hooks( $this, $this->price_hooks_priority );
41
+ if ( ( $this->disable_for_regular_price = ( 'yes' === wcj_get_option( 'wcj_price_by_user_role_disable_for_regular_price', 'no' ) ) ) ) {
42
  add_filter( 'woocommerce_product_is_on_sale', array( $this, 'maybe_make_on_sale' ), PHP_INT_MAX, 2 );
43
  }
44
  }
69
  */
70
  function change_bundle_product_price( $change, $price, $_product ) {
71
  if (
72
+ 'yes' !== wcj_get_option( 'wcj_price_by_user_role_compatibility_wc_product_bundles', 'no' )
73
  || ! function_exists( 'wc_pb_get_bundled_product_map' )
74
  || ! $_product
75
  || $price > 0
92
  if ( ! empty( $product->get_price() ) ) {
93
  return;
94
  }
95
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_user_role_remove_single_variation', 'no' ) ) {
96
  remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation', apply_filters( 'wcj_remove_single_variation_priority', 10 ) );
97
  }
98
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_user_role_remove_add_to_cart_btn', 'no' ) ) {
99
  remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', apply_filters( 'wcj_remove_single_variation_add_to_cart_button_priority', 20 ) );
100
  }
101
  }
112
  */
113
  function show_empty_price_variations( $hide ) {
114
  if (
115
+ 'no' === wcj_get_option( 'wcj_price_by_user_role_show_empty_price_variations', 'no' )
116
  ) {
117
  return $hide;
118
  }
243
  * @since 2.5.0
244
  */
245
  function change_price_shipping( $package_rates, $package ) {
246
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_user_role_shipping_enabled', 'no' ) ) {
247
  $current_user_role = wcj_get_current_user_first_role();
248
+ $koef = wcj_get_option( 'wcj_price_by_user_role_' . $current_user_role, 1 );
249
  return wcj_change_price_shipping_package_rates( $package_rates, $koef );
250
  }
251
  return $package_rates;
259
  */
260
  function change_price_grouped( $price, $qty, $_product ) {
261
  if ( $_product->is_type( 'grouped' ) ) {
262
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_user_role_per_product_enabled', 'yes' ) ) {
263
  foreach ( $_product->get_children() as $child_id ) {
264
  $the_price = get_post_meta( $child_id, '_price', true );
265
  $the_product = wc_get_product( $child_id );
293
  return $price;
294
  }
295
 
296
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_user_role_check_for_product_changes_price', 'no' ) && $_product ) {
297
  $product_changes = $_product->get_changes();
298
  if ( ! empty( $product_changes ) && isset( $product_changes['price'] ) ) {
299
  return $price;
301
  }
302
 
303
  // Per product
304
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_user_role_per_product_enabled', 'yes' ) ) {
305
  if ( 'yes' === get_post_meta( wcj_maybe_get_product_id_wpml( wcj_get_product_id_or_variation_parent_id( $_product ) ), '_' . 'wcj_price_by_user_role_per_product_settings_enabled', true ) ) {
306
  $_product_id = wcj_maybe_get_product_id_wpml( wcj_get_product_id( $_product ) );
307
  if ( 'yes' === get_post_meta( $_product_id, '_' . 'wcj_price_by_user_role_empty_price_' . $current_user_role, true ) ) {
308
  return '';
309
  }
310
+ if ( 'multiplier' === wcj_get_option( 'wcj_price_by_user_role_per_product_type', 'fixed' ) ) {
311
  if ( '' !== ( $multiplier_per_product = get_post_meta( $_product_id, '_' . 'wcj_price_by_user_role_multiplier_' . $current_user_role, true ) ) ) {
312
  // Maybe disable for regular price hooks
313
  if ( $this->disable_for_regular_price && in_array( $_current_filter, array(
352
  }
353
 
354
  // Maybe disable for products on sale
355
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_user_role_disable_for_products_on_sale', 'no' ) ) {
356
  wcj_remove_change_price_hooks( $this, $this->price_hooks_priority );
357
  if ( $_product && $_product->is_on_sale() ) {
358
  wcj_add_change_price_hooks( $this, $this->price_hooks_priority );
372
  }
373
 
374
  // By category
375
+ $categories = apply_filters( 'booster_option', '', wcj_get_option( 'wcj_price_by_user_role_categories', '' ) );
376
  if ( ! empty( $categories ) ) {
377
  $product_categories = get_the_terms( wcj_maybe_get_product_id_wpml( wcj_get_product_id_or_variation_parent_id( $_product ) ), 'product_cat' );
378
  if ( ! empty( $product_categories ) ) {
381
  if (
382
  $product_category->term_id == $category ||
383
  (
384
+ 'yes' === wcj_get_option( 'wcj_price_by_user_role_check_child_categories', 'no' ) &&
385
  term_is_ancestor_of( $category, $product_category->term_id, 'product_cat' )
386
  )
387
  ) {
388
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_user_role_cat_empty_price_' . $category . '_' . $current_user_role, 'no' ) ) {
389
  return '';
390
  }
391
+ if ( ( $koef_category = wcj_get_option( 'wcj_price_by_user_role_cat_' . $category . '_' . $current_user_role, -1 ) ) >= 0 ) {
392
  return ( '' === $price ) ? $price : $price * (float) $koef_category;
393
  }
394
  }
398
  }
399
 
400
  // By tag
401
+ $tags = apply_filters( 'booster_option', '', wcj_get_option( 'wcj_price_by_user_role_tags', '' ) );
402
  if ( ! empty( $tags ) ) {
403
  $product_tags = get_the_terms( wcj_maybe_get_product_id_wpml( wcj_get_product_id_or_variation_parent_id( $_product ) ), 'product_tag' );
404
  if ( ! empty( $product_tags ) ) {
405
  foreach ( $product_tags as $product_tag ) {
406
  foreach ( $tags as $tag ) {
407
  if ( $product_tag->term_id == $tag ) {
408
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_user_role_tag_empty_price_' . $tag . '_' . $current_user_role, 'no' ) ) {
409
  return '';
410
  }
411
+ if ( ( $koef_tag = wcj_get_option( 'wcj_price_by_user_role_tag_' . $tag . '_' . $current_user_role, -1 ) ) >= 0 ) {
412
  return ( '' === $price ) ? $price : $price * (float) $koef_tag;
413
  }
414
  }
418
  }
419
 
420
  // Global
421
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_user_role_empty_price_' . $current_user_role, 'no' ) ) {
422
  return '';
423
  }
424
+ if ( 1 != ( $koef = wcj_get_option( 'wcj_price_by_user_role_' . $current_user_role, 1 ) ) ) {
425
  return ( '' === $price ) ? $price : $price * (float) $koef;
426
  }
427
 
439
  */
440
  function get_variation_prices_hash( $price_hash, $_product, $display ) {
441
  $user_role = wcj_get_current_user_first_role();
442
+ $categories = apply_filters( 'booster_option', '', wcj_get_option( 'wcj_price_by_user_role_categories', '' ) );
443
+ $tags = apply_filters( 'booster_option', '', wcj_get_option( 'wcj_price_by_user_role_tags', '' ) );
444
  $price_hash['wcj_user_role'] = array(
445
  $user_role,
446
  get_option( 'wcj_price_by_user_role_' . $user_role, 1 ),
454
  );
455
  if ( ! empty( $categories ) ) {
456
  foreach ( $categories as $category ) {
457
+ $price_hash['wcj_user_role'][] = wcj_get_option( 'wcj_price_by_user_role_cat_empty_price_' . $category . '_' . $user_role, 'no' );
458
+ $price_hash['wcj_user_role'][] = wcj_get_option( 'wcj_price_by_user_role_cat_' . $category . '_' . $user_role, -1 );
459
  }
460
  }
461
  if ( ! empty( $tags ) ) {
462
  foreach ( $tags as $tag ) {
463
+ $price_hash['wcj_user_role'][] = wcj_get_option( 'wcj_price_by_user_role_tag_empty_price_' . $tag . '_' . $user_role, 'no' );
464
+ $price_hash['wcj_user_role'][] = wcj_get_option( 'wcj_price_by_user_role_tag_' . $tag . '_' . $user_role, -1 );
465
  }
466
  }
467
  return $price_hash;
includes/class-wcj-price-formats.php CHANGED
@@ -30,11 +30,11 @@ class WCJ_Price_Formats extends WCJ_Module {
30
 
31
  if ( $this->is_enabled() ) {
32
  // Trim Zeros
33
- if ( 'yes' === get_option( 'wcj_price_formats_general_trim_zeros', 'no' ) ) {
34
  add_filter( 'woocommerce_price_trim_zeros', '__return_true', PHP_INT_MAX );
35
  }
36
  // Price Formats by Currency (or WPML)
37
- if ( 'yes' === get_option( 'wcj_price_formats_by_currency_enabled', 'yes' ) ) {
38
  add_filter( 'wc_price_args', array( $this, 'price_format' ), PHP_INT_MAX );
39
  add_action( 'init', array( $this, 'add_hooks' ), PHP_INT_MAX );
40
  }
@@ -59,15 +59,15 @@ class WCJ_Price_Formats extends WCJ_Module {
59
  * @todo code refactoring
60
  */
61
  function price_decimals( $price_decimals_num ) {
62
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_price_formats_total_number', 1 ) ); $i++ ) {
63
- if ( get_woocommerce_currency() === get_option( 'wcj_price_formats_currency_' . $i ) ) {
64
- if ( defined( 'ICL_LANGUAGE_CODE' ) && '' != ( $wpml_language = get_option( 'wcj_price_formats_wpml_language_' . $i, '' ) ) ) {
65
  $wpml_language = explode( ',', trim( str_replace( ' ', '', $wpml_language ), ',' ) );
66
  if ( ! in_array( ICL_LANGUAGE_CODE, $wpml_language ) ) {
67
  continue;
68
  }
69
  }
70
- $price_decimals_num = get_option( 'wcj_price_formats_number_of_decimals_' . $i );
71
  break;
72
  }
73
  }
@@ -82,20 +82,20 @@ class WCJ_Price_Formats extends WCJ_Module {
82
  */
83
  function price_format( $args ) {
84
  $current_currency = ( '' !== $args['currency'] ? $args['currency'] : get_woocommerce_currency() );
85
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_price_formats_total_number', 1 ) ); $i++ ) {
86
- if ( $current_currency === get_option( 'wcj_price_formats_currency_' . $i ) ) {
87
- if ( defined( 'ICL_LANGUAGE_CODE' ) && '' != ( $wpml_language = get_option( 'wcj_price_formats_wpml_language_' . $i, '' ) ) ) {
88
  $wpml_language = explode( ',', trim( str_replace( ' ', '', $wpml_language ), ',' ) );
89
  if ( ! in_array( ICL_LANGUAGE_CODE, $wpml_language ) ) {
90
  continue;
91
  }
92
  }
93
- $args['price_format'] = $this->get_woocommerce_price_format( get_option( 'wcj_price_formats_currency_position_' . $i ) );
94
  $args['price_format'] = $this->get_woocommerce_price_format_currency_code(
95
- get_option( 'wcj_price_formats_currency_code_position_' . $i, 'none' ), get_option( 'wcj_price_formats_currency_' . $i ), $args['price_format'] );
96
- $args['decimal_separator'] = get_option( 'wcj_price_formats_decimal_separator_' . $i );
97
- $args['thousand_separator'] = get_option( 'wcj_price_formats_thousand_separator_' . $i );
98
- $args['decimals'] = absint( get_option( 'wcj_price_formats_number_of_decimals_' . $i ) );
99
  break;
100
  }
101
  }
30
 
31
  if ( $this->is_enabled() ) {
32
  // Trim Zeros
33
+ if ( 'yes' === wcj_get_option( 'wcj_price_formats_general_trim_zeros', 'no' ) ) {
34
  add_filter( 'woocommerce_price_trim_zeros', '__return_true', PHP_INT_MAX );
35
  }
36
  // Price Formats by Currency (or WPML)
37
+ if ( 'yes' === wcj_get_option( 'wcj_price_formats_by_currency_enabled', 'yes' ) ) {
38
  add_filter( 'wc_price_args', array( $this, 'price_format' ), PHP_INT_MAX );
39
  add_action( 'init', array( $this, 'add_hooks' ), PHP_INT_MAX );
40
  }
59
  * @todo code refactoring
60
  */
61
  function price_decimals( $price_decimals_num ) {
62
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_price_formats_total_number', 1 ) ); $i++ ) {
63
+ if ( get_woocommerce_currency() === wcj_get_option( 'wcj_price_formats_currency_' . $i ) ) {
64
+ if ( defined( 'ICL_LANGUAGE_CODE' ) && '' != ( $wpml_language = wcj_get_option( 'wcj_price_formats_wpml_language_' . $i, '' ) ) ) {
65
  $wpml_language = explode( ',', trim( str_replace( ' ', '', $wpml_language ), ',' ) );
66
  if ( ! in_array( ICL_LANGUAGE_CODE, $wpml_language ) ) {
67
  continue;
68
  }
69
  }
70
+ $price_decimals_num = wcj_get_option( 'wcj_price_formats_number_of_decimals_' . $i );
71
  break;
72
  }
73
  }
82
  */
83
  function price_format( $args ) {
84
  $current_currency = ( '' !== $args['currency'] ? $args['currency'] : get_woocommerce_currency() );
85
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_price_formats_total_number', 1 ) ); $i++ ) {
86
+ if ( $current_currency === wcj_get_option( 'wcj_price_formats_currency_' . $i ) ) {
87
+ if ( defined( 'ICL_LANGUAGE_CODE' ) && '' != ( $wpml_language = wcj_get_option( 'wcj_price_formats_wpml_language_' . $i, '' ) ) ) {
88
  $wpml_language = explode( ',', trim( str_replace( ' ', '', $wpml_language ), ',' ) );
89
  if ( ! in_array( ICL_LANGUAGE_CODE, $wpml_language ) ) {
90
  continue;
91
  }
92
  }
93
+ $args['price_format'] = $this->get_woocommerce_price_format( wcj_get_option( 'wcj_price_formats_currency_position_' . $i ) );
94
  $args['price_format'] = $this->get_woocommerce_price_format_currency_code(
95
+ get_option( 'wcj_price_formats_currency_code_position_' . $i, 'none' ), wcj_get_option( 'wcj_price_formats_currency_' . $i ), $args['price_format'] );
96
+ $args['decimal_separator'] = wcj_get_option( 'wcj_price_formats_decimal_separator_' . $i );
97
+ $args['thousand_separator'] = wcj_get_option( 'wcj_price_formats_thousand_separator_' . $i );
98
+ $args['decimals'] = absint( wcj_get_option( 'wcj_price_formats_number_of_decimals_' . $i ) );
99
  break;
100
  }
101
  }
includes/class-wcj-price-labels.php CHANGED
@@ -50,7 +50,7 @@ class WCJ_Price_Labels extends WCJ_Module {
50
 
51
  if ( $this->is_enabled() ) {
52
 
53
- if ( 'yes' === get_option( 'wcj_local_price_labels_enabled', 'yes' ) ) {
54
  // Meta box (admin)
55
  add_action( 'add_meta_boxes', array( $this, 'add_price_label_meta_box' ) );
56
  add_action( 'save_post_product', array( $this, 'save_custom_price_labels' ), 999, 2 );
@@ -270,16 +270,16 @@ class WCJ_Price_Labels extends WCJ_Module {
270
 
271
  // Global
272
  $do_apply_global = true;
273
- $products_incl = get_option( 'wcj_global_price_labels_products_incl', array() );
274
  if ( ! empty( $products_incl ) ) {
275
  $do_apply_global = ( in_array( $_product_id, $products_incl ) );
276
  }
277
- $products_excl = get_option( 'wcj_global_price_labels_products_excl', array() );
278
  if ( ! empty( $products_excl ) ) {
279
  $do_apply_global = ( ! in_array( $_product_id, $products_excl ) );
280
  }
281
  $product_categories = get_the_terms( $_product_id, 'product_cat' );
282
- $product_categories_incl = get_option( 'wcj_global_price_labels_product_cats_incl', array() );
283
  if ( ! empty( $product_categories_incl ) ) {
284
  $do_apply_global = false;
285
  if ( ! empty( $product_categories ) ) {
@@ -291,7 +291,7 @@ class WCJ_Price_Labels extends WCJ_Module {
291
  }
292
  }
293
  }
294
- $product_categories_excl = get_option( 'wcj_global_price_labels_product_cats_excl', array() );
295
  if ( ! empty( $product_categories_excl ) ) {
296
  $do_apply_global = true;
297
  if ( ! empty( $product_categories ) ) {
@@ -305,7 +305,7 @@ class WCJ_Price_Labels extends WCJ_Module {
305
  }
306
  if ( $do_apply_global ) {
307
  // Check product type
308
- $product_types_incl = get_option( 'wcj_global_price_labels_product_types_incl', '' );
309
  if ( ! empty( $product_types_incl ) ) {
310
  $do_apply_global = false;
311
  foreach ( $product_types_incl as $product_type_incl ) {
@@ -318,43 +318,43 @@ class WCJ_Price_Labels extends WCJ_Module {
318
  }
319
  if ( $do_apply_global ) {
320
  // Global price labels - Add text before price
321
- $text_to_add_before = apply_filters( 'booster_option', '', get_option( 'wcj_global_price_labels_add_before_text' ) );
322
  if ( '' != $text_to_add_before ) {
323
  if ( apply_filters( 'wcj_price_labels_check_on_applying_label', true, $price, $text_to_add_before ) ) {
324
  $price = $text_to_add_before . $price;
325
  }
326
  }
327
  // Global price labels - Add text after price
328
- $text_to_add_after = get_option( 'wcj_global_price_labels_add_after_text' );
329
  if ( '' != $text_to_add_after ) {
330
  if ( apply_filters( 'wcj_price_labels_check_on_applying_label', true, $price, $text_to_add_after ) ) {
331
  $price = $price . $text_to_add_after;
332
  }
333
  }
334
  // Global price labels - Between regular and sale prices
335
- $text_to_add_between_regular_and_sale = get_option( 'wcj_global_price_labels_between_regular_and_sale_text' );
336
  if ( '' != $text_to_add_between_regular_and_sale ) {
337
  $price = apply_filters( 'booster_option', $price, str_replace( '</del> <ins>', '</del>' . $text_to_add_between_regular_and_sale . '<ins>', $price ) );
338
  }
339
  // Global price labels - Remove text from price
340
- $text_to_remove = apply_filters( 'booster_option', '', get_option( 'wcj_global_price_labels_remove_text' ) );
341
  if ( '' != $text_to_remove ) {
342
  $price = str_replace( $text_to_remove, '', $price );
343
  }
344
  // Global price labels - Replace in price
345
- $text_to_replace = apply_filters( 'booster_option', '', get_option( 'wcj_global_price_labels_replace_text' ) );
346
- $text_to_replace_with = apply_filters( 'booster_option', '', get_option( 'wcj_global_price_labels_replace_with_text' ) );
347
  if ( '' != $text_to_replace && '' != $text_to_replace_with ) {
348
  $price = str_replace( $text_to_replace, $text_to_replace_with, $price );
349
  }
350
  // Global price labels - Instead of the price
351
- if ( '' != ( $text_instead = get_option( 'wcj_global_price_labels_instead_text', '' ) ) ) {
352
  $price = $text_instead;
353
  }
354
  }
355
 
356
  // Per product
357
- if ( 'yes' === get_option( 'wcj_local_price_labels_enabled', 'yes' ) ) {
358
  foreach ( $this->custom_tab_sections as $custom_tab_section ) {
359
  $labels_array = array();
360
  foreach ( $this->custom_tab_section_variations as $custom_tab_section_variation ) {
50
 
51
  if ( $this->is_enabled() ) {
52
 
53
+ if ( 'yes' === wcj_get_option( 'wcj_local_price_labels_enabled', 'yes' ) ) {
54
  // Meta box (admin)
55
  add_action( 'add_meta_boxes', array( $this, 'add_price_label_meta_box' ) );
56
  add_action( 'save_post_product', array( $this, 'save_custom_price_labels' ), 999, 2 );
270
 
271
  // Global
272
  $do_apply_global = true;
273
+ $products_incl = wcj_get_option( 'wcj_global_price_labels_products_incl', array() );
274
  if ( ! empty( $products_incl ) ) {
275
  $do_apply_global = ( in_array( $_product_id, $products_incl ) );
276
  }
277
+ $products_excl = wcj_get_option( 'wcj_global_price_labels_products_excl', array() );
278
  if ( ! empty( $products_excl ) ) {
279
  $do_apply_global = ( ! in_array( $_product_id, $products_excl ) );
280
  }
281
  $product_categories = get_the_terms( $_product_id, 'product_cat' );
282
+ $product_categories_incl = wcj_get_option( 'wcj_global_price_labels_product_cats_incl', array() );
283
  if ( ! empty( $product_categories_incl ) ) {
284
  $do_apply_global = false;
285
  if ( ! empty( $product_categories ) ) {
291
  }
292
  }
293
  }
294
+ $product_categories_excl = wcj_get_option( 'wcj_global_price_labels_product_cats_excl', array() );
295
  if ( ! empty( $product_categories_excl ) ) {
296
  $do_apply_global = true;
297
  if ( ! empty( $product_categories ) ) {
305
  }
306
  if ( $do_apply_global ) {
307
  // Check product type
308
+ $product_types_incl = wcj_get_option( 'wcj_global_price_labels_product_types_incl', '' );
309
  if ( ! empty( $product_types_incl ) ) {
310
  $do_apply_global = false;
311
  foreach ( $product_types_incl as $product_type_incl ) {
318
  }
319
  if ( $do_apply_global ) {
320
  // Global price labels - Add text before price
321
+ $text_to_add_before = apply_filters( 'booster_option', '', wcj_get_option( 'wcj_global_price_labels_add_before_text' ) );
322
  if ( '' != $text_to_add_before ) {
323
  if ( apply_filters( 'wcj_price_labels_check_on_applying_label', true, $price, $text_to_add_before ) ) {
324
  $price = $text_to_add_before . $price;
325
  }
326
  }
327
  // Global price labels - Add text after price
328
+ $text_to_add_after = wcj_get_option( 'wcj_global_price_labels_add_after_text' );
329
  if ( '' != $text_to_add_after ) {
330
  if ( apply_filters( 'wcj_price_labels_check_on_applying_label', true, $price, $text_to_add_after ) ) {
331
  $price = $price . $text_to_add_after;
332
  }
333
  }
334
  // Global price labels - Between regular and sale prices
335
+ $text_to_add_between_regular_and_sale = wcj_get_option( 'wcj_global_price_labels_between_regular_and_sale_text' );
336
  if ( '' != $text_to_add_between_regular_and_sale ) {
337
  $price = apply_filters( 'booster_option', $price, str_replace( '</del> <ins>', '</del>' . $text_to_add_between_regular_and_sale . '<ins>', $price ) );
338
  }
339
  // Global price labels - Remove text from price
340
+ $text_to_remove = apply_filters( 'booster_option', '', wcj_get_option( 'wcj_global_price_labels_remove_text' ) );
341
  if ( '' != $text_to_remove ) {
342
  $price = str_replace( $text_to_remove, '', $price );
343
  }
344
  // Global price labels - Replace in price
345
+ $text_to_replace = apply_filters( 'booster_option', '', wcj_get_option( 'wcj_global_price_labels_replace_text' ) );
346
+ $text_to_replace_with = apply_filters( 'booster_option', '', wcj_get_option( 'wcj_global_price_labels_replace_with_text' ) );
347
  if ( '' != $text_to_replace && '' != $text_to_replace_with ) {
348
  $price = str_replace( $text_to_replace, $text_to_replace_with, $price );
349
  }
350
  // Global price labels - Instead of the price
351
+ if ( '' != ( $text_instead = wcj_get_option( 'wcj_global_price_labels_instead_text', '' ) ) ) {
352
  $price = $text_instead;
353
  }
354
  }
355
 
356
  // Per product
357
+ if ( 'yes' === wcj_get_option( 'wcj_local_price_labels_enabled', 'yes' ) ) {
358
  foreach ( $this->custom_tab_sections as $custom_tab_section ) {
359
  $labels_array = array();
360
  foreach ( $this->custom_tab_section_variations as $custom_tab_section_variation ) {
includes/class-wcj-product-add-to-cart.php CHANGED
@@ -47,10 +47,10 @@ class WCJ_Product_Add_To_Cart extends WCJ_Module {
47
 
48
  // Metaboxes
49
  if (
50
- 'yes' === get_option( 'wcj_add_to_cart_button_custom_loop_url_per_product_enabled', 'no' ) ||
51
- 'yes' === get_option( 'wcj_add_to_cart_button_ajax_per_product_enabled', 'no' ) ||
52
- 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_add_to_cart_redirect_per_product_enabled', 'no' ) ) ||
53
- 'per_product' === get_option( 'wcj_add_to_cart_on_visit_enabled', 'no' )
54
  ) {
55
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
56
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
@@ -58,72 +58,72 @@ class WCJ_Product_Add_To_Cart extends WCJ_Module {
58
 
59
  // Customize "Continue shopping" or "View cart" messages
60
  if (
61
- 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_product_add_to_cart_message_continue_shopping_enabled', 'no' ) ) ||
62
- 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_product_add_to_cart_message_view_cart_enabled', 'no' ) )
63
  ) {
64
  add_filter( 'wc_add_to_cart_message_html', array( $this, 'change_add_to_cart_message_html' ), PHP_INT_MAX, 2 );
65
  }
66
 
67
  // Local Redirect
68
- if ( 'yes' === get_option( 'wcj_add_to_cart_redirect_enabled', 'no' ) || 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_add_to_cart_redirect_per_product_enabled', 'no' ) ) ) {
69
  add_filter( 'woocommerce_add_to_cart_redirect', array( $this, 'maybe_redirect_to_url' ), PHP_INT_MAX );
70
  }
71
 
72
  // Add to Cart on Visit
73
- if ( 'no' != get_option( 'wcj_add_to_cart_on_visit_enabled', 'no' ) ) {
74
  add_action( 'wp', array( $this, 'add_to_cart_on_visit' ), 98 );
75
  }
76
 
77
  // Variable Add to Cart Template
78
- if ( 'yes' === apply_filters( 'booster_option', 'wcj', get_option( 'wcj_add_to_cart_variable_as_radio_enabled', 'no' ) ) ) {
79
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_variable_add_to_cart_scripts' ) );
80
  add_action( 'woocommerce_before_variations_form', array( $this, 'add_variations_radio_buttons_template' ) );
81
  }
82
 
83
  // Replace Add to Cart Loop with Single
84
- if ( 'yes' === get_option( 'wcj_add_to_cart_replace_loop_w_single_enabled', 'no' ) ) {
85
  add_action( 'init', array( $this, 'add_to_cart_replace_loop_w_single' ), PHP_INT_MAX );
86
- } elseif ( 'variable_only' === get_option( 'wcj_add_to_cart_replace_loop_w_single_enabled', 'no' ) ) {
87
  add_filter( 'woocommerce_loop_add_to_cart_link', array( $this, 'add_to_cart_variable_replace_loop_w_single' ), PHP_INT_MAX );
88
  }
89
 
90
  // Quantity
91
- if ( 'yes' === get_option( 'wcj_add_to_cart_quantity_disable', 'no' ) || 'yes' === get_option( 'wcj_add_to_cart_quantity_disable_cart', 'no' ) ) {
92
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_disable_quantity_add_to_cart_script' ) );
93
  }
94
  // Quantity - Sold individually
95
- if ( 'yes' === get_option( 'wcj_add_to_cart_quantity_sold_individually_all', 'no' ) ) {
96
  add_filter( 'woocommerce_is_sold_individually', '__return_true', PHP_INT_MAX );
97
  }
98
 
99
  // Button per product Custom URL
100
- if ( 'yes' === get_option( 'wcj_add_to_cart_button_custom_loop_url_per_product_enabled', 'no' ) ) {
101
  add_filter( 'woocommerce_product_add_to_cart_url', array( $this, 'custom_add_to_cart_loop_url' ), PHP_INT_MAX, 2 );
102
  }
103
  // Button per product AJAX
104
- if ( 'yes' === get_option( 'wcj_add_to_cart_button_ajax_per_product_enabled', 'no' ) ) {
105
  add_filter( 'woocommerce_product_supports', array( $this, 'manage_add_to_cart_ajax' ), PHP_INT_MAX, 3 );
106
  }
107
 
108
  // External Products
109
- if ( 'yes' === get_option( 'wcj_add_to_cart_button_external_open_new_window_single', 'no' ) ) {
110
  $start_filter = ( WCJ_IS_WC_VERSION_BELOW_3_4_0 ? 'woocommerce_before_add_to_cart_button' : 'woocommerce_before_add_to_cart_form' );
111
  $end_filter = ( WCJ_IS_WC_VERSION_BELOW_3_4_0 ? 'woocommerce_after_add_to_cart_button' : 'woocommerce_after_add_to_cart_form' );
112
  add_action( $start_filter, array( $this, 'replace_external_with_custom_add_to_cart_on_single_start' ), PHP_INT_MAX );
113
  add_action( $end_filter, array( $this, 'replace_external_with_custom_add_to_cart_on_single_end' ), PHP_INT_MAX );
114
  }
115
- if ( 'yes' === get_option( 'wcj_add_to_cart_button_external_open_new_window_loop', 'no' ) ) {
116
  add_filter( 'woocommerce_loop_add_to_cart_link', array( $this, 'replace_external_with_custom_add_to_cart_in_loop' ), PHP_INT_MAX );
117
  }
118
 
119
  // Reposition Add to Cart button
120
- if ( 'yes' === get_option( 'wcj_product_add_to_cart_button_position_enabled', 'no' ) ) {
121
  // Single product pages
122
- if ( 'yes' === get_option( 'wcj_product_add_to_cart_button_position_single_enabled', 'no' ) ) {
123
  add_action( 'init', array( $this, 'reposition_add_to_cart_button_single' ), PHP_INT_MAX );
124
  }
125
  // Archives
126
- if ( 'yes' === get_option( 'wcj_product_add_to_cart_button_position_loop_enabled', 'no' ) ) {
127
  add_action( 'init', array( $this, 'reposition_add_to_cart_button_loop' ), PHP_INT_MAX );
128
  }
129
  }
@@ -173,10 +173,10 @@ class WCJ_Product_Add_To_Cart extends WCJ_Module {
173
  */
174
  function change_add_to_cart_message_html( $message, $products ) {
175
 
176
- if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) && 'no' === apply_filters( 'booster_option', 'no', get_option( 'wcj_product_add_to_cart_message_continue_shopping_enabled', 'no' ) ) ) {
177
  return $message;
178
  }
179
- if ( 'yes' !== get_option( 'woocommerce_cart_redirect_after_add' ) && 'no' === apply_filters( 'booster_option', 'no', get_option( 'wcj_product_add_to_cart_message_view_cart_enabled', 'no' ) ) ) {
180
  return $message;
181
  }
182
 
@@ -191,11 +191,11 @@ class WCJ_Product_Add_To_Cart extends WCJ_Module {
191
  $titles = array_filter( $titles );
192
  $added_text = sprintf( _n( '%s has been added to your cart.', '%s have been added to your cart.', $count, 'woocommerce' ), wc_format_list_of_items( $titles ) );
193
 
194
- if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) {
195
  $return_to = apply_filters( 'woocommerce_continue_shopping_redirect', wc_get_raw_referer() ? wp_validate_redirect( wc_get_raw_referer(), false ) : wc_get_page_permalink( 'shop' ) );
196
- $message = sprintf( '<a href="%s" class="button wc-forward">%s</a> %s', esc_url( $return_to ), esc_html( get_option( 'wcj_product_add_to_cart_message_continue_shopping_text', __( 'Continue shopping', 'woocommerce' ) ) ), esc_html( $added_text ) );
197
  } else {
198
- $message = sprintf( '<a href="%s" class="button wc-forward">%s</a> %s', esc_url( wc_get_page_permalink( 'cart' ) ), esc_html( get_option( 'wcj_product_add_to_cart_message_view_cart_text', __( 'View cart', 'woocommerce' ) ) ), esc_html( $added_text ) );
199
  }
200
 
201
  return $message;
@@ -309,8 +309,8 @@ class WCJ_Product_Add_To_Cart extends WCJ_Module {
309
  */
310
  function enqueue_disable_quantity_add_to_cart_script() {
311
  if (
312
- ( 'yes' === get_option( 'wcj_add_to_cart_quantity_disable', 'no' ) && is_product() ) ||
313
- ( 'yes' === get_option( 'wcj_add_to_cart_quantity_disable_cart', 'no' ) && is_cart() )
314
  ) {
315
  wp_enqueue_script( 'wcj-disable-quantity', wcj_plugin_url() . '/includes/js/wcj-disable-quantity.js', array( 'jquery' ) );
316
  }
@@ -353,7 +353,7 @@ class WCJ_Product_Add_To_Cart extends WCJ_Module {
353
  * @version 3.4.0
354
  */
355
  function maybe_redirect_to_url( $url, $product_id = false ) {
356
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_add_to_cart_redirect_per_product_enabled', 'no' ) ) && ( $product_id || isset( $_REQUEST['add-to-cart'] ) ) ) {
357
  if ( ! $product_id ) {
358
  $product_id = apply_filters( 'woocommerce_add_to_cart_product_id', absint( $_REQUEST['add-to-cart'] ) );
359
  }
@@ -365,8 +365,8 @@ class WCJ_Product_Add_To_Cart extends WCJ_Module {
365
  return $redirect_url;
366
  }
367
  }
368
- if ( 'yes' === get_option( 'wcj_add_to_cart_redirect_enabled', 'no' ) ) {
369
- $redirect_url = get_option( 'wcj_add_to_cart_redirect_url', '' );
370
  if ( '' === $redirect_url ) {
371
  $redirect_url = wc_get_checkout_url();
372
  }
@@ -384,7 +384,7 @@ class WCJ_Product_Add_To_Cart extends WCJ_Module {
384
  function add_to_cart_on_visit() {
385
  if ( ! is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) && is_product() && ( $product_id = get_the_ID() ) ) {
386
  // If "per product" is selected - check product's settings (i.e. meta)
387
- if ( 'per_product' === get_option( 'wcj_add_to_cart_on_visit_enabled', 'no' ) ) {
388
  if ( 'yes' !== get_post_meta( $product_id, '_' . 'wcj_add_to_cart_on_visit_enabled', true ) ) {
389
  return;
390
  }
@@ -407,8 +407,8 @@ class WCJ_Product_Add_To_Cart extends WCJ_Module {
407
  }
408
  // Maybe perform add to cart redirect
409
  if ( false !== $was_added_to_cart && (
410
- 'yes' === get_option( 'wcj_add_to_cart_redirect_enabled', 'no' ) ||
411
- 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_add_to_cart_redirect_per_product_enabled', 'no' ) )
412
  ) ) {
413
  if ( $redirect_url = $this->maybe_redirect_to_url( false, $product_id ) ) {
414
  if ( wp_safe_redirect( $redirect_url ) ) {
47
 
48
  // Metaboxes
49
  if (
50
+ 'yes' === wcj_get_option( 'wcj_add_to_cart_button_custom_loop_url_per_product_enabled', 'no' ) ||
51
+ 'yes' === wcj_get_option( 'wcj_add_to_cart_button_ajax_per_product_enabled', 'no' ) ||
52
+ 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_add_to_cart_redirect_per_product_enabled', 'no' ) ) ||
53
+ 'per_product' === wcj_get_option( 'wcj_add_to_cart_on_visit_enabled', 'no' )
54
  ) {
55
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
56
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
58
 
59
  // Customize "Continue shopping" or "View cart" messages
60
  if (
61
+ 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_product_add_to_cart_message_continue_shopping_enabled', 'no' ) ) ||
62
+ 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_product_add_to_cart_message_view_cart_enabled', 'no' ) )
63
  ) {
64
  add_filter( 'wc_add_to_cart_message_html', array( $this, 'change_add_to_cart_message_html' ), PHP_INT_MAX, 2 );
65
  }
66
 
67
  // Local Redirect
68
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_redirect_enabled', 'no' ) || 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_add_to_cart_redirect_per_product_enabled', 'no' ) ) ) {
69
  add_filter( 'woocommerce_add_to_cart_redirect', array( $this, 'maybe_redirect_to_url' ), PHP_INT_MAX );
70
  }
71
 
72
  // Add to Cart on Visit
73
+ if ( 'no' != wcj_get_option( 'wcj_add_to_cart_on_visit_enabled', 'no' ) ) {
74
  add_action( 'wp', array( $this, 'add_to_cart_on_visit' ), 98 );
75
  }
76
 
77
  // Variable Add to Cart Template
78
+ if ( 'yes' === apply_filters( 'booster_option', 'wcj', wcj_get_option( 'wcj_add_to_cart_variable_as_radio_enabled', 'no' ) ) ) {
79
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_variable_add_to_cart_scripts' ) );
80
  add_action( 'woocommerce_before_variations_form', array( $this, 'add_variations_radio_buttons_template' ) );
81
  }
82
 
83
  // Replace Add to Cart Loop with Single
84
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_replace_loop_w_single_enabled', 'no' ) ) {
85
  add_action( 'init', array( $this, 'add_to_cart_replace_loop_w_single' ), PHP_INT_MAX );
86
+ } elseif ( 'variable_only' === wcj_get_option( 'wcj_add_to_cart_replace_loop_w_single_enabled', 'no' ) ) {
87
  add_filter( 'woocommerce_loop_add_to_cart_link', array( $this, 'add_to_cart_variable_replace_loop_w_single' ), PHP_INT_MAX );
88
  }
89
 
90
  // Quantity
91
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_quantity_disable', 'no' ) || 'yes' === wcj_get_option( 'wcj_add_to_cart_quantity_disable_cart', 'no' ) ) {
92
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_disable_quantity_add_to_cart_script' ) );
93
  }
94
  // Quantity - Sold individually
95
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_quantity_sold_individually_all', 'no' ) ) {
96
  add_filter( 'woocommerce_is_sold_individually', '__return_true', PHP_INT_MAX );
97
  }
98
 
99
  // Button per product Custom URL
100
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_button_custom_loop_url_per_product_enabled', 'no' ) ) {
101
  add_filter( 'woocommerce_product_add_to_cart_url', array( $this, 'custom_add_to_cart_loop_url' ), PHP_INT_MAX, 2 );
102
  }
103
  // Button per product AJAX
104
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_button_ajax_per_product_enabled', 'no' ) ) {
105
  add_filter( 'woocommerce_product_supports', array( $this, 'manage_add_to_cart_ajax' ), PHP_INT_MAX, 3 );
106
  }
107
 
108
  // External Products
109
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_button_external_open_new_window_single', 'no' ) ) {
110
  $start_filter = ( WCJ_IS_WC_VERSION_BELOW_3_4_0 ? 'woocommerce_before_add_to_cart_button' : 'woocommerce_before_add_to_cart_form' );
111
  $end_filter = ( WCJ_IS_WC_VERSION_BELOW_3_4_0 ? 'woocommerce_after_add_to_cart_button' : 'woocommerce_after_add_to_cart_form' );
112
  add_action( $start_filter, array( $this, 'replace_external_with_custom_add_to_cart_on_single_start' ), PHP_INT_MAX );
113
  add_action( $end_filter, array( $this, 'replace_external_with_custom_add_to_cart_on_single_end' ), PHP_INT_MAX );
114
  }
115
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_button_external_open_new_window_loop', 'no' ) ) {
116
  add_filter( 'woocommerce_loop_add_to_cart_link', array( $this, 'replace_external_with_custom_add_to_cart_in_loop' ), PHP_INT_MAX );
117
  }
118
 
119
  // Reposition Add to Cart button
120
+ if ( 'yes' === wcj_get_option( 'wcj_product_add_to_cart_button_position_enabled', 'no' ) ) {
121
  // Single product pages
122
+ if ( 'yes' === wcj_get_option( 'wcj_product_add_to_cart_button_position_single_enabled', 'no' ) ) {
123
  add_action( 'init', array( $this, 'reposition_add_to_cart_button_single' ), PHP_INT_MAX );
124
  }
125
  // Archives
126
+ if ( 'yes' === wcj_get_option( 'wcj_product_add_to_cart_button_position_loop_enabled', 'no' ) ) {
127
  add_action( 'init', array( $this, 'reposition_add_to_cart_button_loop' ), PHP_INT_MAX );
128
  }
129
  }
173
  */
174
  function change_add_to_cart_message_html( $message, $products ) {
175
 
176
+ if ( 'yes' === wcj_get_option( 'woocommerce_cart_redirect_after_add' ) && 'no' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_product_add_to_cart_message_continue_shopping_enabled', 'no' ) ) ) {
177
  return $message;
178
  }
179
+ if ( 'yes' !== wcj_get_option( 'woocommerce_cart_redirect_after_add' ) && 'no' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_product_add_to_cart_message_view_cart_enabled', 'no' ) ) ) {
180
  return $message;
181
  }
182
 
191
  $titles = array_filter( $titles );
192
  $added_text = sprintf( _n( '%s has been added to your cart.', '%s have been added to your cart.', $count, 'woocommerce' ), wc_format_list_of_items( $titles ) );
193
 
194
+ if ( 'yes' === wcj_get_option( 'woocommerce_cart_redirect_after_add' ) ) {
195
  $return_to = apply_filters( 'woocommerce_continue_shopping_redirect', wc_get_raw_referer() ? wp_validate_redirect( wc_get_raw_referer(), false ) : wc_get_page_permalink( 'shop' ) );
196
+ $message = sprintf( '<a href="%s" class="button wc-forward">%s</a> %s', esc_url( $return_to ), esc_html( wcj_get_option( 'wcj_product_add_to_cart_message_continue_shopping_text', __( 'Continue shopping', 'woocommerce' ) ) ), esc_html( $added_text ) );
197
  } else {
198
+ $message = sprintf( '<a href="%s" class="button wc-forward">%s</a> %s', esc_url( wc_get_page_permalink( 'cart' ) ), esc_html( wcj_get_option( 'wcj_product_add_to_cart_message_view_cart_text', __( 'View cart', 'woocommerce' ) ) ), esc_html( $added_text ) );
199
  }
200
 
201
  return $message;
309
  */
310
  function enqueue_disable_quantity_add_to_cart_script() {
311
  if (
312
+ ( 'yes' === wcj_get_option( 'wcj_add_to_cart_quantity_disable', 'no' ) && is_product() ) ||
313
+ ( 'yes' === wcj_get_option( 'wcj_add_to_cart_quantity_disable_cart', 'no' ) && is_cart() )
314
  ) {
315
  wp_enqueue_script( 'wcj-disable-quantity', wcj_plugin_url() . '/includes/js/wcj-disable-quantity.js', array( 'jquery' ) );
316
  }
353
  * @version 3.4.0
354
  */
355
  function maybe_redirect_to_url( $url, $product_id = false ) {
356
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_add_to_cart_redirect_per_product_enabled', 'no' ) ) && ( $product_id || isset( $_REQUEST['add-to-cart'] ) ) ) {
357
  if ( ! $product_id ) {
358
  $product_id = apply_filters( 'woocommerce_add_to_cart_product_id', absint( $_REQUEST['add-to-cart'] ) );
359
  }
365
  return $redirect_url;
366
  }
367
  }
368
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_redirect_enabled', 'no' ) ) {
369
+ $redirect_url = wcj_get_option( 'wcj_add_to_cart_redirect_url', '' );
370
  if ( '' === $redirect_url ) {
371
  $redirect_url = wc_get_checkout_url();
372
  }
384
  function add_to_cart_on_visit() {
385
  if ( ! is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) && is_product() && ( $product_id = get_the_ID() ) ) {
386
  // If "per product" is selected - check product's settings (i.e. meta)
387
+ if ( 'per_product' === wcj_get_option( 'wcj_add_to_cart_on_visit_enabled', 'no' ) ) {
388
  if ( 'yes' !== get_post_meta( $product_id, '_' . 'wcj_add_to_cart_on_visit_enabled', true ) ) {
389
  return;
390
  }
407
  }
408
  // Maybe perform add to cart redirect
409
  if ( false !== $was_added_to_cart && (
410
+ 'yes' === wcj_get_option( 'wcj_add_to_cart_redirect_enabled', 'no' ) ||
411
+ 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_add_to_cart_redirect_per_product_enabled', 'no' ) )
412
  ) ) {
413
  if ( $redirect_url = $this->maybe_redirect_to_url( false, $product_id ) ) {
414
  if ( wp_safe_redirect( $redirect_url ) ) {
includes/class-wcj-product-addons.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Module - Product Addons
4
  *
5
- * @version 5.2.0
6
  * @since 2.5.3
7
  * @author Pluggabl LLC.
8
  * @todo admin order view (names)
@@ -35,7 +35,7 @@ class WCJ_Product_Addons extends WCJ_Module {
35
  parent::__construct();
36
 
37
  if ( $this->is_enabled() ) {
38
- if ( 'yes' === get_option( 'wcj_product_addons_per_product_enabled', 'no' ) ) {
39
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
40
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
41
  add_filter( 'wcj_save_meta_box_value', array( $this, 'save_meta_box_value' ), PHP_INT_MAX, 3 );
@@ -43,15 +43,15 @@ class WCJ_Product_Addons extends WCJ_Module {
43
  $this->co = 'wcj_product_addons_per_product_settings_enabled';
44
  }
45
  if ( wcj_is_frontend() ) {
46
- if ( 'yes' === get_option( 'wcj_product_addons_ajax_enabled', 'no' ) ) {
47
  // Scripts
48
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
49
  add_action( 'wp_ajax_product_addons_price_change', array( $this, 'price_change_ajax' ) );
50
  add_action( 'wp_ajax_nopriv_product_addons_price_change', array( $this, 'price_change_ajax' ) );
51
  }
52
  // Single Page
53
- $position = get_option( 'wcj_product_addons_position', 'woocommerce_before_add_to_cart_button' );
54
- $priority = get_option( 'wcj_product_addons_position_priority', 0 );
55
  add_action( $position, array( $this, 'add_addons_to_frontend' ), ( 0 == $priority ? PHP_INT_MAX : $priority ) );
56
  // Add to cart
57
  add_filter( 'woocommerce_add_cart_item_data', array( $this, 'add_addons_price_to_cart_item_data' ), PHP_INT_MAX, 3 );
@@ -71,14 +71,14 @@ class WCJ_Product_Addons extends WCJ_Module {
71
  }
72
  }
73
  if ( is_admin() ) {
74
- if ( 'yes' === get_option( 'wcj_product_addons_hide_on_admin_order_page', 'no' ) ) {
75
  add_filter( 'woocommerce_hidden_order_itemmeta', array( $this, 'hide_addons_in_admin_order' ), PHP_INT_MAX );
76
  }
77
  // Format meta on admin order
78
  add_filter( 'woocommerce_order_item_get_formatted_meta_data', array( $this, 'format_meta_data' ), 20, 2 );
79
  }
80
  // Addons quantity
81
- $qty_triggers = get_option( 'wcj_product_addons_qty_decrease_triggers', '' );
82
  if ( ! empty( $qty_triggers ) ) {
83
  if ( in_array( 'woocommerce_new_order', $qty_triggers ) ) {
84
  $qty_triggers = array_merge( $qty_triggers, array(
@@ -112,7 +112,7 @@ class WCJ_Product_Addons extends WCJ_Module {
112
  */
113
  function import_enable_by_variation_meta( $data, $raw_data ) {
114
  if (
115
- 'no' === get_option( 'wcj_product_addons_enable_by_variation_export_import', 'no' ) ||
116
  ! isset( $data['meta_data'] ) ||
117
  empty( $data['meta_data'] )
118
  ) {
@@ -144,7 +144,7 @@ class WCJ_Product_Addons extends WCJ_Module {
144
  */
145
  function export_enable_by_variation_meta( $value, $meta, $product, $row ) {
146
  if (
147
- 'no' === get_option( 'wcj_product_addons_enable_by_variation_export_import', 'no' ) ||
148
  false === strpos( $meta->get_data()['key'], '_wcj_product_addons_per_product_enable_by_variation_' )
149
  ) {
150
  return $value;
@@ -213,7 +213,7 @@ class WCJ_Product_Addons extends WCJ_Module {
213
  if ( $global_addon_key === substr( $meta['key'], 0, $global_addon_key_length ) ) {
214
  $i = substr( $meta['key'], $global_addon_key_length );
215
  $qty_key = 'wcj_product_addons_all_products_qty_' . $i;
216
- $old_qty = get_option( $qty_key, '' );
217
  if ( '' !== $old_qty ) {
218
  $new_qty = $old_qty - $product_qty;
219
  update_option( $qty_key, $new_qty );
@@ -297,20 +297,20 @@ class WCJ_Product_Addons extends WCJ_Module {
297
  /**
298
  * maybe_convert_currency.
299
  *
300
- * @version 3.9.0
301
  * @since 2.8.0
302
  */
303
  function maybe_convert_currency( $price, $product = null ) {
304
- $apply_price_filters = get_option( 'wcj_product_addons_apply_price_filters', 'by_module' );
305
  if ( 'by_module' === $apply_price_filters ) {
306
- $modules_to_apply = get_option( 'wcj_product_addons_apply_price_filters_by_module', array() );
307
  // Multicurrency Product Base Price module
308
  if ( ( empty( $modules_to_apply ) || in_array( 'multicurrency_base_price', $modules_to_apply ) ) && WCJ()->modules['multicurrency_base_price']->is_enabled() ) {
309
  $price = WCJ()->modules['multicurrency_base_price']->change_price( $price, $product );
310
  }
311
  // Multicurrency (Currency Switcher) module
312
  if ( ( empty( $modules_to_apply ) || in_array( 'multicurrency', $modules_to_apply ) ) && WCJ()->modules['multicurrency']->is_enabled() ) {
313
- $price = WCJ()->modules['multicurrency']->change_price( $price, null );
314
  }
315
  // Global Discount module
316
  if ( ( empty( $modules_to_apply ) || in_array( 'global_discount', $modules_to_apply ) ) && WCJ()->modules['global_discount']->is_enabled() ) {
@@ -394,7 +394,7 @@ class WCJ_Product_Addons extends WCJ_Module {
394
  'enable_by_variation' => $enable_by_variation,
395
  'ajax_url' => admin_url( 'admin-ajax.php' ),
396
  'product_id' => get_the_ID(),
397
- 'ignore_strikethrough_price' => get_option( 'wcj_product_addons_ajax_ignore_st_price', 'no' ),
398
  'is_variable_with_single_price' => $is_variable_with_single_price,
399
  ) );
400
  }
@@ -410,7 +410,7 @@ class WCJ_Product_Addons extends WCJ_Module {
410
  * @todo add "include/exclude categories/tags"
411
  */
412
  function is_global_addon_visible( $i, $product_id ) {
413
- $exclude_products = get_option( 'wcj_product_addons_all_products_exclude_products_' . $i, '' );
414
  if ( ! empty( $exclude_products ) && in_array( $product_id, $exclude_products ) ) {
415
  return false;
416
  }
@@ -427,14 +427,14 @@ class WCJ_Product_Addons extends WCJ_Module {
427
  function get_product_addons( $product_id ) {
428
  $addons = array();
429
  // All Products
430
- if ( 'yes' === get_option( 'wcj_product_addons_all_products_enabled', 'no' ) ) {
431
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_product_addons_all_products_total_number', 1 ) );
432
  for ( $i = 1; $i <= $total_number; $i++ ) {
433
- if ( 'yes' === get_option( 'wcj_product_addons_all_products_enabled_' . $i, 'yes' ) ) {
434
  if ( ! $this->is_global_addon_visible( $i, $product_id ) ) {
435
  continue;
436
  }
437
- if ( '0' === ( $qty = get_option( 'wcj_product_addons_all_products_qty_' . $i, '' ) ) || $qty < 0 ) {
438
  continue;
439
  }
440
  $addons[] = array(
@@ -444,22 +444,22 @@ class WCJ_Product_Addons extends WCJ_Module {
444
  'checkbox_key' => 'wcj_product_all_products_addons_' . $i,
445
  'price_key' => 'wcj_product_all_products_addons_price_' . $i,
446
  'label_key' => 'wcj_product_all_products_addons_label_' . $i,
447
- 'price_value' => get_option( 'wcj_product_addons_all_products_price_' . $i ),
448
- 'label_value' => do_shortcode( get_option( 'wcj_product_addons_all_products_label_' . $i ) ),
449
- 'title' => do_shortcode( get_option( 'wcj_product_addons_all_products_title_' . $i, '' ) ),
450
- 'placeholder' => do_shortcode( get_option( 'wcj_product_addons_all_products_placeholder_' . $i, '' ) ),
451
- 'class' => get_option( 'wcj_product_addons_all_products_class_' . $i, '' ),
452
- 'tooltip' => do_shortcode( get_option( 'wcj_product_addons_all_products_tooltip_' . $i, '' ) ),
453
- 'type' => get_option( 'wcj_product_addons_all_products_type_' . $i, 'checkbox' ),
454
- 'default' => get_option( 'wcj_product_addons_all_products_default_' . $i, '' ),
455
- 'is_required' => get_option( 'wcj_product_addons_all_products_required_' . $i, 'no' ),
456
  'qty' => $qty,
457
  );
458
  }
459
  }
460
  }
461
  // Per product
462
- if ( 'yes' === get_option( 'wcj_product_addons_per_product_enabled', 'no' ) ) {
463
  if ( 'yes' === get_post_meta( $product_id, '_' . 'wcj_product_addons_per_product_settings_enabled', true ) ) {
464
  $total_number = get_post_meta( $product_id, '_' . 'wcj_product_addons_per_product_total_number', true );
465
  for ( $i = 1; $i <= $total_number; $i++ ) {
@@ -558,13 +558,13 @@ class WCJ_Product_Addons extends WCJ_Module {
558
  */
559
  function add_info_to_order_item_name( $name, $item, $is_cart = false ) {
560
  if ( $is_cart ) {
561
- $start_format = get_option( 'wcj_product_addons_cart_format_start', '<dl class="variation">' );
562
- $item_format = get_option( 'wcj_product_addons_cart_format_each_addon', '<dt>%addon_label%:</dt><dd>%addon_price%</dd>' );
563
- $end_format = get_option( 'wcj_product_addons_cart_format_end', '</dl>' );
564
  } else {
565
- $start_format = get_option( 'wcj_product_addons_order_details_format_start', '' );
566
- $item_format = get_option( 'wcj_product_addons_order_details_format_each_addon', '&nbsp;| %addon_label%: %addon_price%' );
567
- $end_format = get_option( 'wcj_product_addons_order_details_format_end', '' );
568
  }
569
  $addons_info = '';
570
  $addons = $this->get_product_addons( $item['product_id'] );
@@ -701,7 +701,7 @@ class WCJ_Product_Addons extends WCJ_Module {
701
  * @since 2.5.3
702
  */
703
  function add_addons_to_frontend() {
704
- if ( isset( $this->are_addons_displayed ) && 'yes' === get_option( 'wcj_product_addons_check_for_outputted_data', 'yes' ) ) {
705
  return;
706
  }
707
  $html = '';
@@ -712,7 +712,7 @@ class WCJ_Product_Addons extends WCJ_Module {
712
  $html .= wcj_handle_replacements( array(
713
  '%addon_id%' => $addon['checkbox_key'],
714
  '%addon_title%' => $addon['title'],
715
- ), get_option( 'wcj_product_addons_template_title', '<p><label for="%addon_id%">%addon_title%</label></p>' ) );
716
  }
717
  $is_required = ( 'yes' === $addon['is_required'] ) ? ' required' : '';
718
  if ( 'checkbox' === $addon['type'] || '' == $addon['type'] ) {
@@ -731,7 +731,7 @@ class WCJ_Product_Addons extends WCJ_Module {
731
  '%addon_label%' => $addon['label_value'],
732
  '%addon_price%' => $this->format_addon_price( $addon['price_value'], $_product ),
733
  '%addon_tooltip%' => $maybe_tooltip,
734
- ), get_option( 'wcj_product_addons_template_type_checkbox',
735
  '<p>%addon_input% <label for="%addon_id%">%addon_label% (%addon_price%)</label>%addon_tooltip%</p>' ) );
736
  } elseif ( 'text' == $addon['type'] ) {
737
  $default_value = ( isset( $_POST[ $addon['checkbox_key'] ] ) ? $_POST[ $addon['checkbox_key'] ] : $addon['default'] );
@@ -744,7 +744,7 @@ class WCJ_Product_Addons extends WCJ_Module {
744
  '%addon_label%' => $addon['label_value'],
745
  '%addon_price%' => $this->format_addon_price( $addon['price_value'], $_product ),
746
  '%addon_tooltip%' => $maybe_tooltip,
747
- ), get_option( 'wcj_product_addons_template_type_text',
748
  '<p><label for="%addon_id%">%addon_label% (%addon_price%)</label> %addon_input%%addon_tooltip%</p>' ) );
749
  } elseif ( 'radio' === $addon['type'] || 'select' === $addon['type'] ) {
750
  $prices = $this->clean_and_explode( PHP_EOL, $addon['price_value'] );
@@ -775,13 +775,13 @@ class WCJ_Product_Addons extends WCJ_Module {
775
  '%addon_label%' => $labels[ $i ],
776
  '%addon_price%' => $this->format_addon_price( $prices[ $i ], $_product ),
777
  '%addon_tooltip%' => $maybe_tooltip,
778
- ), get_option( 'wcj_product_addons_template_type_radio',
779
  '<p>%addon_input% <label for="%addon_id%">%addon_label% (%addon_price%)</label>%addon_tooltip%</p>' ) );
780
  } else {
781
  $select_option = wcj_handle_replacements( array(
782
  '%addon_label%' => $labels[ $i ],
783
  '%addon_price%' => $this->format_addon_price( $prices[ $i ], $_product ),
784
- ), get_option( 'wcj_product_addons_template_type_select_option', '%addon_label% (%addon_price%)' ) );
785
  $select_options .= '<option value="' . $label . '"' . $is_checked . '>' . $select_option . '</option>';
786
  }
787
  }
@@ -795,7 +795,7 @@ class WCJ_Product_Addons extends WCJ_Module {
795
  $html .= wcj_handle_replacements( array(
796
  '%addon_input%' => '<select' . $is_required . ' id="' . $addon['checkbox_key'] . '" class="' . $addon['class'] . '" name="' . $addon['checkbox_key'] . '">' . $select_options . '</select>',
797
  '%addon_tooltip%' => $maybe_tooltip,
798
- ), get_option( 'wcj_product_addons_template_type_select', '<p>%addon_input%%addon_tooltip%</p>' ) );
799
  }
800
  }
801
  }
@@ -804,7 +804,7 @@ class WCJ_Product_Addons extends WCJ_Module {
804
  if ( ! empty( $html ) ) {
805
  $html = wcj_handle_replacements( array(
806
  '%addons_html%' => $html,
807
- ), get_option( 'wcj_product_addons_template_final', '<div id="wcj_product_addons">%addons_html%</div>' ) );
808
  echo $this->remove_empty_parenthesis($html);
809
  $this->are_addons_displayed = true;
810
  }
@@ -845,7 +845,7 @@ class WCJ_Product_Addons extends WCJ_Module {
845
  }
846
  }
847
  if ( $show_raw_price ) {
848
- if ( 'yes' === get_option( 'wcj_product_addons_template_hide_percentage_price', 'yes' ) ) {
849
  return '';
850
  } else {
851
  return $price;
2
  /**
3
  * Booster for WooCommerce - Module - Product Addons
4
  *
5
+ * @version 5.3.3
6
  * @since 2.5.3
7
  * @author Pluggabl LLC.
8
  * @todo admin order view (names)
35
  parent::__construct();
36
 
37
  if ( $this->is_enabled() ) {
38
+ if ( 'yes' === wcj_get_option( 'wcj_product_addons_per_product_enabled', 'no' ) ) {
39
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
40
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
41
  add_filter( 'wcj_save_meta_box_value', array( $this, 'save_meta_box_value' ), PHP_INT_MAX, 3 );
43
  $this->co = 'wcj_product_addons_per_product_settings_enabled';
44
  }
45
  if ( wcj_is_frontend() ) {
46
+ if ( 'yes' === wcj_get_option( 'wcj_product_addons_ajax_enabled', 'no' ) ) {
47
  // Scripts
48
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
49
  add_action( 'wp_ajax_product_addons_price_change', array( $this, 'price_change_ajax' ) );
50
  add_action( 'wp_ajax_nopriv_product_addons_price_change', array( $this, 'price_change_ajax' ) );
51
  }
52
  // Single Page
53
+ $position = wcj_get_option( 'wcj_product_addons_position', 'woocommerce_before_add_to_cart_button' );
54
+ $priority = wcj_get_option( 'wcj_product_addons_position_priority', 0 );
55
  add_action( $position, array( $this, 'add_addons_to_frontend' ), ( 0 == $priority ? PHP_INT_MAX : $priority ) );
56
  // Add to cart
57
  add_filter( 'woocommerce_add_cart_item_data', array( $this, 'add_addons_price_to_cart_item_data' ), PHP_INT_MAX, 3 );
71
  }
72
  }
73
  if ( is_admin() ) {
74
+ if ( 'yes' === wcj_get_option( 'wcj_product_addons_hide_on_admin_order_page', 'no' ) ) {
75
  add_filter( 'woocommerce_hidden_order_itemmeta', array( $this, 'hide_addons_in_admin_order' ), PHP_INT_MAX );
76
  }
77
  // Format meta on admin order
78
  add_filter( 'woocommerce_order_item_get_formatted_meta_data', array( $this, 'format_meta_data' ), 20, 2 );
79
  }
80
  // Addons quantity
81
+ $qty_triggers = wcj_get_option( 'wcj_product_addons_qty_decrease_triggers', '' );
82
  if ( ! empty( $qty_triggers ) ) {
83
  if ( in_array( 'woocommerce_new_order', $qty_triggers ) ) {
84
  $qty_triggers = array_merge( $qty_triggers, array(
112
  */
113
  function import_enable_by_variation_meta( $data, $raw_data ) {
114
  if (
115
+ 'no' === wcj_get_option( 'wcj_product_addons_enable_by_variation_export_import', 'no' ) ||
116
  ! isset( $data['meta_data'] ) ||
117
  empty( $data['meta_data'] )
118
  ) {
144
  */
145
  function export_enable_by_variation_meta( $value, $meta, $product, $row ) {
146
  if (
147
+ 'no' === wcj_get_option( 'wcj_product_addons_enable_by_variation_export_import', 'no' ) ||
148
  false === strpos( $meta->get_data()['key'], '_wcj_product_addons_per_product_enable_by_variation_' )
149
  ) {
150
  return $value;
213
  if ( $global_addon_key === substr( $meta['key'], 0, $global_addon_key_length ) ) {
214
  $i = substr( $meta['key'], $global_addon_key_length );
215
  $qty_key = 'wcj_product_addons_all_products_qty_' . $i;
216
+ $old_qty = wcj_get_option( $qty_key, '' );
217
  if ( '' !== $old_qty ) {
218
  $new_qty = $old_qty - $product_qty;
219
  update_option( $qty_key, $new_qty );
297
  /**
298
  * maybe_convert_currency.
299
  *
300
+ * @version 5.3.3
301
  * @since 2.8.0
302
  */
303
  function maybe_convert_currency( $price, $product = null ) {
304
+ $apply_price_filters = wcj_get_option( 'wcj_product_addons_apply_price_filters', 'by_module' );
305
  if ( 'by_module' === $apply_price_filters ) {
306
+ $modules_to_apply = wcj_get_option( 'wcj_product_addons_apply_price_filters_by_module', array() );
307
  // Multicurrency Product Base Price module
308
  if ( ( empty( $modules_to_apply ) || in_array( 'multicurrency_base_price', $modules_to_apply ) ) && WCJ()->modules['multicurrency_base_price']->is_enabled() ) {
309
  $price = WCJ()->modules['multicurrency_base_price']->change_price( $price, $product );
310
  }
311
  // Multicurrency (Currency Switcher) module
312
  if ( ( empty( $modules_to_apply ) || in_array( 'multicurrency', $modules_to_apply ) ) && WCJ()->modules['multicurrency']->is_enabled() ) {
313
+ $price = WCJ()->modules['multicurrency']->change_price( $price, $product, array( 'do_save' => false ) );
314
  }
315
  // Global Discount module
316
  if ( ( empty( $modules_to_apply ) || in_array( 'global_discount', $modules_to_apply ) ) && WCJ()->modules['global_discount']->is_enabled() ) {
394
  'enable_by_variation' => $enable_by_variation,
395
  'ajax_url' => admin_url( 'admin-ajax.php' ),
396
  'product_id' => get_the_ID(),
397
+ 'ignore_strikethrough_price' => wcj_get_option( 'wcj_product_addons_ajax_ignore_st_price', 'no' ),
398
  'is_variable_with_single_price' => $is_variable_with_single_price,
399
  ) );
400
  }
410
  * @todo add "include/exclude categories/tags"
411
  */
412
  function is_global_addon_visible( $i, $product_id ) {
413
+ $exclude_products = wcj_get_option( 'wcj_product_addons_all_products_exclude_products_' . $i, '' );
414
  if ( ! empty( $exclude_products ) && in_array( $product_id, $exclude_products ) ) {
415
  return false;
416
  }
427
  function get_product_addons( $product_id ) {
428
  $addons = array();
429
  // All Products
430
+ if ( 'yes' === wcj_get_option( 'wcj_product_addons_all_products_enabled', 'no' ) ) {
431
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_product_addons_all_products_total_number', 1 ) );
432
  for ( $i = 1; $i <= $total_number; $i++ ) {
433
+ if ( 'yes' === wcj_get_option( 'wcj_product_addons_all_products_enabled_' . $i, 'yes' ) ) {
434
  if ( ! $this->is_global_addon_visible( $i, $product_id ) ) {
435
  continue;
436
  }
437
+ if ( '0' === ( $qty = wcj_get_option( 'wcj_product_addons_all_products_qty_' . $i, '' ) ) || $qty < 0 ) {
438
  continue;
439
  }
440
  $addons[] = array(
444
  'checkbox_key' => 'wcj_product_all_products_addons_' . $i,
445
  'price_key' => 'wcj_product_all_products_addons_price_' . $i,
446
  'label_key' => 'wcj_product_all_products_addons_label_' . $i,
447
+ 'price_value' => wcj_get_option( 'wcj_product_addons_all_products_price_' . $i ),
448
+ 'label_value' => do_shortcode( wcj_get_option( 'wcj_product_addons_all_products_label_' . $i ) ),
449
+ 'title' => do_shortcode( wcj_get_option( 'wcj_product_addons_all_products_title_' . $i, '' ) ),
450
+ 'placeholder' => do_shortcode( wcj_get_option( 'wcj_product_addons_all_products_placeholder_' . $i, '' ) ),
451
+ 'class' => wcj_get_option( 'wcj_product_addons_all_products_class_' . $i, '' ),
452
+ 'tooltip' => do_shortcode( wcj_get_option( 'wcj_product_addons_all_products_tooltip_' . $i, '' ) ),
453
+ 'type' => wcj_get_option( 'wcj_product_addons_all_products_type_' . $i, 'checkbox' ),
454
+ 'default' => wcj_get_option( 'wcj_product_addons_all_products_default_' . $i, '' ),
455
+ 'is_required' => wcj_get_option( 'wcj_product_addons_all_products_required_' . $i, 'no' ),
456
  'qty' => $qty,
457
  );
458
  }
459
  }
460
  }
461
  // Per product
462
+ if ( 'yes' === wcj_get_option( 'wcj_product_addons_per_product_enabled', 'no' ) ) {
463
  if ( 'yes' === get_post_meta( $product_id, '_' . 'wcj_product_addons_per_product_settings_enabled', true ) ) {
464
  $total_number = get_post_meta( $product_id, '_' . 'wcj_product_addons_per_product_total_number', true );
465
  for ( $i = 1; $i <= $total_number; $i++ ) {
558
  */
559
  function add_info_to_order_item_name( $name, $item, $is_cart = false ) {
560
  if ( $is_cart ) {
561
+ $start_format = wcj_get_option( 'wcj_product_addons_cart_format_start', '<dl class="variation">' );
562
+ $item_format = wcj_get_option( 'wcj_product_addons_cart_format_each_addon', '<dt>%addon_label%:</dt><dd>%addon_price%</dd>' );
563
+ $end_format = wcj_get_option( 'wcj_product_addons_cart_format_end', '</dl>' );
564
  } else {
565
+ $start_format = wcj_get_option( 'wcj_product_addons_order_details_format_start', '' );
566
+ $item_format = wcj_get_option( 'wcj_product_addons_order_details_format_each_addon', '&nbsp;| %addon_label%: %addon_price%' );
567
+ $end_format = wcj_get_option( 'wcj_product_addons_order_details_format_end', '' );
568
  }
569
  $addons_info = '';
570
  $addons = $this->get_product_addons( $item['product_id'] );
701
  * @since 2.5.3
702
  */
703
  function add_addons_to_frontend() {
704
+ if ( isset( $this->are_addons_displayed ) && 'yes' === wcj_get_option( 'wcj_product_addons_check_for_outputted_data', 'yes' ) ) {
705
  return;
706
  }
707
  $html = '';
712
  $html .= wcj_handle_replacements( array(
713
  '%addon_id%' => $addon['checkbox_key'],
714
  '%addon_title%' => $addon['title'],
715
+ ), wcj_get_option( 'wcj_product_addons_template_title', '<p><label for="%addon_id%">%addon_title%</label></p>' ) );
716
  }
717
  $is_required = ( 'yes' === $addon['is_required'] ) ? ' required' : '';
718
  if ( 'checkbox' === $addon['type'] || '' == $addon['type'] ) {
731
  '%addon_label%' => $addon['label_value'],
732
  '%addon_price%' => $this->format_addon_price( $addon['price_value'], $_product ),
733
  '%addon_tooltip%' => $maybe_tooltip,
734
+ ), wcj_get_option( 'wcj_product_addons_template_type_checkbox',
735
  '<p>%addon_input% <label for="%addon_id%">%addon_label% (%addon_price%)</label>%addon_tooltip%</p>' ) );
736
  } elseif ( 'text' == $addon['type'] ) {
737
  $default_value = ( isset( $_POST[ $addon['checkbox_key'] ] ) ? $_POST[ $addon['checkbox_key'] ] : $addon['default'] );
744
  '%addon_label%' => $addon['label_value'],
745
  '%addon_price%' => $this->format_addon_price( $addon['price_value'], $_product ),
746
  '%addon_tooltip%' => $maybe_tooltip,
747
+ ), wcj_get_option( 'wcj_product_addons_template_type_text',
748
  '<p><label for="%addon_id%">%addon_label% (%addon_price%)</label> %addon_input%%addon_tooltip%</p>' ) );
749
  } elseif ( 'radio' === $addon['type'] || 'select' === $addon['type'] ) {
750
  $prices = $this->clean_and_explode( PHP_EOL, $addon['price_value'] );
775
  '%addon_label%' => $labels[ $i ],
776
  '%addon_price%' => $this->format_addon_price( $prices[ $i ], $_product ),
777
  '%addon_tooltip%' => $maybe_tooltip,
778
+ ), wcj_get_option( 'wcj_product_addons_template_type_radio',
779
  '<p>%addon_input% <label for="%addon_id%">%addon_label% (%addon_price%)</label>%addon_tooltip%</p>' ) );
780
  } else {
781
  $select_option = wcj_handle_replacements( array(
782
  '%addon_label%' => $labels[ $i ],
783
  '%addon_price%' => $this->format_addon_price( $prices[ $i ], $_product ),
784
+ ), wcj_get_option( 'wcj_product_addons_template_type_select_option', '%addon_label% (%addon_price%)' ) );
785
  $select_options .= '<option value="' . $label . '"' . $is_checked . '>' . $select_option . '</option>';
786
  }
787
  }
795
  $html .= wcj_handle_replacements( array(
796
  '%addon_input%' => '<select' . $is_required . ' id="' . $addon['checkbox_key'] . '" class="' . $addon['class'] . '" name="' . $addon['checkbox_key'] . '">' . $select_options . '</select>',
797
  '%addon_tooltip%' => $maybe_tooltip,
798
+ ), wcj_get_option( 'wcj_product_addons_template_type_select', '<p>%addon_input%%addon_tooltip%</p>' ) );
799
  }
800
  }
801
  }
804
  if ( ! empty( $html ) ) {
805
  $html = wcj_handle_replacements( array(
806
  '%addons_html%' => $html,
807
+ ), wcj_get_option( 'wcj_product_addons_template_final', '<div id="wcj_product_addons">%addons_html%</div>' ) );
808
  echo $this->remove_empty_parenthesis($html);
809
  $this->are_addons_displayed = true;
810
  }
845
  }
846
  }
847
  if ( $show_raw_price ) {
848
+ if ( 'yes' === wcj_get_option( 'wcj_product_addons_template_hide_percentage_price', 'yes' ) ) {
849
  return '';
850
  } else {
851
  return $price;
includes/class-wcj-product-bookings.php CHANGED
@@ -62,7 +62,7 @@ class WCJ_Product_Bookings extends WCJ_Module {
62
  add_action( 'woocommerce_checkout_create_order_line_item', array( $this, 'add_info_to_order_item_meta_wc3' ), PHP_INT_MAX, 4 );
63
  }
64
  // Hide quantity
65
- if ( 'yes' === get_option( 'wcj_product_bookings_hide_quantity', 'yes' ) ) {
66
  add_filter( 'woocommerce_is_sold_individually', array( $this, 'sold_individually' ), PHP_INT_MAX, 2 );
67
  }
68
  // Disable AJAX add to cart
@@ -128,7 +128,7 @@ class WCJ_Product_Bookings extends WCJ_Module {
128
  if (
129
  ! is_product() ||
130
  ! $this->is_bookings_product( $the_product = wc_get_product() ) ||
131
- ( 'no' === get_option( 'wcj_product_bookings_price_per_day_variable_products', 'yes' ) && ( $the_product->is_type( 'variable' ) || $the_product->is_type( 'variation' ) ) )
132
  ) {
133
  return;
134
  }
@@ -137,7 +137,7 @@ class WCJ_Product_Bookings extends WCJ_Module {
137
  wp_localize_script( 'wcj-bookings', 'ajax_object', array(
138
  'ajax_url' => admin_url( 'admin-ajax.php' ),
139
  'product_id' => get_the_ID(),
140
- 'wrong_dates_message' => get_option( 'wcj_product_bookings_message_date_to_before_date_from', __( '"Date to" must be after "Date from"', 'woocommerce-jetpack' ) ),
141
  ) );
142
  }
143
 
@@ -202,7 +202,7 @@ class WCJ_Product_Bookings extends WCJ_Module {
202
  }
203
  if ( isset( $item['wcj_bookings_price'] ) ) {
204
  if ( $is_cart ) {
205
- $name .= '<dt>' . get_option( 'wcj_product_bookings_label_period', __( 'Period', 'woocommerce-jetpack' ) ) . ':' . '</dt>';
206
  $name .= '<dd>' . $item['wcj_bookings_date_from'] . ' - ' . $item['wcj_bookings_date_to'] . '</dd>';
207
  } else {
208
  $name .= ' | ' . $item['wcj_bookings_date_from'] . ' - ' . $item['wcj_bookings_date_to'];
@@ -234,17 +234,17 @@ class WCJ_Product_Bookings extends WCJ_Module {
234
  $the_product = wc_get_product( $product_id );
235
  if ( $this->is_bookings_product( $the_product ) ) {
236
  if ( ! isset( $_POST['wcj_product_bookings_date_from'] ) || '' == $_POST['wcj_product_bookings_date_from'] ) {
237
- wc_add_notice( get_option( 'wcj_product_bookings_message_no_date_from', __( '"Date from" must be set', 'woocommerce-jetpack' ) ), 'error' );
238
  return false;
239
  }
240
  if ( ! isset( $_POST['wcj_product_bookings_date_to'] ) || '' == $_POST['wcj_product_bookings_date_to'] ) {
241
- wc_add_notice( get_option( 'wcj_product_bookings_message_no_date_to', __( '"Date to" must be set', 'woocommerce-jetpack' ) ), 'error' );
242
  return false;
243
  }
244
  $date_to = strtotime( $_POST['wcj_product_bookings_date_to'] );
245
  $date_from = strtotime( $_POST['wcj_product_bookings_date_from'] );
246
  if ( $date_from >= $date_to ) {
247
- wc_add_notice( get_option( 'wcj_product_bookings_message_date_to_before_date_from', __( '"Date to" must be after "Date from"', 'woocommerce-jetpack' ) ), 'error' );
248
  return false;
249
  }
250
  }
@@ -350,7 +350,7 @@ class WCJ_Product_Bookings extends WCJ_Module {
350
  * @todo more options: exclude days (1-31), exact availability dates, mindate, maxdate, firstday, dateformat etc.
351
  */
352
  function add_input_fields_to_frontend() {
353
- if ( isset( $this->are_bookings_input_fields_displayed ) && 'yes' === get_option( 'wcj_product_bookings_check_for_outputted_data', 'yes' ) ) {
354
  return;
355
  }
356
  if ( $this->is_bookings_product( wc_get_product() ) ) {
@@ -358,20 +358,20 @@ class WCJ_Product_Bookings extends WCJ_Module {
358
  $data_table = array();
359
  $date_from_value = ( isset( $_POST['wcj_product_bookings_date_from'] ) ) ? $_POST['wcj_product_bookings_date_from'] : '';
360
  $date_to_value = ( isset( $_POST['wcj_product_bookings_date_to'] ) ) ? $_POST['wcj_product_bookings_date_to'] : '';
361
- $date_from_exclude_days = ( '' != ( $exclude = get_option( 'wcj_product_bookings_datepicker_date_from_exclude_days', '' ) ) ?
362
  ' excludedays="[' . str_replace( 'S', '0', implode( ',', $exclude ) ) . ']"' : '' );
363
- $date_to_exclude_days = ( '' != ( $exclude = get_option( 'wcj_product_bookings_datepicker_date_to_exclude_days', '' ) ) ?
364
  ' excludedays="[' . str_replace( 'S', '0', implode( ',', $exclude ) ) . ']"' : '' );
365
- $date_from_exclude_months = ( '' != ( $exclude = get_option( 'wcj_product_bookings_datepicker_date_from_exclude_months', '' ) ) ?
366
  ' excludemonths="[' . implode( ',', $exclude ) . ']"' : '' );
367
- $date_to_exclude_months = ( '' != ( $exclude = get_option( 'wcj_product_bookings_datepicker_date_to_exclude_months', '' ) ) ?
368
  ' excludemonths="[' . implode( ',', $exclude ) . ']"' : '' );
369
  $data_table[] = array(
370
- '<label for="wcj_product_bookings_date_from">' . get_option( 'wcj_product_bookings_label_date_from', __( 'Date from' ) ) . '</label>',
371
  '<input firstday="0"' . $date_from_exclude_days . $date_from_exclude_months . ' dateformat="mm/dd/yy" mindate="0" type="datepicker" display="date" id="wcj_product_bookings_date_from" name="wcj_product_bookings_date_from" placeholder="" value="' . $date_from_value . '">',
372
  );
373
  $data_table[] = array(
374
- '<label for="wcj_product_bookings_date_to">' . get_option( 'wcj_product_bookings_label_date_to', __( 'Date to' ) ) . '</label>',
375
  '<input firstday="0"' . $date_to_exclude_days . $date_to_exclude_months . ' dateformat="mm/dd/yy" mindate="0" type="datepicker" display="date" id="wcj_product_bookings_date_to" name="wcj_product_bookings_date_to" placeholder="" value="' . $date_to_value . '">',
376
  );
377
  echo wcj_get_table_html( $data_table, array( 'table_heading_type' => 'none', ) );
@@ -389,12 +389,12 @@ class WCJ_Product_Bookings extends WCJ_Module {
389
  */
390
  function add_per_day_label( $price_html, $_product ) {
391
  if (
392
- 'no' === get_option( 'wcj_product_bookings_price_per_day_variable_products', 'yes' ) &&
393
  ( $_product->is_type( 'variable' ) || $_product->is_type( 'variation' ) )
394
  ) {
395
  return $price_html;
396
  }
397
- return ( $this->is_bookings_product( $_product ) ) ? $price_html . ' ' . get_option( 'wcj_product_bookings_label_per_day', __( '/ day', 'woocommerce-jetpack' ) ) : $price_html;
398
  }
399
 
400
  /**
@@ -405,7 +405,7 @@ class WCJ_Product_Bookings extends WCJ_Module {
405
  */
406
  function change_price( $price, $_product ) {
407
  if (
408
- 'no' === get_option( 'wcj_product_bookings_price_per_day_variable_products', 'yes' ) &&
409
  ( $_product->is_type( 'variable' ) || $_product->is_type( 'variation' ) )
410
  ) {
411
  return $price;
62
  add_action( 'woocommerce_checkout_create_order_line_item', array( $this, 'add_info_to_order_item_meta_wc3' ), PHP_INT_MAX, 4 );
63
  }
64
  // Hide quantity
65
+ if ( 'yes' === wcj_get_option( 'wcj_product_bookings_hide_quantity', 'yes' ) ) {
66
  add_filter( 'woocommerce_is_sold_individually', array( $this, 'sold_individually' ), PHP_INT_MAX, 2 );
67
  }
68
  // Disable AJAX add to cart
128
  if (
129
  ! is_product() ||
130
  ! $this->is_bookings_product( $the_product = wc_get_product() ) ||
131
+ ( 'no' === wcj_get_option( 'wcj_product_bookings_price_per_day_variable_products', 'yes' ) && ( $the_product->is_type( 'variable' ) || $the_product->is_type( 'variation' ) ) )
132
  ) {
133
  return;
134
  }
137
  wp_localize_script( 'wcj-bookings', 'ajax_object', array(
138
  'ajax_url' => admin_url( 'admin-ajax.php' ),
139
  'product_id' => get_the_ID(),
140
+ 'wrong_dates_message' => wcj_get_option( 'wcj_product_bookings_message_date_to_before_date_from', __( '"Date to" must be after "Date from"', 'woocommerce-jetpack' ) ),
141
  ) );
142
  }
143
 
202
  }
203
  if ( isset( $item['wcj_bookings_price'] ) ) {
204
  if ( $is_cart ) {
205
+ $name .= '<dt>' . wcj_get_option( 'wcj_product_bookings_label_period', __( 'Period', 'woocommerce-jetpack' ) ) . ':' . '</dt>';
206
  $name .= '<dd>' . $item['wcj_bookings_date_from'] . ' - ' . $item['wcj_bookings_date_to'] . '</dd>';
207
  } else {
208
  $name .= ' | ' . $item['wcj_bookings_date_from'] . ' - ' . $item['wcj_bookings_date_to'];
234
  $the_product = wc_get_product( $product_id );
235
  if ( $this->is_bookings_product( $the_product ) ) {
236
  if ( ! isset( $_POST['wcj_product_bookings_date_from'] ) || '' == $_POST['wcj_product_bookings_date_from'] ) {
237
+ wc_add_notice( wcj_get_option( 'wcj_product_bookings_message_no_date_from', __( '"Date from" must be set', 'woocommerce-jetpack' ) ), 'error' );
238
  return false;
239
  }
240
  if ( ! isset( $_POST['wcj_product_bookings_date_to'] ) || '' == $_POST['wcj_product_bookings_date_to'] ) {
241
+ wc_add_notice( wcj_get_option( 'wcj_product_bookings_message_no_date_to', __( '"Date to" must be set', 'woocommerce-jetpack' ) ), 'error' );
242
  return false;
243
  }
244
  $date_to = strtotime( $_POST['wcj_product_bookings_date_to'] );
245
  $date_from = strtotime( $_POST['wcj_product_bookings_date_from'] );
246
  if ( $date_from >= $date_to ) {
247
+ wc_add_notice( wcj_get_option( 'wcj_product_bookings_message_date_to_before_date_from', __( '"Date to" must be after "Date from"', 'woocommerce-jetpack' ) ), 'error' );
248
  return false;
249
  }
250
  }
350
  * @todo more options: exclude days (1-31), exact availability dates, mindate, maxdate, firstday, dateformat etc.
351
  */
352
  function add_input_fields_to_frontend() {
353
+ if ( isset( $this->are_bookings_input_fields_displayed ) && 'yes' === wcj_get_option( 'wcj_product_bookings_check_for_outputted_data', 'yes' ) ) {
354
  return;
355
  }
356
  if ( $this->is_bookings_product( wc_get_product() ) ) {
358
  $data_table = array();
359
  $date_from_value = ( isset( $_POST['wcj_product_bookings_date_from'] ) ) ? $_POST['wcj_product_bookings_date_from'] : '';
360
  $date_to_value = ( isset( $_POST['wcj_product_bookings_date_to'] ) ) ? $_POST['wcj_product_bookings_date_to'] : '';
361
+ $date_from_exclude_days = ( '' != ( $exclude = wcj_get_option( 'wcj_product_bookings_datepicker_date_from_exclude_days', '' ) ) ?
362
  ' excludedays="[' . str_replace( 'S', '0', implode( ',', $exclude ) ) . ']"' : '' );
363
+ $date_to_exclude_days = ( '' != ( $exclude = wcj_get_option( 'wcj_product_bookings_datepicker_date_to_exclude_days', '' ) ) ?
364
  ' excludedays="[' . str_replace( 'S', '0', implode( ',', $exclude ) ) . ']"' : '' );
365
+ $date_from_exclude_months = ( '' != ( $exclude = wcj_get_option( 'wcj_product_bookings_datepicker_date_from_exclude_months', '' ) ) ?
366
  ' excludemonths="[' . implode( ',', $exclude ) . ']"' : '' );
367
+ $date_to_exclude_months = ( '' != ( $exclude = wcj_get_option( 'wcj_product_bookings_datepicker_date_to_exclude_months', '' ) ) ?
368
  ' excludemonths="[' . implode( ',', $exclude ) . ']"' : '' );
369
  $data_table[] = array(
370
+ '<label for="wcj_product_bookings_date_from">' . wcj_get_option( 'wcj_product_bookings_label_date_from', __( 'Date from' ) ) . '</label>',
371
  '<input firstday="0"' . $date_from_exclude_days . $date_from_exclude_months . ' dateformat="mm/dd/yy" mindate="0" type="datepicker" display="date" id="wcj_product_bookings_date_from" name="wcj_product_bookings_date_from" placeholder="" value="' . $date_from_value . '">',
372
  );
373
  $data_table[] = array(
374
+ '<label for="wcj_product_bookings_date_to">' . wcj_get_option( 'wcj_product_bookings_label_date_to', __( 'Date to' ) ) . '</label>',
375
  '<input firstday="0"' . $date_to_exclude_days . $date_to_exclude_months . ' dateformat="mm/dd/yy" mindate="0" type="datepicker" display="date" id="wcj_product_bookings_date_to" name="wcj_product_bookings_date_to" placeholder="" value="' . $date_to_value . '">',
376
  );
377
  echo wcj_get_table_html( $data_table, array( 'table_heading_type' => 'none', ) );
389
  */
390
  function add_per_day_label( $price_html, $_product ) {
391
  if (
392
+ 'no' === wcj_get_option( 'wcj_product_bookings_price_per_day_variable_products', 'yes' ) &&
393
  ( $_product->is_type( 'variable' ) || $_product->is_type( 'variation' ) )
394
  ) {
395
  return $price_html;
396
  }
397
+ return ( $this->is_bookings_product( $_product ) ) ? $price_html . ' ' . wcj_get_option( 'wcj_product_bookings_label_per_day', __( '/ day', 'woocommerce-jetpack' ) ) : $price_html;
398
  }
399
 
400
  /**
405
  */
406
  function change_price( $price, $_product ) {
407
  if (
408
+ 'no' === wcj_get_option( 'wcj_product_bookings_price_per_day_variable_products', 'yes' ) &&
409
  ( $_product->is_type( 'variable' ) || $_product->is_type( 'variation' ) )
410
  ) {
411
  return $price;
includes/class-wcj-product-bulk-meta-editor.php CHANGED
@@ -56,7 +56,7 @@ class WCJ_Product_Bulk_Meta_Editor extends WCJ_Module {
56
  // Actions
57
  $result = $this->perform_actions();
58
  // Preparing products data
59
- $_products = wcj_get_products( array(), 'any', 512, ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_product_bulk_meta_editor_add_variations', 'no' ) ) ) );
60
  $selected_products = isset( $_POST['wcj_product_bulk_meta_editor_products'] ) ? $_POST['wcj_product_bulk_meta_editor_products'] : array();
61
  // Output
62
  echo $this->get_tool_html( $result['meta_name'], $result['result_message'], $_products, $selected_products, $result['set_meta'] );
@@ -341,14 +341,14 @@ class WCJ_Product_Bulk_Meta_Editor extends WCJ_Module {
341
  __( 'Meta', 'woocommerce-jetpack' ) . ': <code>' . $meta_name . '</code>',
342
  '',
343
  );
344
- $additional_columns = get_option( 'wcj_product_bulk_meta_editor_additional_columns', '' );
345
  $table_headings = $this->maybe_add_additional_columns_headings( $table_headings, $additional_columns );
346
  $table_data[] = $table_headings;
347
  foreach ( $_products as $product_id => $product_title ) {
348
  if ( ! in_array( $product_id, $selected_products ) ) {
349
  continue;
350
  }
351
- if ( ! metadata_exists( 'post', $product_id, $meta_name ) && 'yes' === get_option( 'wcj_product_bulk_meta_editor_check_if_exists', 'no' ) ) {
352
  $_post_meta = '<em>' . 'N/A' . '</em>';
353
  $save_button = '';
354
  $delete_button = '';
56
  // Actions
57
  $result = $this->perform_actions();
58
  // Preparing products data
59
+ $_products = wcj_get_products( array(), 'any', 512, ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_product_bulk_meta_editor_add_variations', 'no' ) ) ) );
60
  $selected_products = isset( $_POST['wcj_product_bulk_meta_editor_products'] ) ? $_POST['wcj_product_bulk_meta_editor_products'] : array();
61
  // Output
62
  echo $this->get_tool_html( $result['meta_name'], $result['result_message'], $_products, $selected_products, $result['set_meta'] );
341
  __( 'Meta', 'woocommerce-jetpack' ) . ': <code>' . $meta_name . '</code>',
342
  '',
343
  );
344
+ $additional_columns = wcj_get_option( 'wcj_product_bulk_meta_editor_additional_columns', '' );
345
  $table_headings = $this->maybe_add_additional_columns_headings( $table_headings, $additional_columns );
346
  $table_data[] = $table_headings;
347
  foreach ( $_products as $product_id => $product_title ) {
348
  if ( ! in_array( $product_id, $selected_products ) ) {
349
  continue;
350
  }
351
+ if ( ! metadata_exists( 'post', $product_id, $meta_name ) && 'yes' === wcj_get_option( 'wcj_product_bulk_meta_editor_check_if_exists', 'no' ) ) {
352
  $_post_meta = '<em>' . 'N/A' . '</em>';
353
  $save_button = '';
354
  $delete_button = '';
includes/class-wcj-product-bulk-price-converter.php CHANGED
@@ -42,7 +42,7 @@ class WCJ_Bulk_Price_Converter extends WCJ_Module {
42
  $the_price = get_post_meta( $product_id, '_' . $price_type, true );
43
  $the_modified_price = $the_price;
44
  if ( '' != $the_price && 0 != $the_price ) {
45
- $precision = get_option( 'woocommerce_price_num_decimals', 2 );
46
  $the_modified_price = round( $the_price * $multiply_price_by, $precision );
47
  if ( isset( $_POST['make_pretty_prices_threshold'] ) && apply_filters( 'booster_option', 0, $_POST['make_pretty_prices_threshold'] ) > 0 ) {
48
  $the_modified_price = $this->make_pretty_price( $the_modified_price );
42
  $the_price = get_post_meta( $product_id, '_' . $price_type, true );
43
  $the_modified_price = $the_price;
44
  if ( '' != $the_price && 0 != $the_price ) {
45
+ $precision = wcj_get_option( 'woocommerce_price_num_decimals', 2 );
46
  $the_modified_price = round( $the_price * $multiply_price_by, $precision );
47
  if ( isset( $_POST['make_pretty_prices_threshold'] ) && apply_filters( 'booster_option', 0, $_POST['make_pretty_prices_threshold'] ) > 0 ) {
48
  $the_modified_price = $this->make_pretty_price( $the_modified_price );
includes/class-wcj-product-by-country.php CHANGED
@@ -49,7 +49,7 @@ class WCJ_Product_By_Country extends WCJ_Module_Product_By_Condition {
49
  * @return bool
50
  */
51
  function update_order_review_expired( $update ) {
52
- if ( 'yes' !== get_option( 'wcj_product_by_country_selection_billing_country_overwrite', 'no' ) ) {
53
  return $update;
54
  }
55
  $update = false;
@@ -63,7 +63,7 @@ class WCJ_Product_By_Country extends WCJ_Module_Product_By_Condition {
63
  * @since 3.6.0
64
  */
65
  function get_options_list() {
66
- return ( 'wc' === apply_filters( 'booster_option', 'all', get_option( 'wcj_product_by_country_country_list', 'all' ) ) ?
67
  WC()->countries->get_allowed_countries() : wcj_get_countries() );
68
  }
69
 
@@ -74,7 +74,7 @@ class WCJ_Product_By_Country extends WCJ_Module_Product_By_Condition {
74
  * @since 3.6.0
75
  */
76
  function get_check_option() {
77
- if ( 'manual' === apply_filters( 'booster_option', 'by_ip', get_option( 'wcj_product_by_country_selection_method', 'by_ip' ) ) ) {
78
  if ( '' == wcj_session_get( 'wcj_selected_country' ) ) {
79
  $country = wcj_get_country_by_ip();
80
  wcj_session_set( 'wcj_selected_country', $country );
@@ -85,7 +85,7 @@ class WCJ_Product_By_Country extends WCJ_Module_Product_By_Condition {
85
  } else {
86
  $check_option = wcj_get_country_by_ip();
87
  }
88
- if ( 'yes' === get_option( 'wcj_product_by_country_selection_billing_country_overwrite', 'no' ) ) {
89
  $billing_country = ! empty( $_REQUEST['country'] ) ? $_REQUEST['country'] : '';
90
  if ( ! empty( $billing_country ) ) {
91
  $check_option = $billing_country;
@@ -101,7 +101,7 @@ class WCJ_Product_By_Country extends WCJ_Module_Product_By_Condition {
101
  * @since 3.6.0
102
  */
103
  function maybe_add_extra_frontend_filters() {
104
- if ( 'manual' === apply_filters( 'booster_option', 'by_ip', get_option( 'wcj_product_by_country_selection_method', 'by_ip' ) ) ) {
105
  add_action( 'init', array( $this, 'save_country_in_session' ), PHP_INT_MAX ) ;
106
  }
107
  }
49
  * @return bool
50
  */
51
  function update_order_review_expired( $update ) {
52
+ if ( 'yes' !== wcj_get_option( 'wcj_product_by_country_selection_billing_country_overwrite', 'no' ) ) {
53
  return $update;
54
  }
55
  $update = false;
63
  * @since 3.6.0
64
  */
65
  function get_options_list() {
66
+ return ( 'wc' === apply_filters( 'booster_option', 'all', wcj_get_option( 'wcj_product_by_country_country_list', 'all' ) ) ?
67
  WC()->countries->get_allowed_countries() : wcj_get_countries() );
68
  }
69
 
74
  * @since 3.6.0
75
  */
76
  function get_check_option() {
77
+ if ( 'manual' === apply_filters( 'booster_option', 'by_ip', wcj_get_option( 'wcj_product_by_country_selection_method', 'by_ip' ) ) ) {
78
  if ( '' == wcj_session_get( 'wcj_selected_country' ) ) {
79
  $country = wcj_get_country_by_ip();
80
  wcj_session_set( 'wcj_selected_country', $country );
85
  } else {
86
  $check_option = wcj_get_country_by_ip();
87
  }
88
+ if ( 'yes' === wcj_get_option( 'wcj_product_by_country_selection_billing_country_overwrite', 'no' ) ) {
89
  $billing_country = ! empty( $_REQUEST['country'] ) ? $_REQUEST['country'] : '';
90
  if ( ! empty( $billing_country ) ) {
91
  $check_option = $billing_country;
101
  * @since 3.6.0
102
  */
103
  function maybe_add_extra_frontend_filters() {
104
+ if ( 'manual' === apply_filters( 'booster_option', 'by_ip', wcj_get_option( 'wcj_product_by_country_selection_method', 'by_ip' ) ) ) {
105
  add_action( 'init', array( $this, 'save_country_in_session' ), PHP_INT_MAX ) ;
106
  }
107
  }
includes/class-wcj-product-by-date.php CHANGED
@@ -36,19 +36,19 @@ class WCJ_Product_By_Date extends WCJ_Module {
36
 
37
  if ( $this->is_enabled() ) {
38
  // Per product meta box
39
- if ( 'yes' === get_option( 'wcj_product_by_date_per_product_enabled', 'no' ) ) {
40
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
41
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
42
  add_filter( 'wcj_save_meta_box_value', array( $this, 'save_meta_box_validate_value' ), PHP_INT_MAX, 3 );
43
  add_action( 'admin_notices', array( $this, 'validate_value_admin_notices' ) );
44
  $this->meta_box_validate_value = 'wcj_product_by_date_enabled';
45
  }
46
- if ( 'yes' === get_option( 'wcj_product_by_date_per_product_enabled', 'no' ) || 'yes' === get_option( 'wcj_product_by_date_section_enabled', 'no' ) ) {
47
  // Time now
48
  $this->day_now = intval( date( 'j', $this->time_now ) ); // Day of the month without leading zeros: 1 to 31
49
  $this->month_now = intval( date( 'n', $this->time_now ) ); // Numeric representation of a month, without leading zeros: 1 through 12
50
  // Filters
51
- if ( 'non_purchasable' === get_option( 'wcj_product_by_date_action', 'non_purchasable' ) ) {
52
  add_filter( 'woocommerce_is_purchasable', array( $this, 'check_is_purchasable_by_date' ), PHP_INT_MAX, 2 );
53
  }
54
  add_action( 'woocommerce_single_product_summary', array( $this, 'maybe_add_unavailable_by_date_message' ), 30 );
@@ -88,7 +88,7 @@ class WCJ_Product_By_Date extends WCJ_Module {
88
  */
89
  function maybe_get_direct_date( $product_id ) {
90
  return (
91
- 'yes' === get_option( 'wcj_product_by_date_per_product_enabled', 'no' ) &&
92
  'yes' === get_post_meta( $product_id, '_' . 'wcj_product_by_date_enabled', true ) &&
93
  '' != ( $direct_date = get_post_meta( $product_id, '_' . 'wcj_product_by_date_direct_date', true ) )
94
  ) ? $direct_date : false;
@@ -107,7 +107,7 @@ class WCJ_Product_By_Date extends WCJ_Module {
107
  $replaceable_values = array(
108
  '%direct_date%' => $direct_date,
109
  );
110
- $message = get_option( 'wcj_product_by_date_unavailable_message_direct_date',
111
  '<p style="color:red;">' . __( '%product_title% is not available until %direct_date%.', 'woocommerce-jetpack' ) . '</p>' );
112
  } else {
113
  $_date = $this->get_product_availability_this_month( $_product );
@@ -136,10 +136,10 @@ class WCJ_Product_By_Date extends WCJ_Module {
136
  */
137
  function get_product_availability_this_month( $_product ) {
138
  $product_id = wcj_get_product_id_or_variation_parent_id( $_product );
139
- if ( 'yes' === get_option( 'wcj_product_by_date_per_product_enabled', 'no' ) && 'yes' === get_post_meta( $product_id, '_' . 'wcj_product_by_date_enabled', true ) ) {
140
  return get_post_meta( $product_id, '_' . 'wcj_product_by_date_' . $this->month_now, true );
141
- } elseif ( 'yes' === get_option( 'wcj_product_by_date_section_enabled', 'no' ) ) {
142
- return get_option( 'wcj_product_by_date_' . $this->month_now, $this->get_default_date( $this->month_now ) );
143
  } else {
144
  return '';
145
  }
@@ -155,7 +155,7 @@ class WCJ_Product_By_Date extends WCJ_Module {
155
  function check_is_purchasable_by_date( $purchasable, $_product ) {
156
  if ( $purchasable ) {
157
  if ( false !== ( $direct_date = $this->maybe_get_direct_date( wcj_get_product_id_or_variation_parent_id( $_product ) ) ) ) {
158
- $date = DateTime::createFromFormat( get_option( 'wcj_product_by_date_direct_date_format', 'm/d/Y' ), $direct_date, wcj_timezone() );
159
  if ( false === $date ) {
160
  return false;
161
  }
36
 
37
  if ( $this->is_enabled() ) {
38
  // Per product meta box
39
+ if ( 'yes' === wcj_get_option( 'wcj_product_by_date_per_product_enabled', 'no' ) ) {
40
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
41
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
42
  add_filter( 'wcj_save_meta_box_value', array( $this, 'save_meta_box_validate_value' ), PHP_INT_MAX, 3 );
43
  add_action( 'admin_notices', array( $this, 'validate_value_admin_notices' ) );
44
  $this->meta_box_validate_value = 'wcj_product_by_date_enabled';
45
  }
46
+ if ( 'yes' === wcj_get_option( 'wcj_product_by_date_per_product_enabled', 'no' ) || 'yes' === wcj_get_option( 'wcj_product_by_date_section_enabled', 'no' ) ) {
47
  // Time now
48
  $this->day_now = intval( date( 'j', $this->time_now ) ); // Day of the month without leading zeros: 1 to 31
49
  $this->month_now = intval( date( 'n', $this->time_now ) ); // Numeric representation of a month, without leading zeros: 1 through 12
50
  // Filters
51
+ if ( 'non_purchasable' === wcj_get_option( 'wcj_product_by_date_action', 'non_purchasable' ) ) {
52
  add_filter( 'woocommerce_is_purchasable', array( $this, 'check_is_purchasable_by_date' ), PHP_INT_MAX, 2 );
53
  }
54
  add_action( 'woocommerce_single_product_summary', array( $this, 'maybe_add_unavailable_by_date_message' ), 30 );
88
  */
89
  function maybe_get_direct_date( $product_id ) {
90
  return (
91
+ 'yes' === wcj_get_option( 'wcj_product_by_date_per_product_enabled', 'no' ) &&
92
  'yes' === get_post_meta( $product_id, '_' . 'wcj_product_by_date_enabled', true ) &&
93
  '' != ( $direct_date = get_post_meta( $product_id, '_' . 'wcj_product_by_date_direct_date', true ) )
94
  ) ? $direct_date : false;
107
  $replaceable_values = array(
108
  '%direct_date%' => $direct_date,
109
  );
110
+ $message = wcj_get_option( 'wcj_product_by_date_unavailable_message_direct_date',
111
  '<p style="color:red;">' . __( '%product_title% is not available until %direct_date%.', 'woocommerce-jetpack' ) . '</p>' );
112
  } else {
113
  $_date = $this->get_product_availability_this_month( $_product );
136
  */
137
  function get_product_availability_this_month( $_product ) {
138
  $product_id = wcj_get_product_id_or_variation_parent_id( $_product );
139
+ if ( 'yes' === wcj_get_option( 'wcj_product_by_date_per_product_enabled', 'no' ) && 'yes' === get_post_meta( $product_id, '_' . 'wcj_product_by_date_enabled', true ) ) {
140
  return get_post_meta( $product_id, '_' . 'wcj_product_by_date_' . $this->month_now, true );
141
+ } elseif ( 'yes' === wcj_get_option( 'wcj_product_by_date_section_enabled', 'no' ) ) {
142
+ return wcj_get_option( 'wcj_product_by_date_' . $this->month_now, $this->get_default_date( $this->month_now ) );
143
  } else {
144
  return '';
145
  }
155
  function check_is_purchasable_by_date( $purchasable, $_product ) {
156
  if ( $purchasable ) {
157
  if ( false !== ( $direct_date = $this->maybe_get_direct_date( wcj_get_product_id_or_variation_parent_id( $_product ) ) ) ) {
158
+ $date = DateTime::createFromFormat( wcj_get_option( 'wcj_product_by_date_direct_date_format', 'm/d/Y' ), $direct_date, wcj_timezone() );
159
  if ( false === $date ) {
160
  return false;
161
  }
includes/class-wcj-product-by-time.php CHANGED
@@ -36,14 +36,14 @@ class WCJ_Product_By_Time extends WCJ_Module {
36
 
37
  if ( $this->is_enabled() ) {
38
  // Per product meta box
39
- if ( 'yes' === get_option( 'wcj_product_by_time_per_product_enabled', 'no' ) ) {
40
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
41
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
42
  add_filter( 'wcj_save_meta_box_value', array( $this, 'save_meta_box_validate_value' ), PHP_INT_MAX, 3 );
43
  add_action( 'admin_notices', array( $this, 'validate_value_admin_notices' ) );
44
  $this->meta_box_validate_value = 'wcj_product_by_time_enabled';
45
  }
46
- if ( 'yes' === get_option( 'wcj_product_by_time_per_product_enabled', 'no' ) || 'yes' === get_option( 'wcj_product_by_time_section_enabled', 'no' ) ) {
47
  // Time now
48
  $this->day_of_week_now = intval( date( 'w', $this->time_now ) );
49
  $this->hours_now = intval( date( 'H', $this->time_now ) );
@@ -112,10 +112,10 @@ class WCJ_Product_By_Time extends WCJ_Module {
112
  */
113
  function get_product_availability_this_day( $_product ) {
114
  $product_id = wcj_get_product_id_or_variation_parent_id( $_product );
115
- if ( 'yes' === get_option( 'wcj_product_by_time_per_product_enabled', 'no' ) && 'yes' === get_post_meta( $product_id, '_' . 'wcj_product_by_time_enabled', true ) ) {
116
  return get_post_meta( $product_id, '_' . 'wcj_product_by_time_' . $this->day_of_week_now, true );
117
- } elseif ( 'yes' === get_option( 'wcj_product_by_time_section_enabled', 'no' ) ) {
118
- return get_option( 'wcj_product_by_time_' . $this->day_of_week_now, $this->get_default_time( $this->day_of_week_now ) );
119
  } else {
120
  return '';
121
  }
36
 
37
  if ( $this->is_enabled() ) {
38
  // Per product meta box
39
+ if ( 'yes' === wcj_get_option( 'wcj_product_by_time_per_product_enabled', 'no' ) ) {
40
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
41
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
42
  add_filter( 'wcj_save_meta_box_value', array( $this, 'save_meta_box_validate_value' ), PHP_INT_MAX, 3 );
43
  add_action( 'admin_notices', array( $this, 'validate_value_admin_notices' ) );
44
  $this->meta_box_validate_value = 'wcj_product_by_time_enabled';
45
  }
46
+ if ( 'yes' === wcj_get_option( 'wcj_product_by_time_per_product_enabled', 'no' ) || 'yes' === wcj_get_option( 'wcj_product_by_time_section_enabled', 'no' ) ) {
47
  // Time now
48
  $this->day_of_week_now = intval( date( 'w', $this->time_now ) );
49
  $this->hours_now = intval( date( 'H', $this->time_now ) );
112
  */
113
  function get_product_availability_this_day( $_product ) {
114
  $product_id = wcj_get_product_id_or_variation_parent_id( $_product );
115
+ if ( 'yes' === wcj_get_option( 'wcj_product_by_time_per_product_enabled', 'no' ) && 'yes' === get_post_meta( $product_id, '_' . 'wcj_product_by_time_enabled', true ) ) {
116
  return get_post_meta( $product_id, '_' . 'wcj_product_by_time_' . $this->day_of_week_now, true );
117
+ } elseif ( 'yes' === wcj_get_option( 'wcj_product_by_time_section_enabled', 'no' ) ) {
118
+ return wcj_get_option( 'wcj_product_by_time_' . $this->day_of_week_now, $this->get_default_time( $this->day_of_week_now ) );
119
  } else {
120
  return '';
121
  }
includes/class-wcj-product-by-user-role.php CHANGED
@@ -72,7 +72,7 @@ class WCJ_Product_By_User_Role extends WCJ_Module_Product_By_Condition {
72
  * @since 3.6.0
73
  */
74
  function get_options_list() {
75
- $user_roles_options_args = 'no' === get_option( 'wcj_' . $this->id . '_user_options_skip_editable_roles', 'no' ) ? null : array( 'skip_editable_roles_filter' => true );
76
  return wcj_get_user_roles_options( $user_roles_options_args );
77
  }
78
 
72
  * @since 3.6.0
73
  */
74
  function get_options_list() {
75
+ $user_roles_options_args = 'no' === wcj_get_option( 'wcj_' . $this->id . '_user_options_skip_editable_roles', 'no' ) ? null : array( 'skip_editable_roles_filter' => true );
76
  return wcj_get_user_roles_options( $user_roles_options_args );
77
  }
78
 
includes/class-wcj-product-by-user.php CHANGED
@@ -37,7 +37,7 @@ class WCJ_Product_By_User extends WCJ_Module {
37
  add_action( 'init', array( $this, 'add_my_products_endpoint' ) );
38
 
39
  if ( $this->is_enabled() ) {
40
- if ( 'yes' === get_option( 'wcj_product_by_user_add_to_my_account', 'yes' ) ) {
41
  add_filter( 'woocommerce_account_menu_items', array( $this, 'add_my_products_tab_my_account_page' ) );
42
  add_action( 'woocommerce_account_wcj-my-products_endpoint', array( $this, 'add_my_products_content_my_account_page' ) );
43
  add_filter( 'the_title', array( $this, 'change_my_products_endpoint_title' ) );
37
  add_action( 'init', array( $this, 'add_my_products_endpoint' ) );
38
 
39
  if ( $this->is_enabled() ) {
40
+ if ( 'yes' === wcj_get_option( 'wcj_product_by_user_add_to_my_account', 'yes' ) ) {
41
  add_filter( 'woocommerce_account_menu_items', array( $this, 'add_my_products_tab_my_account_page' ) );
42
  add_action( 'woocommerce_account_wcj-my-products_endpoint', array( $this, 'add_my_products_content_my_account_page' ) );
43
  add_filter( 'the_title', array( $this, 'change_my_products_endpoint_title' ) );
includes/class-wcj-product-custom-info.php CHANGED
@@ -31,7 +31,7 @@ class WCJ_Product_Custom_info extends WCJ_Module {
31
  $single_or_archive_array = array( 'single', 'archive' );
32
  foreach ( $single_or_archive_array as $single_or_archive ) {
33
  $default_hook = ( 'single' === $single_or_archive ) ? 'woocommerce_after_single_product_summary' : 'woocommerce_after_shop_loop_item_title';
34
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_product_custom_info_total_number_' . $single_or_archive, 1 ) ); $i++ ) {
35
  add_action(
36
  get_option( 'wcj_product_custom_info_hook_' . $single_or_archive . '_' . $i, $default_hook ),
37
  array( $this, 'add_product_custom_info' ),
@@ -63,9 +63,9 @@ class WCJ_Product_Custom_info extends WCJ_Module {
63
  */
64
  function check_content_and_filter( $current_filter, $current_filter_priority, $default_hook, $single_or_archive, $i ) {
65
  return (
66
- '' != get_option( 'wcj_product_custom_info_content_' . $single_or_archive . '_' . $i ) &&
67
- $current_filter === get_option( 'wcj_product_custom_info_hook_' . $single_or_archive . '_' . $i, $default_hook ) &&
68
- $current_filter_priority == get_option( 'wcj_product_custom_info_priority_' . $single_or_archive . '_' . $i, 10 )
69
  );
70
  }
71
 
@@ -76,12 +76,12 @@ class WCJ_Product_Custom_info extends WCJ_Module {
76
  * @since 2.9.0
77
  */
78
  function check_included_and_excluded( $product_id, $single_or_archive, $i ) {
79
- $product_cats_to_include = wcj_maybe_convert_string_to_array( get_option( 'wcj_product_custom_info_product_cats_to_include_' . $single_or_archive . '_' . $i ) );
80
- $product_cats_to_exclude = wcj_maybe_convert_string_to_array( get_option( 'wcj_product_custom_info_product_cats_to_exclude_' . $single_or_archive . '_' . $i ) );
81
- $product_tags_to_include = wcj_maybe_convert_string_to_array( get_option( 'wcj_product_custom_info_product_tags_to_include_' . $single_or_archive . '_' . $i ) );
82
- $product_tags_to_exclude = wcj_maybe_convert_string_to_array( get_option( 'wcj_product_custom_info_product_tags_to_exclude_' . $single_or_archive . '_' . $i ) );
83
- $products_to_exclude = wcj_maybe_convert_string_to_array( get_option( 'wcj_product_custom_info_products_to_exclude_' . $single_or_archive . '_' . $i ) );
84
- $products_to_include = wcj_maybe_convert_string_to_array( get_option( 'wcj_product_custom_info_products_to_include_' . $single_or_archive . '_' . $i ) );
85
  return (
86
  ( empty( $product_cats_to_exclude ) || ! wcj_is_product_term( $product_id, $product_cats_to_exclude, 'product_cat' ) ) &&
87
  ( empty( $product_cats_to_include ) || wcj_is_product_term( $product_id, $product_cats_to_include, 'product_cat' ) ) &&
@@ -104,9 +104,9 @@ class WCJ_Product_Custom_info extends WCJ_Module {
104
  $single_or_archive_array = array( 'single', 'archive' );
105
  foreach ( $single_or_archive_array as $single_or_archive ) {
106
  $default_hook = ( 'single' === $single_or_archive ) ? 'woocommerce_after_single_product_summary' : 'woocommerce_after_shop_loop_item_title';
107
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_product_custom_info_total_number_' . $single_or_archive, 1 ) ); $i++ ) {
108
  if ( $this->is_visible( $product_id, $current_filter, $current_filter_priority, $default_hook, $single_or_archive, $i ) ) {
109
- echo do_shortcode( get_option( 'wcj_product_custom_info_content_' . $single_or_archive . '_' . $i ) );
110
  }
111
  }
112
  }
31
  $single_or_archive_array = array( 'single', 'archive' );
32
  foreach ( $single_or_archive_array as $single_or_archive ) {
33
  $default_hook = ( 'single' === $single_or_archive ) ? 'woocommerce_after_single_product_summary' : 'woocommerce_after_shop_loop_item_title';
34
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_product_custom_info_total_number_' . $single_or_archive, 1 ) ); $i++ ) {
35
  add_action(
36
  get_option( 'wcj_product_custom_info_hook_' . $single_or_archive . '_' . $i, $default_hook ),
37
  array( $this, 'add_product_custom_info' ),
63
  */
64
  function check_content_and_filter( $current_filter, $current_filter_priority, $default_hook, $single_or_archive, $i ) {
65
  return (
66
+ '' != wcj_get_option( 'wcj_product_custom_info_content_' . $single_or_archive . '_' . $i ) &&
67
+ $current_filter === wcj_get_option( 'wcj_product_custom_info_hook_' . $single_or_archive . '_' . $i, $default_hook ) &&
68
+ $current_filter_priority == wcj_get_option( 'wcj_product_custom_info_priority_' . $single_or_archive . '_' . $i, 10 )
69
  );
70
  }
71
 
76
  * @since 2.9.0
77
  */
78
  function check_included_and_excluded( $product_id, $single_or_archive, $i ) {
79
+ $product_cats_to_include = wcj_maybe_convert_string_to_array( wcj_get_option( 'wcj_product_custom_info_product_cats_to_include_' . $single_or_archive . '_' . $i ) );
80
+ $product_cats_to_exclude = wcj_maybe_convert_string_to_array( wcj_get_option( 'wcj_product_custom_info_product_cats_to_exclude_' . $single_or_archive . '_' . $i ) );
81
+ $product_tags_to_include = wcj_maybe_convert_string_to_array( wcj_get_option( 'wcj_product_custom_info_product_tags_to_include_' . $single_or_archive . '_' . $i ) );
82
+ $product_tags_to_exclude = wcj_maybe_convert_string_to_array( wcj_get_option( 'wcj_product_custom_info_product_tags_to_exclude_' . $single_or_archive . '_' . $i ) );
83
+ $products_to_exclude = wcj_maybe_convert_string_to_array( wcj_get_option( 'wcj_product_custom_info_products_to_exclude_' . $single_or_archive . '_' . $i ) );
84
+ $products_to_include = wcj_maybe_convert_string_to_array( wcj_get_option( 'wcj_product_custom_info_products_to_include_' . $single_or_archive . '_' . $i ) );
85
  return (
86
  ( empty( $product_cats_to_exclude ) || ! wcj_is_product_term( $product_id, $product_cats_to_exclude, 'product_cat' ) ) &&
87
  ( empty( $product_cats_to_include ) || wcj_is_product_term( $product_id, $product_cats_to_include, 'product_cat' ) ) &&
104
  $single_or_archive_array = array( 'single', 'archive' );
105
  foreach ( $single_or_archive_array as $single_or_archive ) {
106
  $default_hook = ( 'single' === $single_or_archive ) ? 'woocommerce_after_single_product_summary' : 'woocommerce_after_shop_loop_item_title';
107
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_product_custom_info_total_number_' . $single_or_archive, 1 ) ); $i++ ) {
108
  if ( $this->is_visible( $product_id, $current_filter, $current_filter_priority, $default_hook, $single_or_archive, $i ) ) {
109
+ echo do_shortcode( wcj_get_option( 'wcj_product_custom_info_content_' . $single_or_archive . '_' . $i ) );
110
  }
111
  }
112
  }
includes/class-wcj-product-custom-visibility.php CHANGED
@@ -45,7 +45,7 @@ class WCJ_Product_Custom_Visibility extends WCJ_Module_Product_By_Condition {
45
  * @since 3.6.0
46
  */
47
  function get_options_list() {
48
- return wcj_get_select_options( get_option( 'wcj_product_custom_visibility_options_list', '' ) );
49
  }
50
 
51
  /**
45
  * @since 3.6.0
46
  */
47
  function get_options_list() {
48
+ return wcj_get_select_options( wcj_get_option( 'wcj_product_custom_visibility_options_list', '' ) );
49
  }
50
 
51
  /**
includes/class-wcj-product-images.php CHANGED
@@ -30,7 +30,7 @@ class WCJ_Product_Images extends WCJ_Module {
30
  if ( $this->is_enabled() ) {
31
 
32
  // Single
33
- if ( 'yes' === get_option( 'wcj_product_images_and_thumbnails_hide_on_single', 'no' ) ) {
34
  add_action( 'init', array( $this, 'product_images_and_thumbnails_hide_on_single' ), PHP_INT_MAX );
35
  } else {
36
  if ( WCJ_IS_WC_VERSION_BELOW_3 ) {
@@ -55,7 +55,7 @@ class WCJ_Product_Images extends WCJ_Module {
55
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
56
 
57
  // Placeholder image
58
- if ( '' != ( $this->product_images_placeholder_src = get_option( 'wcj_product_images_placeholder_src', '' ) ) ) {
59
  add_filter( 'woocommerce_placeholder_img_src', array( $this, 'placeholder_img_src' ), PHP_INT_MAX );
60
  }
61
 
@@ -80,16 +80,16 @@ class WCJ_Product_Images extends WCJ_Module {
80
  function get_callback_and_priority( $value ) {
81
  switch ( current_filter() ) {
82
  case 'wcj_product_images_loop_product_thumbnail_filter':
83
- $value = get_option( 'wcj_product_images_cb_loop_product_thumbnail', 'woocommerce_template_loop_product_thumbnail' );
84
  break;
85
  case 'wcj_product_images_loop_product_thumbnail_filter_priority':
86
- $value = get_option( 'wcj_product_images_cb_loop_product_thumbnail_priority', 10 );
87
  break;
88
  case 'wcj_product_images_single_product_images_filter':
89
- $value = get_option( 'wcj_product_images_cb_show_product_images', 'woocommerce_show_product_images' );
90
  break;
91
  case 'wcj_product_images_single_product_images_filter_priority':
92
- $value = get_option( 'wcj_product_images_cb_show_product_images_priority', 30 );
93
  break;
94
  }
95
  return $value;
@@ -146,8 +146,8 @@ class WCJ_Product_Images extends WCJ_Module {
146
  $post_id = get_the_ID();
147
  if ( $post_id > 0 && '' != get_post_meta( $post_id, '_' . 'wcj_product_images_meta_custom_on_archives', true ) ) {
148
  echo do_shortcode( get_post_meta( $post_id, '_' . 'wcj_product_images_meta_custom_on_archives', true ) );
149
- } elseif ( '' != get_option( 'wcj_product_images_custom_on_archives', '' ) ) {
150
- echo do_shortcode( get_option( 'wcj_product_images_custom_on_archives' ) );
151
  }
152
  }
153
 
@@ -158,8 +158,8 @@ class WCJ_Product_Images extends WCJ_Module {
158
  */
159
  function product_images_hide_on_archive() {
160
  if (
161
- 'yes' === get_option( 'wcj_product_images_hide_on_archive', 'no' ) ||
162
- '' != get_option( 'wcj_product_images_custom_on_archives', '' ) ||
163
  ( ( $post_id = get_the_ID() ) > 0 && '' != get_post_meta( $post_id, '_' . 'wcj_product_images_meta_custom_on_archives', true ) )
164
  ) {
165
  remove_action( 'woocommerce_before_shop_loop_item_title',
@@ -191,9 +191,9 @@ class WCJ_Product_Images extends WCJ_Module {
191
  function customize_single_product_image_html( $image_link, $post_id ) {
192
  if ( '' != ( $html_single = get_post_meta( $post_id, '_' . 'wcj_product_images_meta_custom_on_single', true ) ) ) {
193
  return do_shortcode( $html_single );
194
- } elseif ( '' != ( $html_global = get_option( 'wcj_product_images_custom_on_single', '' ) ) ) {
195
  return do_shortcode( $html_global );
196
- } elseif ( 'yes' === get_option( 'wcj_product_images_hide_on_single', 'no' ) ) {
197
  return '';
198
  } elseif ( 'yes' === get_post_meta( $post_id, '_' . 'wcj_product_images_hide_image_on_single', true ) ) {
199
  return '';
@@ -208,9 +208,9 @@ class WCJ_Product_Images extends WCJ_Module {
208
  */
209
  function customize_single_product_image_thumbnail_html( $image_link ) {
210
  $post_id = get_the_ID();
211
- if ( '' != get_option( 'wcj_product_images_thumbnails_custom_on_single', '' ) ) {
212
- return do_shortcode( get_option( 'wcj_product_images_thumbnails_custom_on_single' ) );
213
- } elseif ( 'yes' === get_option( 'wcj_product_images_thumbnails_hide_on_single', 'no' ) ) {
214
  return '';
215
  } elseif ( $post_id > 0 && 'yes' === get_post_meta( $post_id, '_' . 'wcj_product_images_hide_thumb_on_single', true ) ) {
216
  return '';
@@ -236,7 +236,7 @@ class WCJ_Product_Images extends WCJ_Module {
236
  * change_product_thumbnails_columns.
237
  */
238
  function change_product_thumbnails_columns_number( $columns_number ) {
239
- return get_option( 'wcj_product_images_thumbnails_columns', 3 );
240
  }
241
 
242
  }
30
  if ( $this->is_enabled() ) {
31
 
32
  // Single
33
+ if ( 'yes' === wcj_get_option( 'wcj_product_images_and_thumbnails_hide_on_single', 'no' ) ) {
34
  add_action( 'init', array( $this, 'product_images_and_thumbnails_hide_on_single' ), PHP_INT_MAX );
35
  } else {
36
  if ( WCJ_IS_WC_VERSION_BELOW_3 ) {
55
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
56
 
57
  // Placeholder image
58
+ if ( '' != ( $this->product_images_placeholder_src = wcj_get_option( 'wcj_product_images_placeholder_src', '' ) ) ) {
59
  add_filter( 'woocommerce_placeholder_img_src', array( $this, 'placeholder_img_src' ), PHP_INT_MAX );
60
  }
61
 
80
  function get_callback_and_priority( $value ) {
81
  switch ( current_filter() ) {
82
  case 'wcj_product_images_loop_product_thumbnail_filter':
83
+ $value = wcj_get_option( 'wcj_product_images_cb_loop_product_thumbnail', 'woocommerce_template_loop_product_thumbnail' );
84
  break;
85
  case 'wcj_product_images_loop_product_thumbnail_filter_priority':
86
+ $value = wcj_get_option( 'wcj_product_images_cb_loop_product_thumbnail_priority', 10 );
87
  break;
88
  case 'wcj_product_images_single_product_images_filter':
89
+ $value = wcj_get_option( 'wcj_product_images_cb_show_product_images', 'woocommerce_show_product_images' );
90
  break;
91
  case 'wcj_product_images_single_product_images_filter_priority':
92
+ $value = wcj_get_option( 'wcj_product_images_cb_show_product_images_priority', 30 );
93
  break;
94
  }
95
  return $value;
146
  $post_id = get_the_ID();
147
  if ( $post_id > 0 && '' != get_post_meta( $post_id, '_' . 'wcj_product_images_meta_custom_on_archives', true ) ) {
148
  echo do_shortcode( get_post_meta( $post_id, '_' . 'wcj_product_images_meta_custom_on_archives', true ) );
149
+ } elseif ( '' != wcj_get_option( 'wcj_product_images_custom_on_archives', '' ) ) {
150
+ echo do_shortcode( wcj_get_option( 'wcj_product_images_custom_on_archives' ) );
151
  }
152
  }
153
 
158
  */
159
  function product_images_hide_on_archive() {
160
  if (
161
+ 'yes' === wcj_get_option( 'wcj_product_images_hide_on_archive', 'no' ) ||
162
+ '' != wcj_get_option( 'wcj_product_images_custom_on_archives', '' ) ||
163
  ( ( $post_id = get_the_ID() ) > 0 && '' != get_post_meta( $post_id, '_' . 'wcj_product_images_meta_custom_on_archives', true ) )
164
  ) {
165
  remove_action( 'woocommerce_before_shop_loop_item_title',
191
  function customize_single_product_image_html( $image_link, $post_id ) {
192
  if ( '' != ( $html_single = get_post_meta( $post_id, '_' . 'wcj_product_images_meta_custom_on_single', true ) ) ) {
193
  return do_shortcode( $html_single );
194
+ } elseif ( '' != ( $html_global = wcj_get_option( 'wcj_product_images_custom_on_single', '' ) ) ) {
195
  return do_shortcode( $html_global );
196
+ } elseif ( 'yes' === wcj_get_option( 'wcj_product_images_hide_on_single', 'no' ) ) {
197
  return '';
198
  } elseif ( 'yes' === get_post_meta( $post_id, '_' . 'wcj_product_images_hide_image_on_single', true ) ) {
199
  return '';
208
  */
209
  function customize_single_product_image_thumbnail_html( $image_link ) {
210
  $post_id = get_the_ID();
211
+ if ( '' != wcj_get_option( 'wcj_product_images_thumbnails_custom_on_single', '' ) ) {
212
+ return do_shortcode( wcj_get_option( 'wcj_product_images_thumbnails_custom_on_single' ) );
213
+ } elseif ( 'yes' === wcj_get_option( 'wcj_product_images_thumbnails_hide_on_single', 'no' ) ) {
214
  return '';
215
  } elseif ( $post_id > 0 && 'yes' === get_post_meta( $post_id, '_' . 'wcj_product_images_hide_thumb_on_single', true ) ) {
216
  return '';
236
  * change_product_thumbnails_columns.
237
  */
238
  function change_product_thumbnails_columns_number( $columns_number ) {
239
+ return wcj_get_option( 'wcj_product_images_thumbnails_columns', 3 );
240
  }
241
 
242
  }
includes/class-wcj-product-info.php CHANGED
@@ -146,14 +146,14 @@ class WCJ_Product_Info extends WCJ_Module {
146
  */
147
  function add_product_info_filters( $single_or_archive ) {
148
  // Product Info
149
- if ( ( 'yes' === get_option( 'wcj_product_info_on_' . $single_or_archive . '_enabled' ) ) &&
150
- ( '' != get_option( 'wcj_product_info_on_' . $single_or_archive ) ) &&
151
- ( '' != get_option( 'wcj_product_info_on_' . $single_or_archive . '_filter' ) ) &&
152
- ( '' != get_option( 'wcj_product_info_on_' . $single_or_archive . '_filter_priority' ) ) )
153
- add_action( get_option( 'wcj_product_info_on_' . $single_or_archive . '_filter' ), array( $this, 'product_info' ), get_option( 'wcj_product_info_on_' . $single_or_archive . '_filter_priority' ) );
154
  // More product Info
155
- if ( 'yes' === get_option( 'wcj_more_product_info_on_' . $single_or_archive . '_enabled' ) ) {
156
- add_action( get_option( 'wcj_more_product_info_on_' . $single_or_archive . '_filter' ), array( $this, 'more_product_info' ), get_option( 'wcj_more_product_info_on_' . $single_or_archive . '_filter_priority' ) );
157
  }
158
  }
159
 
@@ -165,12 +165,12 @@ class WCJ_Product_Info extends WCJ_Module {
165
  function product_info() {
166
  $the_action_name = current_filter();
167
  if ( array_key_exists( $the_action_name, $this->product_info_on_archive_filters_array ) ) {
168
- $the_product_info = get_option( 'wcj_product_info_on_archive' );
169
  $the_product_info = $this->search_and_replace_deprecated_shortcodes( $the_product_info );
170
  $this->apply_product_info_short_codes( $the_product_info, false );
171
  }
172
  else if ( array_key_exists( $the_action_name, $this->product_info_on_single_filters_array ) ) {
173
- $the_product_info = get_option( 'wcj_product_info_on_single' );
174
  $the_product_info = $this->search_and_replace_deprecated_shortcodes( $the_product_info );
175
  $this->apply_product_info_short_codes( $the_product_info, false );
176
  }
@@ -193,9 +193,9 @@ class WCJ_Product_Info extends WCJ_Module {
193
  * @version 2.4.0
194
  */
195
  function add_more_product_info( $single_or_archive ) {
196
- for ( $i = 1; $i <= apply_filters( 'booster_option', 4, get_option( 'wcj_more_product_info_on_' . $single_or_archive . '_fields_total', 4 ) ); $i++ ) {
197
  $field_id = 'wcj_more_product_info_on_' . $single_or_archive . '_' . $i ;
198
- $the_product_info = get_option( $field_id );
199
  $the_product_info = $this->search_and_replace_deprecated_shortcodes( $the_product_info );
200
  $this->apply_product_info_short_codes( $the_product_info, true );
201
  }
@@ -208,7 +208,7 @@ class WCJ_Product_Info extends WCJ_Module {
208
  */
209
  function apply_product_info_short_codes( $the_product_info, $remove_on_empty ) {
210
 
211
- $product_ids_to_exclude = get_option( 'wcj_product_info_products_to_exclude', '' );
212
  if ( '' != $product_ids_to_exclude ) {
213
  $product_ids_to_exclude = str_replace( ' ', '', $product_ids_to_exclude );
214
  $product_ids_to_exclude = explode( ',', $product_ids_to_exclude );
@@ -274,7 +274,7 @@ class WCJ_Product_Info extends WCJ_Module {
274
  * @version 2.4.0
275
  */
276
  function admin_add_product_info_fields( &$settings, $single_or_archive ) {
277
- for ( $i = 1; $i <= apply_filters( 'booster_option', 4, get_option( 'wcj_more_product_info_on_' . $single_or_archive . '_fields_total', 4 ) ); $i++ ) {
278
  $field_id = 'wcj_more_product_info_on_' . $single_or_archive . '_' . $i ;
279
  $default_value = '';
280
  switch ( $i ) {
146
  */
147
  function add_product_info_filters( $single_or_archive ) {
148
  // Product Info
149
+ if ( ( 'yes' === wcj_get_option( 'wcj_product_info_on_' . $single_or_archive . '_enabled' ) ) &&
150
+ ( '' != wcj_get_option( 'wcj_product_info_on_' . $single_or_archive ) ) &&
151
+ ( '' != wcj_get_option( 'wcj_product_info_on_' . $single_or_archive . '_filter' ) ) &&
152
+ ( '' != wcj_get_option( 'wcj_product_info_on_' . $single_or_archive . '_filter_priority' ) ) )
153
+ add_action( wcj_get_option( 'wcj_product_info_on_' . $single_or_archive . '_filter' ), array( $this, 'product_info' ), wcj_get_option( 'wcj_product_info_on_' . $single_or_archive . '_filter_priority' ) );
154
  // More product Info
155
+ if ( 'yes' === wcj_get_option( 'wcj_more_product_info_on_' . $single_or_archive . '_enabled' ) ) {
156
+ add_action( wcj_get_option( 'wcj_more_product_info_on_' . $single_or_archive . '_filter' ), array( $this, 'more_product_info' ), wcj_get_option( 'wcj_more_product_info_on_' . $single_or_archive . '_filter_priority' ) );
157
  }
158
  }
159
 
165
  function product_info() {
166
  $the_action_name = current_filter();
167
  if ( array_key_exists( $the_action_name, $this->product_info_on_archive_filters_array ) ) {
168
+ $the_product_info = wcj_get_option( 'wcj_product_info_on_archive' );
169
  $the_product_info = $this->search_and_replace_deprecated_shortcodes( $the_product_info );
170
  $this->apply_product_info_short_codes( $the_product_info, false );
171
  }
172
  else if ( array_key_exists( $the_action_name, $this->product_info_on_single_filters_array ) ) {
173
+ $the_product_info = wcj_get_option( 'wcj_product_info_on_single' );
174
  $the_product_info = $this->search_and_replace_deprecated_shortcodes( $the_product_info );
175
  $this->apply_product_info_short_codes( $the_product_info, false );
176
  }
193
  * @version 2.4.0
194
  */
195
  function add_more_product_info( $single_or_archive ) {
196
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 4, wcj_get_option( 'wcj_more_product_info_on_' . $single_or_archive . '_fields_total', 4 ) ); $i++ ) {
197
  $field_id = 'wcj_more_product_info_on_' . $single_or_archive . '_' . $i ;
198
+ $the_product_info = wcj_get_option( $field_id );
199
  $the_product_info = $this->search_and_replace_deprecated_shortcodes( $the_product_info );
200
  $this->apply_product_info_short_codes( $the_product_info, true );
201
  }
208
  */
209
  function apply_product_info_short_codes( $the_product_info, $remove_on_empty ) {
210
 
211
+ $product_ids_to_exclude = wcj_get_option( 'wcj_product_info_products_to_exclude', '' );
212
  if ( '' != $product_ids_to_exclude ) {
213
  $product_ids_to_exclude = str_replace( ' ', '', $product_ids_to_exclude );
214
  $product_ids_to_exclude = explode( ',', $product_ids_to_exclude );
274
  * @version 2.4.0
275
  */
276
  function admin_add_product_info_fields( &$settings, $single_or_archive ) {
277
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 4, wcj_get_option( 'wcj_more_product_info_on_' . $single_or_archive . '_fields_total', 4 ) ); $i++ ) {
278
  $field_id = 'wcj_more_product_info_on_' . $single_or_archive . '_' . $i ;
279
  $default_value = '';
280
  switch ( $i ) {
includes/class-wcj-product-input-fields.php CHANGED
@@ -38,7 +38,7 @@ class WCJ_Product_Input_Fields extends WCJ_Module {
38
  $this->global_product_fields = new WCJ_Product_Input_Fields_Core( 'global' );
39
  $this->local_product_fields = new WCJ_Product_Input_Fields_Core( 'local' );
40
 
41
- if ( 'yes' === get_option( 'wcj_product_input_fields_global_enabled', 'no' ) || 'yes' === get_option( 'wcj_product_input_fields_local_enabled', 'no' ) ) {
42
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
43
  add_action( 'init', array( $this, 'register_scripts' ) );
44
  }
@@ -55,7 +55,7 @@ class WCJ_Product_Input_Fields extends WCJ_Module {
55
  * @since 4.5.0
56
  */
57
  function preserve_linebreaks_admin() {
58
- if ( 'yes' !== get_option( 'wcj_product_input_fields_admin_linebreaks', 'no' ) ) {
59
  return;
60
  }
61
  ?>
@@ -74,7 +74,7 @@ class WCJ_Product_Input_Fields extends WCJ_Module {
74
  * @since 4.5.0
75
  */
76
  function preserve_linebreaks_frontend() {
77
- if ( 'yes' !== get_option( 'wcj_product_input_fields_frontend_linebreaks', 'no' ) ) {
78
  return;
79
  }
80
  ?>
38
  $this->global_product_fields = new WCJ_Product_Input_Fields_Core( 'global' );
39
  $this->local_product_fields = new WCJ_Product_Input_Fields_Core( 'local' );
40
 
41
+ if ( 'yes' === wcj_get_option( 'wcj_product_input_fields_global_enabled', 'no' ) || 'yes' === wcj_get_option( 'wcj_product_input_fields_local_enabled', 'no' ) ) {
42
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
43
  add_action( 'init', array( $this, 'register_scripts' ) );
44
  }
55
  * @since 4.5.0
56
  */
57
  function preserve_linebreaks_admin() {
58
+ if ( 'yes' !== wcj_get_option( 'wcj_product_input_fields_admin_linebreaks', 'no' ) ) {
59
  return;
60
  }
61
  ?>
74
  * @since 4.5.0
75
  */
76
  function preserve_linebreaks_frontend() {
77
+ if ( 'yes' !== wcj_get_option( 'wcj_product_input_fields_frontend_linebreaks', 'no' ) ) {
78
  return;
79
  }
80
  ?>
includes/class-wcj-product-listings.php CHANGED
@@ -37,17 +37,17 @@ class WCJ_Product_Listings extends WCJ_Module {
37
  add_filter( 'woocommerce_product_subcategories_hide_empty', array( $this, 'filter_subcategories_hide_empty' ), 100 );
38
 
39
  // Hide Count
40
- if ( 'yes' === get_option( 'wcj_product_listings_hide_cats_count_on_shop' ) || 'yes' === get_option( 'wcj_product_listings_hide_cats_count_on_archive' ) ) {
41
  add_filter( 'woocommerce_subcategory_count_html', array( $this, 'remove_subcategory_count' ), 100 );
42
  }
43
 
44
  // Product visibility by price
45
- if ( 'yes' === get_option( 'wcj_product_listings_product_visibility_by_price_enabled', 'no' ) ) {
46
  add_filter( 'woocommerce_product_is_visible', array( $this, 'product_visibility_by_price' ), PHP_INT_MAX, 2 );
47
  }
48
 
49
  // Product visibility by category
50
- $this->cats_products_to_hide_on_shop = get_option( 'wcj_product_listings_exclude_cats_products_on_shop', '' );
51
  if ( ! empty( $this->cats_products_to_hide_on_shop ) ) {
52
  add_filter( 'woocommerce_product_is_visible', array( $this, 'product_visibility_by_category' ), PHP_INT_MAX, 2 );
53
  }
@@ -82,8 +82,8 @@ class WCJ_Product_Listings extends WCJ_Module {
82
  $min_price = $product->get_price();
83
  $max_price = $product->get_price();
84
  }
85
- $min_price_limit = get_option( 'wcj_product_listings_product_visibility_by_price_min', 0 );
86
- $max_price_limit = get_option( 'wcj_product_listings_product_visibility_by_price_max', 0 );
87
  return ( ( 0 != $min_price_limit && $min_price < $min_price_limit ) || ( 0 != $max_price_limit && $max_price > $max_price_limit ) ? false : $visible );
88
  }
89
 
@@ -92,8 +92,8 @@ class WCJ_Product_Listings extends WCJ_Module {
92
  */
93
  function remove_subcategory_count( $count_html ) {
94
  if (
95
- ( is_shop() && 'yes' === get_option( 'wcj_product_listings_hide_cats_count_on_shop' ) ) ||
96
- ( ! is_shop() && 'yes' === apply_filters( 'booster_option', 'wcj', get_option( 'wcj_product_listings_hide_cats_count_on_archive' ) ) )
97
  ) {
98
  return '';
99
  }
@@ -121,7 +121,7 @@ class WCJ_Product_Listings extends WCJ_Module {
121
  if (
122
  is_product_category() &&
123
  get_option( 'woocommerce_category_archive_display' ) == 'subcategories' &&
124
- 'no' === get_option( 'wcj_product_listings_show_products_if_no_cats_on_archives' )
125
  ) {
126
  $wp_query->post_count = 0;
127
  $wp_query->max_num_pages = 0;
@@ -129,7 +129,7 @@ class WCJ_Product_Listings extends WCJ_Module {
129
  if (
130
  is_shop() &&
131
  get_option( 'woocommerce_shop_page_display' ) == 'subcategories' &&
132
- 'no' === get_option( 'wcj_product_listings_show_products_if_no_cats_on_shop' )
133
  ) {
134
  $wp_query->post_count = 0;
135
  $wp_query->max_num_pages = 0;
@@ -147,8 +147,8 @@ class WCJ_Product_Listings extends WCJ_Module {
147
  $this->hide_products_by_disabling_loop();
148
 
149
  $hide_empty = ( is_shop() ) ?
150
- ( 'yes' === get_option( 'wcj_product_listings_hide_empty_cats_on_shop', 'yes' ) ) :
151
- ( 'yes' === get_option( 'wcj_product_listings_hide_empty_cats_on_archives', 'yes' ) );
152
 
153
  return $hide_empty;
154
  }
37
  add_filter( 'woocommerce_product_subcategories_hide_empty', array( $this, 'filter_subcategories_hide_empty' ), 100 );
38
 
39
  // Hide Count
40
+ if ( 'yes' === wcj_get_option( 'wcj_product_listings_hide_cats_count_on_shop' ) || 'yes' === wcj_get_option( 'wcj_product_listings_hide_cats_count_on_archive' ) ) {
41
  add_filter( 'woocommerce_subcategory_count_html', array( $this, 'remove_subcategory_count' ), 100 );
42
  }
43
 
44
  // Product visibility by price
45
+ if ( 'yes' === wcj_get_option( 'wcj_product_listings_product_visibility_by_price_enabled', 'no' ) ) {
46
  add_filter( 'woocommerce_product_is_visible', array( $this, 'product_visibility_by_price' ), PHP_INT_MAX, 2 );
47
  }
48
 
49
  // Product visibility by category
50
+ $this->cats_products_to_hide_on_shop = wcj_get_option( 'wcj_product_listings_exclude_cats_products_on_shop', '' );
51
  if ( ! empty( $this->cats_products_to_hide_on_shop ) ) {
52
  add_filter( 'woocommerce_product_is_visible', array( $this, 'product_visibility_by_category' ), PHP_INT_MAX, 2 );
53
  }
82
  $min_price = $product->get_price();
83
  $max_price = $product->get_price();
84
  }
85
+ $min_price_limit = wcj_get_option( 'wcj_product_listings_product_visibility_by_price_min', 0 );
86
+ $max_price_limit = wcj_get_option( 'wcj_product_listings_product_visibility_by_price_max', 0 );
87
  return ( ( 0 != $min_price_limit && $min_price < $min_price_limit ) || ( 0 != $max_price_limit && $max_price > $max_price_limit ) ? false : $visible );
88
  }
89
 
92
  */
93
  function remove_subcategory_count( $count_html ) {
94
  if (
95
+ ( is_shop() && 'yes' === wcj_get_option( 'wcj_product_listings_hide_cats_count_on_shop' ) ) ||
96
+ ( ! is_shop() && 'yes' === apply_filters( 'booster_option', 'wcj', wcj_get_option( 'wcj_product_listings_hide_cats_count_on_archive' ) ) )
97
  ) {
98
  return '';
99
  }
121
  if (
122
  is_product_category() &&
123
  get_option( 'woocommerce_category_archive_display' ) == 'subcategories' &&
124
+ 'no' === wcj_get_option( 'wcj_product_listings_show_products_if_no_cats_on_archives' )
125
  ) {
126
  $wp_query->post_count = 0;
127
  $wp_query->max_num_pages = 0;
129
  if (
130
  is_shop() &&
131
  get_option( 'woocommerce_shop_page_display' ) == 'subcategories' &&
132
+ 'no' === wcj_get_option( 'wcj_product_listings_show_products_if_no_cats_on_shop' )
133
  ) {
134
  $wp_query->post_count = 0;
135
  $wp_query->max_num_pages = 0;
147
  $this->hide_products_by_disabling_loop();
148
 
149
  $hide_empty = ( is_shop() ) ?
150
+ ( 'yes' === wcj_get_option( 'wcj_product_listings_hide_empty_cats_on_shop', 'yes' ) ) :
151
+ ( 'yes' === wcj_get_option( 'wcj_product_listings_hide_empty_cats_on_archives', 'yes' ) );
152
 
153
  return $hide_empty;
154
  }
includes/class-wcj-product-msrp.php CHANGED
@@ -37,7 +37,7 @@ class WCJ_Product_MSRP extends WCJ_Module {
37
  parent::__construct();
38
 
39
  if ( $this->is_enabled() ) {
40
- if ( 'inline' === get_option( 'wcj_product_msrp_admin_view', 'inline' ) ) {
41
  // MSRP input on admin product page (simple product)
42
  add_action( 'woocommerce_product_options_pricing', array( $this, 'add_msrp_input' ) );
43
  add_action( 'save_post_product', array( $this, 'save_msrp_input' ), PHP_INT_MAX, 2 );
@@ -89,7 +89,7 @@ class WCJ_Product_MSRP extends WCJ_Module {
89
  * @return mixed
90
  */
91
  function make_wcj_msrp_price_compatible_with_3rd_party( $price, $product ) {
92
- if ( 'yes' !== get_option( 'wcj_payment_msrp_comp_mc', 'no' ) ) {
93
  return $price;
94
  }
95
  $module = 'multicurrency';
@@ -168,7 +168,7 @@ class WCJ_Product_MSRP extends WCJ_Module {
168
  * @return string
169
  */
170
  function get_section_id_by_template_path( $template ) {
171
- $archive_detection_method = $this->get_option( 'wcj_product_msrp_archive_detection_method', 'loop' );
172
  $archive_detection_method = array_values( array_filter( explode( PHP_EOL, $archive_detection_method ) ) );
173
  return count( array_filter( $archive_detection_method, function ( $item ) use ( $template ) {
174
  return strpos( $template, $item ) !== false;
@@ -185,13 +185,13 @@ class WCJ_Product_MSRP extends WCJ_Module {
185
  */
186
  function display( $price_html, $product ) {
187
  $section_id = $this->get_section_id_by_template_path( $this->current_template_path );
188
- $display = get_option( 'wcj_product_msrp_display_on_' . $section_id, 'show' );
189
  if ( 'hide' == $display ) {
190
  return $price_html;
191
  }
192
  $product_id = false;
193
  if ( $product->is_type( 'variable' ) && $product->get_variation_price( 'min' ) === $product->get_variation_price( 'max' ) ) {
194
- if ( 'yes' === get_option( 'wcj_product_msrp_variable_as_simple_enabled', 'no' ) ) {
195
  $product_id = wcj_get_product_id( $product );
196
  } else {
197
  foreach ( $product->get_available_variations() as $variation ) {
@@ -200,7 +200,7 @@ class WCJ_Product_MSRP extends WCJ_Module {
200
  break;
201
  }
202
  }
203
- } elseif ( $product->is_type( 'variation' ) && 'yes' === get_option( 'wcj_product_msrp_variable_as_simple_enabled', 'no' ) ) {
204
  return $price_html;
205
  }
206
 
@@ -211,7 +211,7 @@ class WCJ_Product_MSRP extends WCJ_Module {
211
  // MSRP
212
  $msrp_product_meta_name = '_wcj_msrp';
213
  if (
214
- 'yes' === get_option( 'wcj_product_msrp_archive_page_field', 'no' ) &&
215
  'archives' === $section_id
216
  ) {
217
  $product_id = wcj_get_product_id( $product );
@@ -237,20 +237,20 @@ class WCJ_Product_MSRP extends WCJ_Module {
237
  $math = new WCJ_Math();
238
 
239
  // You Save Formula
240
- $you_save_option = get_option( 'wcj_product_msrp_formula_you_save', '%msrp% - %product_price%' );
241
  $you_save_formula_result = $math->evaluate( str_replace( array( '%msrp%', '%product_price%' ), array( $msrp, $price ), $you_save_option ) );
242
 
243
  // You Save Percent Formula
244
- $you_save_percent_option = get_option( 'wcj_product_msrp_formula_you_save_percent', '(%msrp% - %product_price%) / %msrp% * 100' );
245
  $you_save_percent_formula_result = $math->evaluate( str_replace( array( '%msrp%', '%product_price%' ), array( $msrp, $price ), $you_save_percent_option ) );
246
 
247
- $position = get_option( 'wcj_product_msrp_display_on_' . $section_id . '_position', 'after_price' );
248
  $default_template = '<div class="price"><label for="wcj_product_msrp">MSRP</label>: <span id="wcj_product_msrp"><del>%msrp%</del>%you_save%</span></div>';
249
- $template = apply_filters( 'booster_option', $default_template, get_option( 'wcj_product_msrp_display_on_' . $section_id . '_template', $default_template ) );
250
  $diff = $msrp - ( float ) $price;
251
- $you_save = ( $diff > 0 ? get_option( 'wcj_product_msrp_display_on_' . $section_id . '_you_save', ' (%you_save_raw%)' ) : '' );
252
- $you_save_percent = ( $diff > 0 ? get_option( 'wcj_product_msrp_display_on_' . $section_id . '_you_save_percent', ' (%you_save_percent_raw% %)' ) : '' );
253
- $you_save_round = get_option( 'wcj_product_msrp_display_on_' . $section_id . '_you_save_percent_round', 0 );
254
  $replaced_values = array(
255
  '%msrp%' => wc_price( $msrp ),
256
  '%you_save%' => str_replace( '%you_save_raw%', wc_price( $you_save_formula_result ), $you_save ),
37
  parent::__construct();
38
 
39
  if ( $this->is_enabled() ) {
40
+ if ( 'inline' === wcj_get_option( 'wcj_product_msrp_admin_view', 'inline' ) ) {
41
  // MSRP input on admin product page (simple product)
42
  add_action( 'woocommerce_product_options_pricing', array( $this, 'add_msrp_input' ) );
43
  add_action( 'save_post_product', array( $this, 'save_msrp_input' ), PHP_INT_MAX, 2 );
89
  * @return mixed
90
  */
91
  function make_wcj_msrp_price_compatible_with_3rd_party( $price, $product ) {
92
+ if ( 'yes' !== wcj_get_option( 'wcj_payment_msrp_comp_mc', 'no' ) ) {
93
  return $price;
94
  }
95
  $module = 'multicurrency';
168
  * @return string
169
  */
170
  function get_section_id_by_template_path( $template ) {
171
+ $archive_detection_method = wcj_get_option( 'wcj_product_msrp_archive_detection_method', 'loop' );
172
  $archive_detection_method = array_values( array_filter( explode( PHP_EOL, $archive_detection_method ) ) );
173
  return count( array_filter( $archive_detection_method, function ( $item ) use ( $template ) {
174
  return strpos( $template, $item ) !== false;
185
  */
186
  function display( $price_html, $product ) {
187
  $section_id = $this->get_section_id_by_template_path( $this->current_template_path );
188
+ $display = wcj_get_option( 'wcj_product_msrp_display_on_' . $section_id, 'show' );
189
  if ( 'hide' == $display ) {
190
  return $price_html;
191
  }
192
  $product_id = false;
193
  if ( $product->is_type( 'variable' ) && $product->get_variation_price( 'min' ) === $product->get_variation_price( 'max' ) ) {
194
+ if ( 'yes' === wcj_get_option( 'wcj_product_msrp_variable_as_simple_enabled', 'no' ) ) {
195
  $product_id = wcj_get_product_id( $product );
196
  } else {
197
  foreach ( $product->get_available_variations() as $variation ) {
200
  break;
201
  }
202
  }
203
+ } elseif ( $product->is_type( 'variation' ) && 'yes' === wcj_get_option( 'wcj_product_msrp_variable_as_simple_enabled', 'no' ) ) {
204
  return $price_html;
205
  }
206
 
211
  // MSRP
212
  $msrp_product_meta_name = '_wcj_msrp';
213
  if (
214
+ 'yes' === wcj_get_option( 'wcj_product_msrp_archive_page_field', 'no' ) &&
215
  'archives' === $section_id
216
  ) {
217
  $product_id = wcj_get_product_id( $product );
237
  $math = new WCJ_Math();
238
 
239
  // You Save Formula
240
+ $you_save_option = wcj_get_option( 'wcj_product_msrp_formula_you_save', '%msrp% - %product_price%' );
241
  $you_save_formula_result = $math->evaluate( str_replace( array( '%msrp%', '%product_price%' ), array( $msrp, $price ), $you_save_option ) );
242
 
243
  // You Save Percent Formula
244
+ $you_save_percent_option = wcj_get_option( 'wcj_product_msrp_formula_you_save_percent', '(%msrp% - %product_price%) / %msrp% * 100' );
245
  $you_save_percent_formula_result = $math->evaluate( str_replace( array( '%msrp%', '%product_price%' ), array( $msrp, $price ), $you_save_percent_option ) );
246
 
247
+ $position = wcj_get_option( 'wcj_product_msrp_display_on_' . $section_id . '_position', 'after_price' );
248
  $default_template = '<div class="price"><label for="wcj_product_msrp">MSRP</label>: <span id="wcj_product_msrp"><del>%msrp%</del>%you_save%</span></div>';
249
+ $template = apply_filters( 'booster_option', $default_template, wcj_get_option( 'wcj_product_msrp_display_on_' . $section_id . '_template', $default_template ) );
250
  $diff = $msrp - ( float ) $price;
251
+ $you_save = ( $diff > 0 ? wcj_get_option( 'wcj_product_msrp_display_on_' . $section_id . '_you_save', ' (%you_save_raw%)' ) : '' );
252
+ $you_save_percent = ( $diff > 0 ? wcj_get_option( 'wcj_product_msrp_display_on_' . $section_id . '_you_save_percent', ' (%you_save_percent_raw% %)' ) : '' );
253
+ $you_save_round = wcj_get_option( 'wcj_product_msrp_display_on_' . $section_id . '_you_save_percent_round', 0 );
254
  $replaced_values = array(
255
  '%msrp%' => wc_price( $msrp ),
256
  '%you_save%' => str_replace( '%you_save_raw%', wc_price( $you_save_formula_result ), $you_save ),
includes/class-wcj-product-open-pricing.php CHANGED
@@ -34,14 +34,14 @@ class WCJ_Product_Open_Pricing extends WCJ_Module {
34
  add_filter( 'woocommerce_product_variation_get_price',array( $this, 'get_open_price' ), PHP_INT_MAX, 2 );
35
  add_filter( 'woocommerce_get_price_html', array( $this, 'hide_original_price' ), PHP_INT_MAX, 2 );
36
  add_filter( 'woocommerce_get_variation_price_html', array( $this, 'hide_original_price' ), PHP_INT_MAX, 2 );
37
- if ( 'yes' === get_option( 'wcj_product_open_price_disable_quantity', 'yes' ) ) {
38
  add_filter( 'woocommerce_is_sold_individually', array( $this, 'hide_quantity_input_field' ), PHP_INT_MAX, 2 );
39
  }
40
  add_filter( 'woocommerce_is_purchasable', array( $this, 'is_purchasable' ), PHP_INT_MAX, 2 );
41
  add_filter( 'woocommerce_product_supports', array( $this, 'disable_add_to_cart_ajax' ), PHP_INT_MAX, 3 );
42
  add_filter( 'woocommerce_product_add_to_cart_url', array( $this, 'add_to_cart_url' ), PHP_INT_MAX, 2 );
43
  add_filter( 'woocommerce_product_add_to_cart_text', array( $this, 'add_to_cart_text' ), PHP_INT_MAX, 2 );
44
- $position = get_option( 'wcj_product_open_price_position', 'woocommerce_before_add_to_cart_button' );
45
  add_action( $position, array( $this, 'add_open_price_input_field_to_frontend' ), PHP_INT_MAX );
46
  add_filter( 'woocommerce_add_to_cart_validation', array( $this, 'validate_open_price_on_add_to_cart' ), PHP_INT_MAX, 2 );
47
  add_filter( 'woocommerce_add_cart_item_data', array( $this, 'add_open_price_to_cart_item_data' ), PHP_INT_MAX, 3 );
@@ -49,19 +49,19 @@ class WCJ_Product_Open_Pricing extends WCJ_Module {
49
  add_filter( 'woocommerce_get_cart_item_from_session', array( $this, 'get_cart_item_open_price_from_session' ), PHP_INT_MAX, 3 );
50
  add_filter( 'wcj_save_meta_box_value', array( $this, 'save_meta_box_value' ), PHP_INT_MAX, 3 );
51
  add_action( 'admin_notices', array( $this, 'admin_notices' ) );
52
- if ( 'yes' === get_option( 'wcj_product_open_price_enable_loop_price_info', 'no' ) ) {
53
- $this->loop_price_info_template = get_option( 'wcj_product_open_price_loop_price_info_template', '<span class="price">%default_price%</span>' );
54
  add_action( 'woocommerce_after_shop_loop_item_title', array( $this, 'add_price_info_to_loop' ), 10 );
55
  }
56
- if ( is_admin() && 'yes' === get_option( 'wcj_product_open_price_enable_admin_product_list_column', 'no' ) ) {
57
  add_filter( 'manage_edit-product_columns', array( $this, 'add_product_column_open_pricing' ), PHP_INT_MAX );
58
  add_action( 'manage_product_posts_custom_column', array( $this, 'render_product_column_open_pricing' ), PHP_INT_MAX );
59
  }
60
- $this->shop_currency = get_option( 'woocommerce_currency' );
61
 
62
  // WPC Product Bundles plugin
63
  add_action( 'woocommerce_init', function () {
64
- if ( 'yes' === get_option( 'wcj_product_open_price_woosb_product_bundles_remove_atc', 'no' ) ) {
65
  wcj_remove_class_filter( 'woocommerce_add_to_cart', 'WPcleverWoosb', 'woosb_add_to_cart' );
66
  }
67
  }, 99 );
@@ -101,7 +101,7 @@ class WCJ_Product_Open_Pricing extends WCJ_Module {
101
  * @since 4.2.0
102
  */
103
  function maybe_convert_price_currency( $price, $product = null ) {
104
- if ( 'switched_currency' === get_option( 'wcj_product_open_price_currency_switcher', 'shop_currency' ) ) {
105
  // Multicurrency (Currency Switcher) module
106
  if ( WCJ()->modules['multicurrency']->is_enabled() ) {
107
  $price = WCJ()->modules['multicurrency']->change_price( $price, $product );
@@ -117,7 +117,7 @@ class WCJ_Product_Open_Pricing extends WCJ_Module {
117
  * @since 4.1.0
118
  */
119
  function wc_price_shop_currency( $price, $args = array() ) {
120
- $args['currency'] = ( 'shop_currency' === get_option( 'wcj_product_open_price_currency_switcher', 'shop_currency' ) ? $this->shop_currency : get_woocommerce_currency() );
121
  return wc_price( $price, $args );
122
  }
123
 
@@ -299,11 +299,11 @@ class WCJ_Product_Open_Pricing extends WCJ_Module {
299
  */
300
  function get_open_price( $price, $_product ) {
301
  if ( $this->is_open_price_product( $_product ) && isset( $_product->wcj_open_price ) ) {
302
- if ( 'no' === get_option( 'wcj_product_open_price_woosb_product_bundles_replace_prices', 'no' ) && 'WC_Product_Woosb' === get_class( $_product ) ) {
303
  // "WPC Product Bundles for WooCommerce" plugin
304
  return $price;
305
  }
306
- if ( 'yes' === get_option( 'wcj_product_open_price_check_for_product_changes_price', 'no' ) ) {
307
  $product_changes = $_product->get_changes();
308
  if ( ! empty( $product_changes ) && isset( $product_changes['price'] ) ) {
309
  return $price;
@@ -331,7 +331,7 @@ class WCJ_Product_Open_Pricing extends WCJ_Module {
331
  if ( $this->is_open_price_product( $the_product ) ) {
332
  // Empty price
333
  if ( ! isset( $_POST['wcj_open_price'] ) || '' === $_POST['wcj_open_price'] ) {
334
- wc_add_notice( get_option( 'wcj_product_open_price_messages_required', __( 'Price is required!', 'woocommerce-jetpack' ) ), 'error' );
335
  return false;
336
  }
337
  // Min & Max
@@ -372,7 +372,7 @@ class WCJ_Product_Open_Pricing extends WCJ_Module {
372
  function add_open_price_to_cart_item_data( $cart_item_data, $product_id, $variation_id ) {
373
  if ( isset( $_POST['wcj_open_price'] ) ) {
374
  $cart_item_data['wcj_open_price'] = $_POST['wcj_open_price'];
375
- if ( 'no' != ( $product_bundles_divide = get_option( 'wcj_product_open_price_woosb_product_bundles_divide', 'no' ) ) ) {
376
  // "WPC Product Bundles for WooCommerce" plugin
377
  if ( ! empty( $cart_item_data['woosb_parent_id'] ) ) {
378
  $parent_product = wc_get_product( $cart_item_data['woosb_parent_id'] );
@@ -396,7 +396,7 @@ class WCJ_Product_Open_Pricing extends WCJ_Module {
396
  }
397
  }
398
  }
399
- if ( 'switched_currency' === get_option( 'wcj_product_open_price_currency_switcher', 'shop_currency' ) ) {
400
  // Multicurrency (Currency Switcher) module
401
  if ( WCJ()->modules['multicurrency']->is_enabled() ) {
402
  if ( $this->shop_currency != ( $current_currency = WCJ()->modules['multicurrency']->get_current_currency_code() ) ) {
@@ -430,13 +430,13 @@ class WCJ_Product_Open_Pricing extends WCJ_Module {
430
  * @since 2.4.8
431
  */
432
  function add_open_price_input_field_to_frontend() {
433
- if ( isset( $this->is_open_price_input_field_displayed ) && 'yes' === get_option( 'wcj_product_open_price_check_for_outputted_data', 'yes' ) ) {
434
  return;
435
  }
436
  $the_product = wc_get_product();
437
  if ( $this->is_open_price_product( $the_product ) ) {
438
  // Title
439
- $title = get_option( 'wcj_product_open_price_label_frontend', __( 'Name Your Price', 'woocommerce-jetpack' ) );
440
  // Prices
441
  $_product_id = wcj_get_product_id_or_variation_parent_id( $the_product );
442
  $min_price = $this->maybe_convert_price_currency( get_post_meta( $_product_id, '_' . 'wcj_product_open_price_min_price', true ) );
@@ -444,23 +444,23 @@ class WCJ_Product_Open_Pricing extends WCJ_Module {
444
  $default_price = $this->maybe_convert_price_currency( get_post_meta( $_product_id, '_' . 'wcj_product_open_price_default_price', true ) );
445
  // Input field
446
  $value = ( isset( $_POST['wcj_open_price'] ) ) ? $_POST['wcj_open_price'] : $default_price;
447
- $default_price_step = 1 / pow( 10, absint( get_option( 'woocommerce_price_num_decimals', 2 ) ) );
448
  $custom_attributes = '';
449
- $custom_attributes .= 'step="' . get_option( 'wcj_product_open_price_price_step', $default_price_step ) . '" ';
450
- $custom_attributes .= ( '' == $min_price || 'no' === get_option( 'wcj_product_open_price_enable_js_validation', 'no' ) ) ? 'min="0" ' : 'min="' . $min_price . '" ';
451
- $custom_attributes .= ( '' == $max_price || 'no' === get_option( 'wcj_product_open_price_enable_js_validation', 'no' ) ) ? '' : 'max="' . $max_price . '" ';
452
  $input_field = '<input '
453
  . 'type="number" '
454
  . 'class="text" '
455
- . 'style="' . get_option( 'wcj_product_open_price_input_style', 'width:75px;text-align:center;' ). '" '
456
  . 'name="wcj_open_price" '
457
  . 'id="wcj_open_price" '
458
- . 'placeholder="' . get_option( 'wcj_product_open_price_input_placeholder', '' ) . '" '
459
  . 'value="' . $value . '" '
460
  . $custom_attributes . '>';
461
  // Currency symbol
462
  $currency_symbol = get_woocommerce_currency_symbol(
463
- ( 'shop_currency' === get_option( 'wcj_product_open_price_currency_switcher', 'shop_currency' ) ? $this->shop_currency : '' ) );
464
  // Replacing final values
465
  $replacement_values = array(
466
  '%frontend_label%' => $title,
34
  add_filter( 'woocommerce_product_variation_get_price',array( $this, 'get_open_price' ), PHP_INT_MAX, 2 );
35
  add_filter( 'woocommerce_get_price_html', array( $this, 'hide_original_price' ), PHP_INT_MAX, 2 );
36
  add_filter( 'woocommerce_get_variation_price_html', array( $this, 'hide_original_price' ), PHP_INT_MAX, 2 );
37
+ if ( 'yes' === wcj_get_option( 'wcj_product_open_price_disable_quantity', 'yes' ) ) {
38
  add_filter( 'woocommerce_is_sold_individually', array( $this, 'hide_quantity_input_field' ), PHP_INT_MAX, 2 );
39
  }
40
  add_filter( 'woocommerce_is_purchasable', array( $this, 'is_purchasable' ), PHP_INT_MAX, 2 );
41
  add_filter( 'woocommerce_product_supports', array( $this, 'disable_add_to_cart_ajax' ), PHP_INT_MAX, 3 );
42
  add_filter( 'woocommerce_product_add_to_cart_url', array( $this, 'add_to_cart_url' ), PHP_INT_MAX, 2 );
43
  add_filter( 'woocommerce_product_add_to_cart_text', array( $this, 'add_to_cart_text' ), PHP_INT_MAX, 2 );
44
+ $position = wcj_get_option( 'wcj_product_open_price_position', 'woocommerce_before_add_to_cart_button' );
45
  add_action( $position, array( $this, 'add_open_price_input_field_to_frontend' ), PHP_INT_MAX );
46
  add_filter( 'woocommerce_add_to_cart_validation', array( $this, 'validate_open_price_on_add_to_cart' ), PHP_INT_MAX, 2 );
47
  add_filter( 'woocommerce_add_cart_item_data', array( $this, 'add_open_price_to_cart_item_data' ), PHP_INT_MAX, 3 );
49
  add_filter( 'woocommerce_get_cart_item_from_session', array( $this, 'get_cart_item_open_price_from_session' ), PHP_INT_MAX, 3 );
50
  add_filter( 'wcj_save_meta_box_value', array( $this, 'save_meta_box_value' ), PHP_INT_MAX, 3 );
51
  add_action( 'admin_notices', array( $this, 'admin_notices' ) );
52
+ if ( 'yes' === wcj_get_option( 'wcj_product_open_price_enable_loop_price_info', 'no' ) ) {
53
+ $this->loop_price_info_template = wcj_get_option( 'wcj_product_open_price_loop_price_info_template', '<span class="price">%default_price%</span>' );
54
  add_action( 'woocommerce_after_shop_loop_item_title', array( $this, 'add_price_info_to_loop' ), 10 );
55
  }
56
+ if ( is_admin() && 'yes' === wcj_get_option( 'wcj_product_open_price_enable_admin_product_list_column', 'no' ) ) {
57
  add_filter( 'manage_edit-product_columns', array( $this, 'add_product_column_open_pricing' ), PHP_INT_MAX );
58
  add_action( 'manage_product_posts_custom_column', array( $this, 'render_product_column_open_pricing' ), PHP_INT_MAX );
59
  }
60
+ $this->shop_currency = wcj_get_option( 'woocommerce_currency' );
61
 
62
  // WPC Product Bundles plugin
63
  add_action( 'woocommerce_init', function () {
64
+ if ( 'yes' === wcj_get_option( 'wcj_product_open_price_woosb_product_bundles_remove_atc', 'no' ) ) {
65
  wcj_remove_class_filter( 'woocommerce_add_to_cart', 'WPcleverWoosb', 'woosb_add_to_cart' );
66
  }
67
  }, 99 );
101
  * @since 4.2.0
102
  */
103
  function maybe_convert_price_currency( $price, $product = null ) {
104
+ if ( 'switched_currency' === wcj_get_option( 'wcj_product_open_price_currency_switcher', 'shop_currency' ) ) {
105
  // Multicurrency (Currency Switcher) module
106
  if ( WCJ()->modules['multicurrency']->is_enabled() ) {
107
  $price = WCJ()->modules['multicurrency']->change_price( $price, $product );
117
  * @since 4.1.0
118
  */
119
  function wc_price_shop_currency( $price, $args = array() ) {
120
+ $args['currency'] = ( 'shop_currency' === wcj_get_option( 'wcj_product_open_price_currency_switcher', 'shop_currency' ) ? $this->shop_currency : get_woocommerce_currency() );
121
  return wc_price( $price, $args );
122
  }
123
 
299
  */
300
  function get_open_price( $price, $_product ) {
301
  if ( $this->is_open_price_product( $_product ) && isset( $_product->wcj_open_price ) ) {
302
+ if ( 'no' === wcj_get_option( 'wcj_product_open_price_woosb_product_bundles_replace_prices', 'no' ) && 'WC_Product_Woosb' === get_class( $_product ) ) {
303
  // "WPC Product Bundles for WooCommerce" plugin
304
  return $price;
305
  }
306
+ if ( 'yes' === wcj_get_option( 'wcj_product_open_price_check_for_product_changes_price', 'no' ) ) {
307
  $product_changes = $_product->get_changes();
308
  if ( ! empty( $product_changes ) && isset( $product_changes['price'] ) ) {
309
  return $price;
331
  if ( $this->is_open_price_product( $the_product ) ) {
332
  // Empty price
333
  if ( ! isset( $_POST['wcj_open_price'] ) || '' === $_POST['wcj_open_price'] ) {
334
+ wc_add_notice( wcj_get_option( 'wcj_product_open_price_messages_required', __( 'Price is required!', 'woocommerce-jetpack' ) ), 'error' );
335
  return false;
336
  }
337
  // Min & Max
372
  function add_open_price_to_cart_item_data( $cart_item_data, $product_id, $variation_id ) {
373
  if ( isset( $_POST['wcj_open_price'] ) ) {
374
  $cart_item_data['wcj_open_price'] = $_POST['wcj_open_price'];
375
+ if ( 'no' != ( $product_bundles_divide = wcj_get_option( 'wcj_product_open_price_woosb_product_bundles_divide', 'no' ) ) ) {
376
  // "WPC Product Bundles for WooCommerce" plugin
377
  if ( ! empty( $cart_item_data['woosb_parent_id'] ) ) {
378
  $parent_product = wc_get_product( $cart_item_data['woosb_parent_id'] );
396
  }
397
  }
398
  }
399
+ if ( 'switched_currency' === wcj_get_option( 'wcj_product_open_price_currency_switcher', 'shop_currency' ) ) {
400
  // Multicurrency (Currency Switcher) module
401
  if ( WCJ()->modules['multicurrency']->is_enabled() ) {
402
  if ( $this->shop_currency != ( $current_currency = WCJ()->modules['multicurrency']->get_current_currency_code() ) ) {
430
  * @since 2.4.8
431
  */
432
  function add_open_price_input_field_to_frontend() {
433
+ if ( isset( $this->is_open_price_input_field_displayed ) && 'yes' === wcj_get_option( 'wcj_product_open_price_check_for_outputted_data', 'yes' ) ) {
434
  return;
435
  }
436
  $the_product = wc_get_product();
437
  if ( $this->is_open_price_product( $the_product ) ) {
438
  // Title
439
+ $title = wcj_get_option( 'wcj_product_open_price_label_frontend', __( 'Name Your Price', 'woocommerce-jetpack' ) );
440
  // Prices
441
  $_product_id = wcj_get_product_id_or_variation_parent_id( $the_product );
442
  $min_price = $this->maybe_convert_price_currency( get_post_meta( $_product_id, '_' . 'wcj_product_open_price_min_price', true ) );
444
  $default_price = $this->maybe_convert_price_currency( get_post_meta( $_product_id, '_' . 'wcj_product_open_price_default_price', true ) );
445
  // Input field
446
  $value = ( isset( $_POST['wcj_open_price'] ) ) ? $_POST['wcj_open_price'] : $default_price;
447
+ $default_price_step = 1 / pow( 10, absint( wcj_get_option( 'woocommerce_price_num_decimals', 2 ) ) );
448
  $custom_attributes = '';
449
+ $custom_attributes .= 'step="' . wcj_get_option( 'wcj_product_open_price_price_step', $default_price_step ) . '" ';
450
+ $custom_attributes .= ( '' == $min_price || 'no' === wcj_get_option( 'wcj_product_open_price_enable_js_validation', 'no' ) ) ? 'min="0" ' : 'min="' . $min_price . '" ';
451
+ $custom_attributes .= ( '' == $max_price || 'no' === wcj_get_option( 'wcj_product_open_price_enable_js_validation', 'no' ) ) ? '' : 'max="' . $max_price . '" ';
452
  $input_field = '<input '
453
  . 'type="number" '
454
  . 'class="text" '
455
+ . 'style="' . wcj_get_option( 'wcj_product_open_price_input_style', 'width:75px;text-align:center;' ). '" '
456
  . 'name="wcj_open_price" '
457
  . 'id="wcj_open_price" '
458
+ . 'placeholder="' . wcj_get_option( 'wcj_product_open_price_input_placeholder', '' ) . '" '
459
  . 'value="' . $value . '" '
460
  . $custom_attributes . '>';
461
  // Currency symbol
462
  $currency_symbol = get_woocommerce_currency_symbol(
463
+ ( 'shop_currency' === wcj_get_option( 'wcj_product_open_price_currency_switcher', 'shop_currency' ) ? $this->shop_currency : '' ) );
464
  // Replacing final values
465
  $replacement_values = array(
466
  '%frontend_label%' => $title,
includes/class-wcj-product-price-by-formula.php CHANGED
@@ -36,8 +36,8 @@ class WCJ_Product_Price_by_Formula extends WCJ_Module {
36
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
37
 
38
  if (
39
- ( wcj_is_frontend() && "yes" === get_option( 'wcj_product_price_by_formula_admin_scope', 'yes' ) ) ||
40
- ( "no" === get_option( 'wcj_product_price_by_formula_admin_scope', 'yes' ) && ( wcj_is_frontend() || is_admin() ) ) ||
41
  isset( $_GET['wcj_create_products_xml'] )
42
  ) {
43
  wcj_add_change_price_hooks( $this, wcj_get_module_price_hooks_priority( 'product_price_by_formula' ), false );
@@ -46,8 +46,8 @@ class WCJ_Product_Price_by_Formula extends WCJ_Module {
46
  add_filter( 'wcj_save_meta_box_value', array( $this, 'save_meta_box_value' ), PHP_INT_MAX, 3 );
47
  add_action( 'admin_notices', array( $this, 'admin_notices' ) );
48
 
49
- $this->rounding = get_option( 'wcj_product_price_by_formula_rounding', 'no_rounding' );
50
- $this->rounding_precision = get_option( 'wcj_product_price_by_formula_rounding_precision', 0 );
51
  }
52
  }
53
 
@@ -95,7 +95,7 @@ class WCJ_Product_Price_by_Formula extends WCJ_Module {
95
  && $this->id === $_GET['wcj_reset_settings']
96
  && wcj_is_user_role( 'administrator' )
97
  && ! isset( $_POST['save'] )
98
- && 'yes' == get_option( 'wcj_product_price_by_formula_reset_products', 'no' )
99
  ) {
100
  global $wpdb;
101
  $prefix = '_wcj_product_price_by_formula';
@@ -159,7 +159,7 @@ class WCJ_Product_Price_by_Formula extends WCJ_Module {
159
  * @return bool
160
  */
161
  function save_price( $product_id, $price ) {
162
- if ( 'no' === $this->get_option( 'wcj_product_price_by_formula_save_prices', 'no' ) ) {
163
  return false;
164
  }
165
  $filter = current_filter();
@@ -178,7 +178,7 @@ class WCJ_Product_Price_by_Formula extends WCJ_Module {
178
  * @return bool
179
  */
180
  function get_saved_price( $product_id ) {
181
- if ( 'no' === $this->get_option( 'wcj_product_price_by_formula_save_prices', 'no' ) ) {
182
  return false;
183
  }
184
  $filter = current_filter();
@@ -207,12 +207,12 @@ class WCJ_Product_Price_by_Formula extends WCJ_Module {
207
  $is_per_product = ( 'per_product' === get_post_meta( $_product_id, '_' . 'wcj_product_price_by_formula_calculation', true ) );
208
  $the_formula = ( $is_per_product )
209
  ? get_post_meta( $_product_id, '_' . 'wcj_product_price_by_formula_eval', true )
210
- : get_option( 'wcj_product_price_by_formula_eval', '' );
211
  $the_formula = do_shortcode( $the_formula );
212
  if ( '' != $the_formula ) {
213
  $total_params = ( $is_per_product )
214
  ? get_post_meta( $_product_id, '_' . 'wcj_product_price_by_formula_total_params', true )
215
- : get_option( 'wcj_product_price_by_formula_total_params', 1 );
216
  if ( $total_params > 0 ) {
217
  $the_current_filter = current_filter();
218
  if ( 'woocommerce_get_price_including_tax' == $the_current_filter || 'woocommerce_get_price_excluding_tax' == $the_current_filter ) {
@@ -225,7 +225,7 @@ class WCJ_Product_Price_by_Formula extends WCJ_Module {
225
  for ( $i = 1; $i <= $total_params; $i++ ) {
226
  $the_param = ( $is_per_product )
227
  ? get_post_meta( $_product_id, '_' . 'wcj_product_price_by_formula_param_' . $i, true )
228
- : get_option( 'wcj_product_price_by_formula_param_' . $i, '' );
229
  $the_param = $this->add_product_id_param( $the_param, $_product );
230
  $the_param = do_shortcode( $the_param );
231
  if ( '' != $the_param ) {
@@ -259,11 +259,11 @@ class WCJ_Product_Price_by_Formula extends WCJ_Module {
259
  */
260
  function get_variation_prices_hash( $price_hash, $_product, $display ) {
261
  if ( $this->is_price_by_formula_product( $_product ) ) {
262
- $the_formula = get_option( 'wcj_product_price_by_formula_eval', '' );
263
  $total_params = get_post_meta( wcj_get_product_id_or_variation_parent_id( $_product ), '_' . 'wcj_product_price_by_formula_total_params', true );
264
  $the_params = array();
265
  for ( $i = 1; $i <= $total_params; $i++ ) {
266
- $the_params[] = get_option( 'wcj_product_price_by_formula_param_' . $i, '' );
267
  }
268
  $price_hash['wcj_price_by_formula'] = array(
269
  'formula' => $the_formula,
@@ -344,7 +344,7 @@ class WCJ_Product_Price_by_Formula extends WCJ_Module {
344
  */
345
  function is_price_by_formula_product( $_product ) {
346
  return (
347
- 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_product_price_by_formula_enable_for_all_products', 'no' ) ) ||
348
  'yes' === get_post_meta( wcj_get_product_id_or_variation_parent_id( $_product ), '_' . 'wcj_product_price_by_formula_enabled', true )
349
  );
350
  }
@@ -362,7 +362,7 @@ class WCJ_Product_Price_by_Formula extends WCJ_Module {
362
  $the_product = wc_get_product();
363
  if ( $this->is_price_by_formula_product( $the_product ) ) {
364
  $the_price = $the_product->get_price();
365
- if ( "yes" === get_option( 'wcj_product_price_by_formula_admin_scope', 'yes' ) ) {
366
  $the_price = $this->change_price( $the_price, $the_product, true );
367
  }
368
  echo '<h4>' . __( 'Final Price Preview', 'woocommerce-jetpack' ) . '</h4>';
36
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
37
 
38
  if (
39
+ ( wcj_is_frontend() && "yes" === wcj_get_option( 'wcj_product_price_by_formula_admin_scope', 'yes' ) ) ||
40
+ ( "no" === wcj_get_option( 'wcj_product_price_by_formula_admin_scope', 'yes' ) && ( wcj_is_frontend() || is_admin() ) ) ||
41
  isset( $_GET['wcj_create_products_xml'] )
42
  ) {
43
  wcj_add_change_price_hooks( $this, wcj_get_module_price_hooks_priority( 'product_price_by_formula' ), false );
46
  add_filter( 'wcj_save_meta_box_value', array( $this, 'save_meta_box_value' ), PHP_INT_MAX, 3 );
47
  add_action( 'admin_notices', array( $this, 'admin_notices' ) );
48
 
49
+ $this->rounding = wcj_get_option( 'wcj_product_price_by_formula_rounding', 'no_rounding' );
50
+ $this->rounding_precision = wcj_get_option( 'wcj_product_price_by_formula_rounding_precision', 0 );
51
  }
52
  }
53
 
95
  && $this->id === $_GET['wcj_reset_settings']
96
  && wcj_is_user_role( 'administrator' )
97
  && ! isset( $_POST['save'] )
98
+ && 'yes' == wcj_get_option( 'wcj_product_price_by_formula_reset_products', 'no' )
99
  ) {
100
  global $wpdb;
101
  $prefix = '_wcj_product_price_by_formula';
159
  * @return bool
160
  */
161
  function save_price( $product_id, $price ) {
162
+ if ( 'no' === wcj_get_option( 'wcj_product_price_by_formula_save_prices', 'no' ) ) {
163
  return false;
164
  }
165
  $filter = current_filter();
178
  * @return bool
179
  */
180
  function get_saved_price( $product_id ) {
181
+ if ( 'no' === wcj_get_option( 'wcj_product_price_by_formula_save_prices', 'no' ) ) {
182
  return false;
183
  }
184
  $filter = current_filter();
207
  $is_per_product = ( 'per_product' === get_post_meta( $_product_id, '_' . 'wcj_product_price_by_formula_calculation', true ) );
208
  $the_formula = ( $is_per_product )
209
  ? get_post_meta( $_product_id, '_' . 'wcj_product_price_by_formula_eval', true )
210
+ : wcj_get_option( 'wcj_product_price_by_formula_eval', '' );
211
  $the_formula = do_shortcode( $the_formula );
212
  if ( '' != $the_formula ) {
213
  $total_params = ( $is_per_product )
214
  ? get_post_meta( $_product_id, '_' . 'wcj_product_price_by_formula_total_params', true )
215
+ : wcj_get_option( 'wcj_product_price_by_formula_total_params', 1 );
216
  if ( $total_params > 0 ) {
217
  $the_current_filter = current_filter();
218
  if ( 'woocommerce_get_price_including_tax' == $the_current_filter || 'woocommerce_get_price_excluding_tax' == $the_current_filter ) {
225
  for ( $i = 1; $i <= $total_params; $i++ ) {
226
  $the_param = ( $is_per_product )
227
  ? get_post_meta( $_product_id, '_' . 'wcj_product_price_by_formula_param_' . $i, true )
228
+ : wcj_get_option( 'wcj_product_price_by_formula_param_' . $i, '' );
229
  $the_param = $this->add_product_id_param( $the_param, $_product );
230
  $the_param = do_shortcode( $the_param );
231
  if ( '' != $the_param ) {
259
  */
260
  function get_variation_prices_hash( $price_hash, $_product, $display ) {
261
  if ( $this->is_price_by_formula_product( $_product ) ) {
262
+ $the_formula = wcj_get_option( 'wcj_product_price_by_formula_eval', '' );
263
  $total_params = get_post_meta( wcj_get_product_id_or_variation_parent_id( $_product ), '_' . 'wcj_product_price_by_formula_total_params', true );
264
  $the_params = array();
265
  for ( $i = 1; $i <= $total_params; $i++ ) {
266
+ $the_params[] = wcj_get_option( 'wcj_product_price_by_formula_param_' . $i, '' );
267
  }
268
  $price_hash['wcj_price_by_formula'] = array(
269
  'formula' => $the_formula,
344
  */
345
  function is_price_by_formula_product( $_product ) {
346
  return (
347
+ 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_product_price_by_formula_enable_for_all_products', 'no' ) ) ||
348
  'yes' === get_post_meta( wcj_get_product_id_or_variation_parent_id( $_product ), '_' . 'wcj_product_price_by_formula_enabled', true )
349
  );
350
  }
362
  $the_product = wc_get_product();
363
  if ( $this->is_price_by_formula_product( $the_product ) ) {
364
  $the_price = $the_product->get_price();
365
+ if ( "yes" === wcj_get_option( 'wcj_product_price_by_formula_admin_scope', 'yes' ) ) {
366
  $the_price = $this->change_price( $the_price, $the_product, true );
367
  }
368
  echo '<h4>' . __( 'Final Price Preview', 'woocommerce-jetpack' ) . '</h4>';
includes/class-wcj-product-tabs.php CHANGED
@@ -30,10 +30,10 @@ class WCJ_Product_Tabs extends WCJ_Module {
30
  if ( $this->is_enabled() ) {
31
  add_action( 'wp_head', array( $this, 'maybe_add_js_links' ) );
32
  add_filter( 'woocommerce_product_tabs', array( $this, 'customize_product_tabs' ), 98 );
33
- if ( 'yes' === get_option( 'wcj_custom_product_tabs_local_enabled', 'yes' ) ) {
34
  add_action( 'add_meta_boxes', array( $this, 'add_custom_tabs_meta_box' ) );
35
  add_action( 'save_post_product', array( $this, 'save_custom_tabs_meta_box' ), 100, 2 );
36
- if ( 'yes' === get_option( 'wcj_custom_product_tabs_yoast_seo_enabled', 'no' ) ) {
37
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
38
  }
39
  }
@@ -81,32 +81,32 @@ class WCJ_Product_Tabs extends WCJ_Module {
81
  function customize_default_tabs( $tabs ) {
82
 
83
  // Unset
84
- if ( 'yes' === get_option( 'wcj_product_info_product_tabs_description_disable', 'no' ) ) {
85
  unset( $tabs['description'] );
86
  }
87
- if ( 'yes' === get_option( 'wcj_product_info_product_tabs_reviews_disable', 'no' ) ) {
88
  unset( $tabs['reviews'] );
89
  }
90
- if ( 'yes' === get_option( 'wcj_product_info_product_tabs_additional_information_disable', 'no' ) ) {
91
  unset( $tabs['additional_information'] );
92
  }
93
 
94
  // Priority and Title
95
  if ( isset( $tabs['description'] ) ) {
96
- $tabs['description']['priority'] = apply_filters( 'booster_option', 10, get_option( 'wcj_product_info_product_tabs_description_priority', 10 ) );
97
- if ( '' != ( $title = get_option( 'wcj_product_info_product_tabs_description_title', '' ) ) ) {
98
  $tabs['description']['title'] = $title;
99
  }
100
  }
101
  if ( isset( $tabs['additional_information'] ) ) {
102
- $tabs['additional_information']['priority'] = apply_filters( 'booster_option', 20, get_option( 'wcj_product_info_product_tabs_additional_information_priority', 20 ) );
103
- if ( '' != ( $title = get_option( 'wcj_product_info_product_tabs_additional_information_title', '' ) ) ) {
104
  $tabs['additional_information']['title'] = $title;
105
  }
106
  }
107
  if ( isset( $tabs['reviews'] ) ) {
108
- $tabs['reviews']['priority'] = apply_filters( 'booster_option', 30, get_option( 'wcj_product_info_product_tabs_reviews_priority', 30 ) );
109
- if ( '' != ( $title = get_option( 'wcj_product_info_product_tabs_reviews_title', '' ) ) ) {
110
  $tabs['reviews']['title'] = $title;
111
  }
112
  }
@@ -134,7 +134,7 @@ class WCJ_Product_Tabs extends WCJ_Module {
134
  ! empty( $curr_language_product_id = icl_object_id( $product_id, 'product', true ) )
135
  ) {
136
  // Try to get title from wp_options first, like 'wcj_custom_product_tabs_title_local_default_1'
137
- $title_option = get_option( 'wcj_custom_product_tabs_title_' . 'local_default_' . $i, true );
138
  $title = ! empty( $title_option ) ? $title_option : $title;
139
 
140
  // Overwrite by post meta if there is any
@@ -154,11 +154,11 @@ class WCJ_Product_Tabs extends WCJ_Module {
154
  function add_custom_product_tabs( $scope, $tabs, $product_id ) {
155
  switch ( $scope ) {
156
  case 'global':
157
- $total_custom_tabs = apply_filters( 'booster_option', 1, get_option( 'wcj_custom_product_tabs_global_total_number', 1 ) );
158
  break;
159
  default: // 'local'
160
  if ( ! ( $total_custom_tabs = get_post_meta( $product_id, '_' . 'wcj_custom_product_tabs_local_total_number', true ) ) ) {
161
- $total_custom_tabs = apply_filters( 'booster_option', 1, get_option( 'wcj_custom_product_tabs_local_total_number_default', 1 ) );
162
  }
163
  break;
164
  }
@@ -168,10 +168,10 @@ class WCJ_Product_Tabs extends WCJ_Module {
168
  $option_key = $scope . '_' . $i;
169
  switch ( $scope ) {
170
  case 'global':
171
- $title = get_option( 'wcj_custom_product_tabs_title_' . $option_key, '' );
172
- $content = get_option( 'wcj_custom_product_tabs_content_' . $option_key, '' );
173
- $priority = get_option( 'wcj_custom_product_tabs_priority_' . $option_key, 40 );
174
- $link = get_option( 'wcj_custom_product_tabs_link_' . $option_key, '' );
175
  break;
176
  default: // 'local'
177
  $title = $this->get_local_title( $product_id, $option_key, $i );
@@ -211,12 +211,12 @@ class WCJ_Product_Tabs extends WCJ_Module {
211
  $tabs = $this->customize_default_tabs( $tabs );
212
 
213
  // Custom Tabs - Global
214
- if ( 'yes' === get_option( 'wcj_custom_product_tabs_global_enabled', 'yes' ) ) {
215
  $tabs = $this->add_custom_product_tabs( 'global', $tabs, $product_id );
216
  }
217
 
218
  // Custom Tabs - Local
219
- if ( 'yes' === get_option( 'wcj_custom_product_tabs_local_enabled', 'yes' ) ) {
220
  $tabs = $this->add_custom_product_tabs( 'local', $tabs, $product_id );
221
  }
222
 
@@ -232,9 +232,9 @@ class WCJ_Product_Tabs extends WCJ_Module {
232
  function is_global_tab_visible( $i, $_product_id ) {
233
 
234
  // Exclude by product id
235
- $array_to_exclude = get_option( 'wcj_custom_product_tabs_global_hide_in_products_' . $i );
236
  if ( '' == $array_to_exclude || empty( $array_to_exclude ) ) {
237
- $list_to_exclude = get_option( 'wcj_custom_product_tabs_title_global_hide_in_product_ids_' . $i );
238
  if ( '' != $list_to_exclude ) {
239
  $array_to_exclude = explode( ',', $list_to_exclude );
240
  }
@@ -246,9 +246,9 @@ class WCJ_Product_Tabs extends WCJ_Module {
246
  }
247
 
248
  // Exclude by product category
249
- $array_to_exclude = get_option( 'wcj_custom_product_tabs_global_hide_in_cats_' . $i );
250
  if ( '' == $array_to_exclude || empty( $array_to_exclude ) ) {
251
- $list_to_exclude = get_option( 'wcj_custom_product_tabs_title_global_hide_in_cats_ids_' . $i );
252
  if ( '' != $list_to_exclude ) {
253
  $array_to_exclude = explode( ',', $list_to_exclude );
254
  }
@@ -270,7 +270,7 @@ class WCJ_Product_Tabs extends WCJ_Module {
270
  }
271
 
272
  // Exclude by product tag
273
- $array_to_exclude = get_option( 'wcj_custom_product_tabs_global_hide_in_tags_' . $i );
274
  if ( '' != $array_to_exclude && ! empty( $array_to_exclude ) ) {
275
  $do_exclude = false;
276
  $product_tags_objects = get_the_terms( $_product_id, 'product_tag' );
@@ -288,9 +288,9 @@ class WCJ_Product_Tabs extends WCJ_Module {
288
  }
289
 
290
  // Include by product id
291
- $array_to_include = get_option( 'wcj_custom_product_tabs_global_show_in_products_' . $i );
292
  if ( '' == $array_to_include || empty( $array_to_include ) ) {
293
- $list_to_include = get_option( 'wcj_custom_product_tabs_title_global_show_in_product_ids_' . $i );
294
  if ( '' != $list_to_include ) {
295
  $array_to_include = explode( ',', $list_to_include );
296
  }
@@ -303,9 +303,9 @@ class WCJ_Product_Tabs extends WCJ_Module {
303
  }
304
 
305
  // Include by product category
306
- $array_to_include = get_option( 'wcj_custom_product_tabs_global_show_in_cats_' . $i );
307
  if ( '' == $array_to_include || empty( $array_to_include ) ) {
308
- $list_to_include = get_option( 'wcj_custom_product_tabs_title_global_show_in_cats_ids_' . $i );
309
  if ( '' != $list_to_include ) {
310
  $array_to_include = explode( ',', $list_to_include );
311
  }
@@ -327,7 +327,7 @@ class WCJ_Product_Tabs extends WCJ_Module {
327
  }
328
 
329
  // Include by product tag
330
- $array_to_include = get_option( 'wcj_custom_product_tabs_global_show_in_tags_' . $i );
331
  if ( '' != $array_to_include && ! empty( $array_to_include ) ) {
332
  $do_include = false;
333
  $product_tags_objects = get_the_terms( $_product_id, 'product_tag' );
@@ -356,7 +356,7 @@ class WCJ_Product_Tabs extends WCJ_Module {
356
  function is_local_tab_visible( $custom_tab_index, $product_id ) {
357
 
358
  // Exclude by product id
359
- $array_to_exclude = get_option( 'wcj_custom_product_tabs_local_hide_in_products_' . $custom_tab_index );
360
  if ( '' != $array_to_exclude && ! empty( $array_to_exclude ) ) {
361
  if ( $array_to_exclude && in_array( $product_id, $array_to_exclude ) ) {
362
  return false;
@@ -364,7 +364,7 @@ class WCJ_Product_Tabs extends WCJ_Module {
364
  }
365
 
366
  // Exclude by product category
367
- $array_to_exclude = get_option( 'wcj_custom_product_tabs_local_hide_in_cats_' . $custom_tab_index );
368
  if ( '' != $array_to_exclude && ! empty( $array_to_exclude ) ) {
369
  $product_categories_objects = get_the_terms( $product_id, 'product_cat' );
370
  if ( $product_categories_objects && ! empty( $product_categories_objects ) ) {
@@ -377,7 +377,7 @@ class WCJ_Product_Tabs extends WCJ_Module {
377
  }
378
 
379
  // Exclude by product tag
380
- $array_to_exclude = get_option( 'wcj_custom_product_tabs_local_hide_in_tags_' . $custom_tab_index );
381
  if ( '' != $array_to_exclude && ! empty( $array_to_exclude ) ) {
382
  $product_tags_objects = get_the_terms( $product_id, 'product_tag' );
383
  if ( $product_tags_objects && ! empty( $product_tags_objects ) ) {
@@ -390,7 +390,7 @@ class WCJ_Product_Tabs extends WCJ_Module {
390
  }
391
 
392
  // Include by product id
393
- $array_to_include = get_option( 'wcj_custom_product_tabs_local_show_in_products_' . $custom_tab_index );
394
  if ( '' != $array_to_include && ! empty( $array_to_include ) ) {
395
  // If NOT in array then hide this tab for this product
396
  if ( $array_to_include && ! in_array( $product_id, $array_to_include ) ) {
@@ -399,7 +399,7 @@ class WCJ_Product_Tabs extends WCJ_Module {
399
  }
400
 
401
  // Include by product category
402
- $array_to_include = get_option( 'wcj_custom_product_tabs_local_show_in_cats_' . $custom_tab_index );
403
  if ( '' != $array_to_include && ! empty( $array_to_include ) ) {
404
  $do_include = false;
405
  $product_categories_objects = get_the_terms( $product_id, 'product_cat' );
@@ -417,7 +417,7 @@ class WCJ_Product_Tabs extends WCJ_Module {
417
  }
418
 
419
  // Include by product tag
420
- $array_to_include = get_option( 'wcj_custom_product_tabs_local_show_in_tags_' . $custom_tab_index );
421
  if ( '' != $array_to_include && ! empty( $array_to_include ) ) {
422
  $do_include = false;
423
  $product_tags_objects = get_the_terms( $product_id, 'product_tag' );
@@ -467,20 +467,20 @@ class WCJ_Product_Tabs extends WCJ_Module {
467
  function maybe_add_js_links() {
468
  $current_post_id = wcj_maybe_get_product_id_wpml( get_the_ID() );
469
  // Global tabs
470
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_custom_product_tabs_global_total_number', 1 ) ); $i++ ) {
471
  if ( $this->is_global_tab_visible( $i, $current_post_id ) ) {
472
  $key = 'global_' . $i;
473
- if ( '' != get_option( 'wcj_custom_product_tabs_title_' . $key, '' ) && '' != ( $link = get_option( 'wcj_custom_product_tabs_link_' . $key, '' ) ) ) {
474
- echo $this->get_js_link_script( $link, $this->get_tab_key( $key, 'global' ), get_option( 'wcj_custom_product_tabs_link_new_tab_' . $key, true ) );
475
  }
476
  }
477
  }
478
  // Local tabs
479
- if ( 'yes' !== get_option( 'wcj_custom_product_tabs_local_enabled', 'yes' ) ) {
480
  return;
481
  }
482
  if ( ! ( $total_custom_tabs = get_post_meta( $current_post_id, '_' . 'wcj_custom_product_tabs_local_total_number', true ) ) ) {
483
- $total_custom_tabs = apply_filters( 'booster_option', 1, get_option( 'wcj_custom_product_tabs_local_total_number_default', 1 ) );
484
  }
485
  for ( $i = 1; $i <= $total_custom_tabs; $i++ ) {
486
  if ( $this->is_local_tab_visible( $i, $current_post_id ) ) {
@@ -501,7 +501,7 @@ class WCJ_Product_Tabs extends WCJ_Module {
501
  * @since 3.4.5
502
  */
503
  function get_tab_output( $content ) {
504
- switch ( get_option( 'wcj_custom_product_tabs_general_content_processing', 'the_content' ) ) {
505
  case 'disabled':
506
  return $content;
507
  case 'do_shortcode':
@@ -526,7 +526,7 @@ class WCJ_Product_Tabs extends WCJ_Module {
526
  * @version 3.4.5
527
  */
528
  function create_new_custom_product_tab_global( $key, $tab ) {
529
- echo $this->get_tab_output( get_option( 'wcj_custom_product_tabs_content_' . $this->tab_option_keys['global'][ $key ] ) );
530
  }
531
 
532
  /**
@@ -550,7 +550,7 @@ class WCJ_Product_Tabs extends WCJ_Module {
550
  'wcj_custom_product_tabs_link_local_',
551
  'wcj_custom_product_tabs_link_new_tab_local_',
552
  );
553
- $default_total_custom_tabs = apply_filters( 'booster_option', 1, get_option( 'wcj_custom_product_tabs_local_total_number_default', 1 ) );
554
  $total_custom_tabs_before_saving = get_post_meta( $post_id, '_' . 'wcj_custom_product_tabs_local_total_number', true );
555
  $total_custom_tabs_before_saving = ( '' != $total_custom_tabs_before_saving ) ? $total_custom_tabs_before_saving : $default_total_custom_tabs;
556
  for ( $i = 1; $i <= $total_custom_tabs_before_saving; $i++ ) {
@@ -593,7 +593,7 @@ class WCJ_Product_Tabs extends WCJ_Module {
593
  $current_post_id = wcj_maybe_get_product_id_wpml( get_the_ID() );
594
  $option_name = 'wcj_custom_product_tabs_local_total_number';
595
  if ( ! ( $total_custom_tabs = get_post_meta( $current_post_id, '_' . $option_name, true ) ) )
596
- $total_custom_tabs = apply_filters( 'booster_option', 1, get_option( 'wcj_custom_product_tabs_local_total_number_default', 1 ) );
597
  $html = '';
598
 
599
  $is_disabled = apply_filters( 'booster_message', '', 'readonly_string' );
@@ -652,7 +652,7 @@ class WCJ_Product_Tabs extends WCJ_Module {
652
  ),
653
  ),
654
  );
655
- $enable_wp_editor = ( 'yes' === get_option( 'wcj_custom_product_tabs_local_wp_editor_enabled', 'yes' ) );
656
  for ( $i = 1; $i <= $total_custom_tabs; $i++ ) {
657
  $is_local_tab_visible = $this->is_local_tab_visible( $i, $current_post_id );
658
  $readonly = ( $is_local_tab_visible ) ? '' : ' readonly'; // not really used
@@ -664,7 +664,7 @@ class WCJ_Product_Tabs extends WCJ_Module {
664
  foreach ( $options as $option ) {
665
  $option_id = $option['id'] . $i;
666
  if ( ! ( $option_value = get_post_meta( $current_post_id, '_' . $option_id, true ) ) ) {
667
- $option_value = get_option( $option['id'] . 'default_' . $i, '' );
668
  if ( '' === $option_value && 'wcj_custom_product_tabs_priority_local_' === $option['id'] ) {
669
  $option_value = (50 + $i - 1);
670
  }
30
  if ( $this->is_enabled() ) {
31
  add_action( 'wp_head', array( $this, 'maybe_add_js_links' ) );
32
  add_filter( 'woocommerce_product_tabs', array( $this, 'customize_product_tabs' ), 98 );
33
+ if ( 'yes' === wcj_get_option( 'wcj_custom_product_tabs_local_enabled', 'yes' ) ) {
34
  add_action( 'add_meta_boxes', array( $this, 'add_custom_tabs_meta_box' ) );
35
  add_action( 'save_post_product', array( $this, 'save_custom_tabs_meta_box' ), 100, 2 );
36
+ if ( 'yes' === wcj_get_option( 'wcj_custom_product_tabs_yoast_seo_enabled', 'no' ) ) {
37
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
38
  }
39
  }
81
  function customize_default_tabs( $tabs ) {
82
 
83
  // Unset
84
+ if ( 'yes' === wcj_get_option( 'wcj_product_info_product_tabs_description_disable', 'no' ) ) {
85
  unset( $tabs['description'] );
86
  }
87
+ if ( 'yes' === wcj_get_option( 'wcj_product_info_product_tabs_reviews_disable', 'no' ) ) {
88
  unset( $tabs['reviews'] );
89
  }
90
+ if ( 'yes' === wcj_get_option( 'wcj_product_info_product_tabs_additional_information_disable', 'no' ) ) {
91
  unset( $tabs['additional_information'] );
92
  }
93
 
94
  // Priority and Title
95
  if ( isset( $tabs['description'] ) ) {
96
+ $tabs['description']['priority'] = apply_filters( 'booster_option', 10, wcj_get_option( 'wcj_product_info_product_tabs_description_priority', 10 ) );
97
+ if ( '' != ( $title = wcj_get_option( 'wcj_product_info_product_tabs_description_title', '' ) ) ) {
98
  $tabs['description']['title'] = $title;
99
  }
100
  }
101
  if ( isset( $tabs['additional_information'] ) ) {
102
+ $tabs['additional_information']['priority'] = apply_filters( 'booster_option', 20, wcj_get_option( 'wcj_product_info_product_tabs_additional_information_priority', 20 ) );
103
+ if ( '' != ( $title = wcj_get_option( 'wcj_product_info_product_tabs_additional_information_title', '' ) ) ) {
104
  $tabs['additional_information']['title'] = $title;
105
  }
106
  }
107
  if ( isset( $tabs['reviews'] ) ) {
108
+ $tabs['reviews']['priority'] = apply_filters( 'booster_option', 30, wcj_get_option( 'wcj_product_info_product_tabs_reviews_priority', 30 ) );
109
+ if ( '' != ( $title = wcj_get_option( 'wcj_product_info_product_tabs_reviews_title', '' ) ) ) {
110
  $tabs['reviews']['title'] = $title;
111
  }
112
  }
134
  ! empty( $curr_language_product_id = icl_object_id( $product_id, 'product', true ) )
135
  ) {
136
  // Try to get title from wp_options first, like 'wcj_custom_product_tabs_title_local_default_1'
137
+ $title_option = wcj_get_option( 'wcj_custom_product_tabs_title_' . 'local_default_' . $i, true );
138
  $title = ! empty( $title_option ) ? $title_option : $title;
139
 
140
  // Overwrite by post meta if there is any
154
  function add_custom_product_tabs( $scope, $tabs, $product_id ) {
155
  switch ( $scope ) {
156
  case 'global':
157
+ $total_custom_tabs = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_custom_product_tabs_global_total_number', 1 ) );
158
  break;
159
  default: // 'local'
160
  if ( ! ( $total_custom_tabs = get_post_meta( $product_id, '_' . 'wcj_custom_product_tabs_local_total_number', true ) ) ) {
161
+ $total_custom_tabs = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_custom_product_tabs_local_total_number_default', 1 ) );
162
  }
163
  break;
164
  }
168
  $option_key = $scope . '_' . $i;
169
  switch ( $scope ) {
170
  case 'global':
171
+ $title = wcj_get_option( 'wcj_custom_product_tabs_title_' . $option_key, '' );
172
+ $content = wcj_get_option( 'wcj_custom_product_tabs_content_' . $option_key, '' );
173
+ $priority = wcj_get_option( 'wcj_custom_product_tabs_priority_' . $option_key, 40 );
174
+ $link = wcj_get_option( 'wcj_custom_product_tabs_link_' . $option_key, '' );
175
  break;
176
  default: // 'local'
177
  $title = $this->get_local_title( $product_id, $option_key, $i );
211
  $tabs = $this->customize_default_tabs( $tabs );
212
 
213
  // Custom Tabs - Global
214
+ if ( 'yes' === wcj_get_option( 'wcj_custom_product_tabs_global_enabled', 'yes' ) ) {
215
  $tabs = $this->add_custom_product_tabs( 'global', $tabs, $product_id );
216
  }
217
 
218
  // Custom Tabs - Local
219
+ if ( 'yes' === wcj_get_option( 'wcj_custom_product_tabs_local_enabled', 'yes' ) ) {
220
  $tabs = $this->add_custom_product_tabs( 'local', $tabs, $product_id );
221
  }
222
 
232
  function is_global_tab_visible( $i, $_product_id ) {
233
 
234
  // Exclude by product id
235
+ $array_to_exclude = wcj_get_option( 'wcj_custom_product_tabs_global_hide_in_products_' . $i );
236
  if ( '' == $array_to_exclude || empty( $array_to_exclude ) ) {
237
+ $list_to_exclude = wcj_get_option( 'wcj_custom_product_tabs_title_global_hide_in_product_ids_' . $i );
238
  if ( '' != $list_to_exclude ) {
239
  $array_to_exclude = explode( ',', $list_to_exclude );
240
  }
246
  }
247
 
248
  // Exclude by product category
249
+ $array_to_exclude = wcj_get_option( 'wcj_custom_product_tabs_global_hide_in_cats_' . $i );
250
  if ( '' == $array_to_exclude || empty( $array_to_exclude ) ) {
251
+ $list_to_exclude = wcj_get_option( 'wcj_custom_product_tabs_title_global_hide_in_cats_ids_' . $i );
252
  if ( '' != $list_to_exclude ) {
253
  $array_to_exclude = explode( ',', $list_to_exclude );
254
  }
270
  }
271
 
272
  // Exclude by product tag
273
+ $array_to_exclude = wcj_get_option( 'wcj_custom_product_tabs_global_hide_in_tags_' . $i );
274
  if ( '' != $array_to_exclude && ! empty( $array_to_exclude ) ) {
275
  $do_exclude = false;
276
  $product_tags_objects = get_the_terms( $_product_id, 'product_tag' );
288
  }
289
 
290
  // Include by product id
291
+ $array_to_include = wcj_get_option( 'wcj_custom_product_tabs_global_show_in_products_' . $i );
292
  if ( '' == $array_to_include || empty( $array_to_include ) ) {
293
+ $list_to_include = wcj_get_option( 'wcj_custom_product_tabs_title_global_show_in_product_ids_' . $i );
294
  if ( '' != $list_to_include ) {
295
  $array_to_include = explode( ',', $list_to_include );
296
  }
303
  }
304
 
305
  // Include by product category
306
+ $array_to_include = wcj_get_option( 'wcj_custom_product_tabs_global_show_in_cats_' . $i );
307
  if ( '' == $array_to_include || empty( $array_to_include ) ) {
308
+ $list_to_include = wcj_get_option( 'wcj_custom_product_tabs_title_global_show_in_cats_ids_' . $i );
309
  if ( '' != $list_to_include ) {
310
  $array_to_include = explode( ',', $list_to_include );
311
  }
327
  }
328
 
329
  // Include by product tag
330
+ $array_to_include = wcj_get_option( 'wcj_custom_product_tabs_global_show_in_tags_' . $i );
331
  if ( '' != $array_to_include && ! empty( $array_to_include ) ) {
332
  $do_include = false;
333
  $product_tags_objects = get_the_terms( $_product_id, 'product_tag' );
356
  function is_local_tab_visible( $custom_tab_index, $product_id ) {
357
 
358
  // Exclude by product id
359
+ $array_to_exclude = wcj_get_option( 'wcj_custom_product_tabs_local_hide_in_products_' . $custom_tab_index );
360
  if ( '' != $array_to_exclude && ! empty( $array_to_exclude ) ) {
361
  if ( $array_to_exclude && in_array( $product_id, $array_to_exclude ) ) {
362
  return false;
364
  }
365
 
366
  // Exclude by product category
367
+ $array_to_exclude = wcj_get_option( 'wcj_custom_product_tabs_local_hide_in_cats_' . $custom_tab_index );
368
  if ( '' != $array_to_exclude && ! empty( $array_to_exclude ) ) {
369
  $product_categories_objects = get_the_terms( $product_id, 'product_cat' );
370
  if ( $product_categories_objects && ! empty( $product_categories_objects ) ) {
377
  }
378
 
379
  // Exclude by product tag
380
+ $array_to_exclude = wcj_get_option( 'wcj_custom_product_tabs_local_hide_in_tags_' . $custom_tab_index );
381
  if ( '' != $array_to_exclude && ! empty( $array_to_exclude ) ) {
382
  $product_tags_objects = get_the_terms( $product_id, 'product_tag' );
383
  if ( $product_tags_objects && ! empty( $product_tags_objects ) ) {
390
  }
391
 
392
  // Include by product id
393
+ $array_to_include = wcj_get_option( 'wcj_custom_product_tabs_local_show_in_products_' . $custom_tab_index );
394
  if ( '' != $array_to_include && ! empty( $array_to_include ) ) {
395
  // If NOT in array then hide this tab for this product
396
  if ( $array_to_include && ! in_array( $product_id, $array_to_include ) ) {
399
  }
400
 
401
  // Include by product category
402
+ $array_to_include = wcj_get_option( 'wcj_custom_product_tabs_local_show_in_cats_' . $custom_tab_index );
403
  if ( '' != $array_to_include && ! empty( $array_to_include ) ) {
404
  $do_include = false;
405
  $product_categories_objects = get_the_terms( $product_id, 'product_cat' );
417
  }
418
 
419
  // Include by product tag
420
+ $array_to_include = wcj_get_option( 'wcj_custom_product_tabs_local_show_in_tags_' . $custom_tab_index );
421
  if ( '' != $array_to_include && ! empty( $array_to_include ) ) {
422
  $do_include = false;
423
  $product_tags_objects = get_the_terms( $product_id, 'product_tag' );
467
  function maybe_add_js_links() {
468
  $current_post_id = wcj_maybe_get_product_id_wpml( get_the_ID() );
469
  // Global tabs
470
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_custom_product_tabs_global_total_number', 1 ) ); $i++ ) {
471
  if ( $this->is_global_tab_visible( $i, $current_post_id ) ) {
472
  $key = 'global_' . $i;
473
+ if ( '' != wcj_get_option( 'wcj_custom_product_tabs_title_' . $key, '' ) && '' != ( $link = wcj_get_option( 'wcj_custom_product_tabs_link_' . $key, '' ) ) ) {
474
+ echo $this->get_js_link_script( $link, $this->get_tab_key( $key, 'global' ), wcj_get_option( 'wcj_custom_product_tabs_link_new_tab_' . $key, true ) );
475
  }
476
  }
477
  }
478
  // Local tabs
479
+ if ( 'yes' !== wcj_get_option( 'wcj_custom_product_tabs_local_enabled', 'yes' ) ) {
480
  return;
481
  }
482
  if ( ! ( $total_custom_tabs = get_post_meta( $current_post_id, '_' . 'wcj_custom_product_tabs_local_total_number', true ) ) ) {
483
+ $total_custom_tabs = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_custom_product_tabs_local_total_number_default', 1 ) );
484
  }
485
  for ( $i = 1; $i <= $total_custom_tabs; $i++ ) {
486
  if ( $this->is_local_tab_visible( $i, $current_post_id ) ) {
501
  * @since 3.4.5
502
  */
503
  function get_tab_output( $content ) {
504
+ switch ( wcj_get_option( 'wcj_custom_product_tabs_general_content_processing', 'the_content' ) ) {
505
  case 'disabled':
506
  return $content;
507
  case 'do_shortcode':
526
  * @version 3.4.5
527
  */
528
  function create_new_custom_product_tab_global( $key, $tab ) {
529
+ echo $this->get_tab_output( wcj_get_option( 'wcj_custom_product_tabs_content_' . $this->tab_option_keys['global'][ $key ] ) );
530
  }
531
 
532
  /**
550
  'wcj_custom_product_tabs_link_local_',
551
  'wcj_custom_product_tabs_link_new_tab_local_',
552
  );
553
+ $default_total_custom_tabs = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_custom_product_tabs_local_total_number_default', 1 ) );
554
  $total_custom_tabs_before_saving = get_post_meta( $post_id, '_' . 'wcj_custom_product_tabs_local_total_number', true );
555
  $total_custom_tabs_before_saving = ( '' != $total_custom_tabs_before_saving ) ? $total_custom_tabs_before_saving : $default_total_custom_tabs;
556
  for ( $i = 1; $i <= $total_custom_tabs_before_saving; $i++ ) {
593
  $current_post_id = wcj_maybe_get_product_id_wpml( get_the_ID() );
594
  $option_name = 'wcj_custom_product_tabs_local_total_number';
595
  if ( ! ( $total_custom_tabs = get_post_meta( $current_post_id, '_' . $option_name, true ) ) )
596
+ $total_custom_tabs = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_custom_product_tabs_local_total_number_default', 1 ) );
597
  $html = '';
598
 
599
  $is_disabled = apply_filters( 'booster_message', '', 'readonly_string' );
652
  ),
653
  ),
654
  );
655
+ $enable_wp_editor = ( 'yes' === wcj_get_option( 'wcj_custom_product_tabs_local_wp_editor_enabled', 'yes' ) );
656
  for ( $i = 1; $i <= $total_custom_tabs; $i++ ) {
657
  $is_local_tab_visible = $this->is_local_tab_visible( $i, $current_post_id );
658
  $readonly = ( $is_local_tab_visible ) ? '' : ' readonly'; // not really used
664
  foreach ( $options as $option ) {
665
  $option_id = $option['id'] . $i;
666
  if ( ! ( $option_value = get_post_meta( $current_post_id, '_' . $option_id, true ) ) ) {
667
+ $option_value = wcj_get_option( $option['id'] . 'default_' . $i, '' );
668
  if ( '' === $option_value && 'wcj_custom_product_tabs_priority_local_' === $option['id'] ) {
669
  $option_value = (50 + $i - 1);
670
  }
includes/class-wcj-products-per-page.php CHANGED
@@ -32,14 +32,14 @@ class WCJ_Products_Per_Page extends WCJ_Module {
32
  parent::__construct();
33
 
34
  if ( $this->is_enabled() ) {
35
- if ( 'session' === ( $this->products_per_page_saving_method = get_option( 'wcj_products_per_page_saving_method', 'cookie' ) ) ) {
36
  add_action( 'init', 'wcj_session_maybe_start' );
37
  }
38
  add_filter( 'loop_shop_per_page', array( $this, 'set_products_per_page_number' ), PHP_INT_MAX );
39
  add_filter( 'option_et_divi', array( $this, 'set_products_per_page_number_on_divi' ), PHP_INT_MAX );
40
- $position_hooks = get_option( 'wcj_products_per_page_position', array( 'woocommerce_before_shop_loop' ) );
41
  foreach ( $position_hooks as $position_hook ) {
42
- add_action( $position_hook, array( $this, 'add_products_per_page_form' ), get_option( 'wcj_products_per_page_position_priority', 40 ) );
43
  }
44
  }
45
  }
@@ -78,15 +78,15 @@ class WCJ_Products_Per_Page extends WCJ_Module {
78
  }
79
  }
80
  $select_form .= '</select>';
81
- $form_method = get_option( 'wcj_products_per_page_form_method', 'post' );
82
  $html = '';
83
- $html .= get_option( 'wcj_products_per_page_text_before', '<div class="clearfix"></div><div>' );
84
  $html .= '<form action="' . esc_url( remove_query_arg( 'paged' ) ) . '" method="' . $form_method . '">';
85
- $_text = get_option( 'wcj_products_per_page_text',
86
  __( 'Products <strong>%from% - %to%</strong> from <strong>%total%</strong>. Products on page %select_form%', 'woocommerce-jetpack' ) );
87
  $html .= str_replace( array( '%from%', '%to%', '%total%', '%select_form%' ), array( $products_from, $products_to, $products_total, $select_form ), $_text );
88
  $html .= '</form>';
89
- $html .= get_option( 'wcj_products_per_page_text_after', '</div>' );
90
 
91
  echo $html;
92
  }
@@ -131,7 +131,7 @@ class WCJ_Products_Per_Page extends WCJ_Module {
131
  } elseif ( $products_per_page = $this->get_saved_products_per_page_number() ) {
132
  return $products_per_page;
133
  } else {
134
- return get_option( 'wcj_products_per_page_default', 10 ); // default
135
  }
136
  }
137
 
32
  parent::__construct();
33
 
34
  if ( $this->is_enabled() ) {
35
+ if ( 'session' === ( $this->products_per_page_saving_method = wcj_get_option( 'wcj_products_per_page_saving_method', 'cookie' ) ) ) {
36
  add_action( 'init', 'wcj_session_maybe_start' );
37
  }
38
  add_filter( 'loop_shop_per_page', array( $this, 'set_products_per_page_number' ), PHP_INT_MAX );
39
  add_filter( 'option_et_divi', array( $this, 'set_products_per_page_number_on_divi' ), PHP_INT_MAX );
40
+ $position_hooks = wcj_get_option( 'wcj_products_per_page_position', array( 'woocommerce_before_shop_loop' ) );
41
  foreach ( $position_hooks as $position_hook ) {
42
+ add_action( $position_hook, array( $this, 'add_products_per_page_form' ), wcj_get_option( 'wcj_products_per_page_position_priority', 40 ) );
43
  }
44
  }
45
  }
78
  }
79
  }
80
  $select_form .= '</select>';
81
+ $form_method = wcj_get_option( 'wcj_products_per_page_form_method', 'post' );
82
  $html = '';
83
+ $html .= wcj_get_option( 'wcj_products_per_page_text_before', '<div class="clearfix"></div><div>' );
84
  $html .= '<form action="' . esc_url( remove_query_arg( 'paged' ) ) . '" method="' . $form_method . '">';
85
+ $_text = wcj_get_option( 'wcj_products_per_page_text',
86
  __( 'Products <strong>%from% - %to%</strong> from <strong>%total%</strong>. Products on page %select_form%', 'woocommerce-jetpack' ) );
87
  $html .= str_replace( array( '%from%', '%to%', '%total%', '%select_form%' ), array( $products_from, $products_to, $products_total, $select_form ), $_text );
88
  $html .= '</form>';
89
+ $html .= wcj_get_option( 'wcj_products_per_page_text_after', '</div>' );
90
 
91
  echo $html;
92
  }
131
  } elseif ( $products_per_page = $this->get_saved_products_per_page_number() ) {
132
  return $products_per_page;
133
  } else {
134
+ return wcj_get_option( 'wcj_products_per_page_default', 10 ); // default
135
  }
136
  }
137
 
includes/class-wcj-products-xml.php CHANGED
@@ -35,7 +35,7 @@ class WCJ_Products_XML extends WCJ_Module {
35
  add_action( 'admin_init', array( $this, 'wcj_create_products_xml' ) );
36
  add_action( 'admin_notices', array( $this, 'admin_notices' ) );
37
  add_filter( 'cron_schedules', array( $this, 'cron_add_custom_intervals' ) );
38
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_products_xml_total_files', 1 ) );
39
  for ( $i = 1; $i <= $total_number; $i++ ) {
40
  add_action( 'wcj_create_products_xml_hook_' . $i, array( $this, 'create_products_xml_cron' ), PHP_INT_MAX, 2 );
41
  }
@@ -56,11 +56,11 @@ class WCJ_Products_XML extends WCJ_Module {
56
  'daily',
57
  'weekly',
58
  );
59
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_products_xml_total_files', 1 ) );
60
  for ( $i = 1; $i <= $total_number; $i++ ) {
61
  $event_hook = 'wcj_create_products_xml_hook_' . $i;
62
- if ( 'yes' === get_option( 'wcj_products_xml_enabled_' . $i, 'yes' ) ) {
63
- $selected_interval = apply_filters( 'booster_option', 'weekly', get_option( 'wcj_create_products_xml_period_' . $i, 'weekly' ) );
64
  foreach ( $update_intervals as $interval ) {
65
  $event_timestamp = wp_next_scheduled( $event_hook, array( $interval, $i ) );
66
  if ( $selected_interval === $interval ) {
@@ -172,20 +172,20 @@ class WCJ_Products_XML extends WCJ_Module {
172
  */
173
  function create_products_xml( $file_num ) {
174
  $xml_items = '';
175
- $xml_header_template = get_option( 'wcj_products_xml_header_' . $file_num, '' );
176
- $xml_footer_template = get_option( 'wcj_products_xml_footer_' . $file_num, '' );
177
- $xml_item_template = get_option( 'wcj_products_xml_item_' . $file_num, '' );
178
- $products_in_ids = wcj_maybe_convert_string_to_array( get_option( 'wcj_products_xml_products_incl_' . $file_num, '' ) );
179
- $products_ex_ids = wcj_maybe_convert_string_to_array( get_option( 'wcj_products_xml_products_excl_' . $file_num, '' ) );
180
- $products_cats_in_ids = get_option( 'wcj_products_xml_cats_incl_' . $file_num, '' );
181
- $products_cats_ex_ids = get_option( 'wcj_products_xml_cats_excl_' . $file_num, '' );
182
- $products_tags_in_ids = get_option( 'wcj_products_xml_tags_incl_' . $file_num, '' );
183
- $products_tags_ex_ids = get_option( 'wcj_products_xml_tags_excl_' . $file_num, '' );
184
- $products_scope = get_option( 'wcj_products_xml_scope_' . $file_num, 'all' );
185
- $order_by = get_option( 'wcj_products_xml_orderby_' . $file_num, 'date' );
186
- $order = get_option( 'wcj_products_xml_order_' . $file_num, 'DESC' );
187
- $max = get_option( 'wcj_products_xml_max_' . $file_num, -1 );
188
- $block_size = get_option( 'wcj_products_xml_block_size', 256 );
189
  $offset = 0;
190
  $counter = 0;
191
  while( true ) {
@@ -283,7 +283,7 @@ class WCJ_Products_XML extends WCJ_Module {
283
  }
284
  wp_reset_postdata();
285
  return file_put_contents(
286
- ABSPATH . get_option( 'wcj_products_xml_file_path_' . $file_num, ( ( 1 == $file_num ) ? 'products.xml' : 'products_' . $file_num . '.xml' ) ),
287
  $this->process_shortcode( $xml_header_template ) . $xml_items . $this->process_shortcode( $xml_footer_template )
288
  );
289
  }
35
  add_action( 'admin_init', array( $this, 'wcj_create_products_xml' ) );
36
  add_action( 'admin_notices', array( $this, 'admin_notices' ) );
37
  add_filter( 'cron_schedules', array( $this, 'cron_add_custom_intervals' ) );
38
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_products_xml_total_files', 1 ) );
39
  for ( $i = 1; $i <= $total_number; $i++ ) {
40
  add_action( 'wcj_create_products_xml_hook_' . $i, array( $this, 'create_products_xml_cron' ), PHP_INT_MAX, 2 );
41
  }
56
  'daily',
57
  'weekly',
58
  );
59
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_products_xml_total_files', 1 ) );
60
  for ( $i = 1; $i <= $total_number; $i++ ) {
61
  $event_hook = 'wcj_create_products_xml_hook_' . $i;
62
+ if ( 'yes' === wcj_get_option( 'wcj_products_xml_enabled_' . $i, 'yes' ) ) {
63
+ $selected_interval = apply_filters( 'booster_option', 'weekly', wcj_get_option( 'wcj_create_products_xml_period_' . $i, 'weekly' ) );
64
  foreach ( $update_intervals as $interval ) {
65
  $event_timestamp = wp_next_scheduled( $event_hook, array( $interval, $i ) );
66
  if ( $selected_interval === $interval ) {
172
  */
173
  function create_products_xml( $file_num ) {
174
  $xml_items = '';
175
+ $xml_header_template = wcj_get_option( 'wcj_products_xml_header_' . $file_num, '' );
176
+ $xml_footer_template = wcj_get_option( 'wcj_products_xml_footer_' . $file_num, '' );
177
+ $xml_item_template = wcj_get_option( 'wcj_products_xml_item_' . $file_num, '' );
178
+ $products_in_ids = wcj_maybe_convert_string_to_array( wcj_get_option( 'wcj_products_xml_products_incl_' . $file_num, '' ) );
179
+ $products_ex_ids = wcj_maybe_convert_string_to_array( wcj_get_option( 'wcj_products_xml_products_excl_' . $file_num, '' ) );
180
+ $products_cats_in_ids = wcj_get_option( 'wcj_products_xml_cats_incl_' . $file_num, '' );
181
+ $products_cats_ex_ids = wcj_get_option( 'wcj_products_xml_cats_excl_' . $file_num, '' );
182
+ $products_tags_in_ids = wcj_get_option( 'wcj_products_xml_tags_incl_' . $file_num, '' );
183
+ $products_tags_ex_ids = wcj_get_option( 'wcj_products_xml_tags_excl_' . $file_num, '' );
184
+ $products_scope = wcj_get_option( 'wcj_products_xml_scope_' . $file_num, 'all' );
185
+ $order_by = wcj_get_option( 'wcj_products_xml_orderby_' . $file_num, 'date' );
186
+ $order = wcj_get_option( 'wcj_products_xml_order_' . $file_num, 'DESC' );
187
+ $max = wcj_get_option( 'wcj_products_xml_max_' . $file_num, -1 );
188
+ $block_size = wcj_get_option( 'wcj_products_xml_block_size', 256 );
189
  $offset = 0;
190
  $counter = 0;
191
  while( true ) {
283
  }
284
  wp_reset_postdata();
285
  return file_put_contents(
286
+ ABSPATH . wcj_get_option( 'wcj_products_xml_file_path_' . $file_num, ( ( 1 == $file_num ) ? 'products.xml' : 'products_' . $file_num . '.xml' ) ),
287
  $this->process_shortcode( $xml_header_template ) . $xml_items . $this->process_shortcode( $xml_footer_template )
288
  );
289
  }
includes/class-wcj-purchase-data.php CHANGED
@@ -46,8 +46,8 @@ class WCJ_Purchase_Data extends WCJ_Module {
46
 
47
  // Orders columns
48
  if (
49
- 'yes' === get_option( 'wcj_purchase_data_custom_columns_profit', 'yes' ) ||
50
- 'yes' === get_option( 'wcj_purchase_data_custom_columns_purchase_cost', 'no' )
51
  ) {
52
  add_filter( 'manage_edit-shop_order_columns', array( $this, 'add_order_columns' ), PHP_INT_MAX - 2 );
53
  add_action( 'manage_shop_order_posts_custom_column', array( $this, 'render_order_columns' ), PHP_INT_MAX );
@@ -55,8 +55,8 @@ class WCJ_Purchase_Data extends WCJ_Module {
55
 
56
  // Products columns
57
  if (
58
- 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_purchase_data_custom_products_columns_purchase_cost', 'no' ) ) ||
59
- 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_purchase_data_custom_products_columns_profit', 'no' ) )
60
  ) {
61
  add_filter( 'manage_edit-product_columns', array( $this, 'add_product_columns' ), PHP_INT_MAX );
62
  add_action( 'manage_product_posts_custom_column', array( $this, 'render_product_columns' ), PHP_INT_MAX );
@@ -112,10 +112,10 @@ class WCJ_Purchase_Data extends WCJ_Module {
112
  * @todo (maybe) output columns immediately after standard "Price"
113
  */
114
  function add_product_columns( $columns ) {
115
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_purchase_data_custom_products_columns_purchase_cost', 'no' ) ) ) {
116
  $columns['purchase_cost'] = __( 'Cost', 'woocommerce-jetpack' );
117
  }
118
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_purchase_data_custom_products_columns_profit', 'no' ) ) ) {
119
  $columns['profit'] = __( 'Profit', 'woocommerce-jetpack' );
120
  }
121
  return $columns;
@@ -131,7 +131,7 @@ class WCJ_Purchase_Data extends WCJ_Module {
131
  if ( 'profit' === $column || 'purchase_cost' === $column ) {
132
  $product_id = get_the_ID();
133
  $_product = wc_get_product( $product_id );
134
- if ( $_product->is_type( 'variable' ) && 'no' === get_option( 'wcj_purchase_data_variable_as_simple_enabled', 'no' ) ) {
135
  $purchase_costs = array();
136
  $profits = array();
137
  $available_variations = $_product->get_available_variations();
@@ -178,10 +178,10 @@ class WCJ_Purchase_Data extends WCJ_Module {
178
  * @since 2.2.4
179
  */
180
  function add_order_columns( $columns ) {
181
- if ( 'yes' === get_option( 'wcj_purchase_data_custom_columns_profit', 'yes' ) ) {
182
  $columns['profit'] = __( 'Profit', 'woocommerce-jetpack' );
183
  }
184
- if ( 'yes' === get_option( 'wcj_purchase_data_custom_columns_purchase_cost', 'no' ) ) {
185
  $columns['purchase_cost'] = __( 'Purchase Cost', 'woocommerce-jetpack' );
186
  }
187
  return $columns;
@@ -204,7 +204,7 @@ class WCJ_Purchase_Data extends WCJ_Module {
204
  $is_forecasted = false;
205
  foreach ( $the_order->get_items() as $item_id => $item ) {
206
  $value = 0;
207
- $product_id = ( isset( $item['variation_id'] ) && 0 != $item['variation_id'] && 'no' === get_option( 'wcj_purchase_data_variable_as_simple_enabled', 'no' )
208
  ? $item['variation_id'] : $item['product_id'] );
209
  if ( 0 != ( $purchase_price = wc_get_product_purchase_price( $product_id ) ) ) {
210
  if ( 'profit' === $column ) {
@@ -247,7 +247,7 @@ class WCJ_Purchase_Data extends WCJ_Module {
247
  $main_product_id = get_the_ID();
248
  $_product = wc_get_product( $main_product_id );
249
  $products = array();
250
- if ( $_product->is_type( 'variable' ) && 'no' === get_option( 'wcj_purchase_data_variable_as_simple_enabled', 'no' ) ) {
251
  $available_variations = $_product->get_available_variations();
252
  foreach ( $available_variations as $variation ) {
253
  $variation_product = wc_get_product( $variation['variation_id'] );
@@ -298,7 +298,7 @@ class WCJ_Purchase_Data extends WCJ_Module {
298
  */
299
  function get_profit_percentage( $args = array() ) {
300
  $args = wp_parse_args( $args, array(
301
- 'percentage_type' => get_option( 'wcj_purchase_price_profit_percentage_type', 'markup' ),
302
  'profit' => null,
303
  'selling_price' => null,
304
  'purchase_price' => null,
46
 
47
  // Orders columns
48
  if (
49
+ 'yes' === wcj_get_option( 'wcj_purchase_data_custom_columns_profit', 'yes' ) ||
50
+ 'yes' === wcj_get_option( 'wcj_purchase_data_custom_columns_purchase_cost', 'no' )
51
  ) {
52
  add_filter( 'manage_edit-shop_order_columns', array( $this, 'add_order_columns' ), PHP_INT_MAX - 2 );
53
  add_action( 'manage_shop_order_posts_custom_column', array( $this, 'render_order_columns' ), PHP_INT_MAX );
55
 
56
  // Products columns
57
  if (
58
+ 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_purchase_data_custom_products_columns_purchase_cost', 'no' ) ) ||
59
+ 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_purchase_data_custom_products_columns_profit', 'no' ) )
60
  ) {
61
  add_filter( 'manage_edit-product_columns', array( $this, 'add_product_columns' ), PHP_INT_MAX );
62
  add_action( 'manage_product_posts_custom_column', array( $this, 'render_product_columns' ), PHP_INT_MAX );
112
  * @todo (maybe) output columns immediately after standard "Price"
113
  */
114
  function add_product_columns( $columns ) {
115
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_purchase_data_custom_products_columns_purchase_cost', 'no' ) ) ) {
116
  $columns['purchase_cost'] = __( 'Cost', 'woocommerce-jetpack' );
117
  }
118
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_purchase_data_custom_products_columns_profit', 'no' ) ) ) {
119
  $columns['profit'] = __( 'Profit', 'woocommerce-jetpack' );
120
  }
121
  return $columns;
131
  if ( 'profit' === $column || 'purchase_cost' === $column ) {
132
  $product_id = get_the_ID();
133
  $_product = wc_get_product( $product_id );
134
+ if ( $_product->is_type( 'variable' ) && 'no' === wcj_get_option( 'wcj_purchase_data_variable_as_simple_enabled', 'no' ) ) {
135
  $purchase_costs = array();
136
  $profits = array();
137
  $available_variations = $_product->get_available_variations();
178
  * @since 2.2.4
179
  */
180
  function add_order_columns( $columns ) {
181
+ if ( 'yes' === wcj_get_option( 'wcj_purchase_data_custom_columns_profit', 'yes' ) ) {
182
  $columns['profit'] = __( 'Profit', 'woocommerce-jetpack' );
183
  }
184
+ if ( 'yes' === wcj_get_option( 'wcj_purchase_data_custom_columns_purchase_cost', 'no' ) ) {
185
  $columns['purchase_cost'] = __( 'Purchase Cost', 'woocommerce-jetpack' );
186
  }
187
  return $columns;
204
  $is_forecasted = false;
205
  foreach ( $the_order->get_items() as $item_id => $item ) {
206
  $value = 0;
207
+ $product_id = ( isset( $item['variation_id'] ) && 0 != $item['variation_id'] && 'no' === wcj_get_option( 'wcj_purchase_data_variable_as_simple_enabled', 'no' )
208
  ? $item['variation_id'] : $item['product_id'] );
209
  if ( 0 != ( $purchase_price = wc_get_product_purchase_price( $product_id ) ) ) {
210
  if ( 'profit' === $column ) {
247
  $main_product_id = get_the_ID();
248
  $_product = wc_get_product( $main_product_id );
249
  $products = array();
250
+ if ( $_product->is_type( 'variable' ) && 'no' === wcj_get_option( 'wcj_purchase_data_variable_as_simple_enabled', 'no' ) ) {
251
  $available_variations = $_product->get_available_variations();
252
  foreach ( $available_variations as $variation ) {
253
  $variation_product = wc_get_product( $variation['variation_id'] );
298
  */
299
  function get_profit_percentage( $args = array() ) {
300
  $args = wp_parse_args( $args, array(
301
+ 'percentage_type' => wcj_get_option( 'wcj_purchase_price_profit_percentage_type', 'markup' ),
302
  'profit' => null,
303
  'selling_price' => null,
304
  'purchase_price' => null,
includes/class-wcj-related-products.php CHANGED
@@ -50,7 +50,7 @@ class WCJ_Related_Products extends WCJ_Module {
50
 
51
  if ( $this->is_enabled() ) {
52
  // Related per Product
53
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_product_info_related_products_per_product', 'no' ) ) ) {
54
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
55
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
56
  }
@@ -73,21 +73,21 @@ class WCJ_Related_Products extends WCJ_Module {
73
  add_filter( 'woocommerce_related_products_columns', array( $this, 'related_products_columns' ), PHP_INT_MAX );
74
 
75
  // Relate by Category
76
- if ( 'no' === get_option( 'wcj_product_info_related_products_relate_by_category', 'yes' ) ) {
77
  add_filter( 'woocommerce_product_related_posts_relate_by_category', '__return_false', PHP_INT_MAX );
78
  } else {
79
  add_filter( 'woocommerce_product_related_posts_relate_by_category', '__return_true', PHP_INT_MAX );
80
  }
81
 
82
  // Relate by Tag
83
- if ( 'no' === get_option( 'wcj_product_info_related_products_relate_by_tag', 'yes' ) ) {
84
  add_filter( 'woocommerce_product_related_posts_relate_by_tag', '__return_false', PHP_INT_MAX );
85
  } else {
86
  add_filter( 'woocommerce_product_related_posts_relate_by_tag', '__return_true', PHP_INT_MAX );
87
  }
88
 
89
  // Hide Related
90
- if ( 'yes' === get_option( 'wcj_product_info_related_products_hide', 'no' ) ) {
91
  add_action( ( $this->do_hide_for_all_products() ? 'init' : 'wp_head' ), array( $this, 'remove_output_related_products_action' ), PHP_INT_MAX );
92
  }
93
 
@@ -102,12 +102,12 @@ class WCJ_Related_Products extends WCJ_Module {
102
  */
103
  function do_hide_for_all_products() {
104
  return (
105
- '' == get_option( 'wcj_product_info_related_products_hide_products_incl', '' ) &&
106
- '' == get_option( 'wcj_product_info_related_products_hide_products_excl', '' ) &&
107
- '' == get_option( 'wcj_product_info_related_products_hide_cats_incl', '' ) &&
108
- '' == get_option( 'wcj_product_info_related_products_hide_cats_excl', '' ) &&
109
- '' == get_option( 'wcj_product_info_related_products_hide_tags_incl', '' ) &&
110
- '' == get_option( 'wcj_product_info_related_products_hide_tags_excl', '' )
111
  );
112
  }
113
 
@@ -119,12 +119,12 @@ class WCJ_Related_Products extends WCJ_Module {
119
  */
120
  function do_hide_for_product( $product_id ) {
121
  return wcj_is_enabled_for_product( $product_id, array(
122
- 'include_products' => get_option( 'wcj_product_info_related_products_hide_products_incl', '' ),
123
- 'exclude_products' => get_option( 'wcj_product_info_related_products_hide_products_excl', '' ),
124
- 'include_categories' => get_option( 'wcj_product_info_related_products_hide_cats_incl', '' ),
125
- 'exclude_categories' => get_option( 'wcj_product_info_related_products_hide_cats_excl', '' ),
126
- 'include_tags' => get_option( 'wcj_product_info_related_products_hide_tags_incl', '' ),
127
- 'exclude_tags' => get_option( 'wcj_product_info_related_products_hide_tags_excl', '' ),
128
  ) );
129
  }
130
 
@@ -150,12 +150,12 @@ class WCJ_Related_Products extends WCJ_Module {
150
  */
151
  function related_products_args_wc3( $args ) {
152
  // Related Num
153
- $args['posts_per_page'] = get_option( 'wcj_product_info_related_products_num', 3 );
154
  // Order By
155
- $args['orderby'] = get_option( 'wcj_product_info_related_products_orderby', 'rand' );
156
  // Order
157
  if ( 'rand' != $args['orderby'] ) {
158
- $args['order'] = get_option( 'wcj_product_info_related_products_order', 'desc' );
159
  }
160
  return $args;
161
  }
@@ -167,7 +167,7 @@ class WCJ_Related_Products extends WCJ_Module {
167
  * @since 2.8.0
168
  */
169
  function output_related_products_args_wc3( $args ) {
170
- $args['columns'] = get_option( 'wcj_product_info_related_products_columns', 3 );
171
  $args = $this->related_products_args_wc3( $args );
172
  return $args;
173
  }
@@ -182,13 +182,13 @@ class WCJ_Related_Products extends WCJ_Module {
182
  $include_ids = array();
183
  // Change Related Products
184
  if (
185
- 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_product_info_related_products_per_product', 'no' ) ) &&
186
- ( 'yes' === get_post_meta( get_the_ID(), '_' . 'wcj_product_info_related_products_enabled', true ) || ( 'yes' === get_option( 'wcj_product_info_related_products_per_product_cmb_default', 'no' ) ) && '' === get_post_meta( get_the_ID(), '_' . 'wcj_product_info_related_products_enabled', true ) )
187
  ) {
188
  // Relate per Product (Manual)
189
  $related_per_product = get_post_meta( get_the_ID(), '_' . 'wcj_product_info_related_products_ids', true );
190
  $include_ids = ( ! empty( $related_per_product ) ? $related_per_product : false );
191
- } elseif ( 'yes' === get_option( 'wcj_product_info_related_products_by_attribute_enabled', 'no' ) ) {
192
  $args = array(
193
  'post_type' => 'product',
194
  'post_status' => 'any',
@@ -197,9 +197,9 @@ class WCJ_Related_Products extends WCJ_Module {
197
  'order' => 'ASC',
198
  'fields' => 'ids',
199
  );
200
- $attribute_name = get_option( 'wcj_product_info_related_products_by_attribute_attribute_name', '' );
201
- $attribute_value = get_option( 'wcj_product_info_related_products_by_attribute_attribute_value', '' );
202
- if ( 'global' === get_option( 'wcj_product_info_related_products_by_attribute_attribute_type', 'global' ) ) {
203
  // Relate by Global Attributes
204
  // http://snippet.fm/snippets/query-for-woocommerce-products-by-global-product-attributes/
205
  $args['tax_query'] = array(
@@ -240,7 +240,7 @@ class WCJ_Related_Products extends WCJ_Module {
240
  function related_products_query_wc3( $_query, $product_id ) {
241
  //////////////////////////////////////////////////////////////////////
242
  // Pluggabl
243
- if ( 'yes' === get_option( 'wcj_product_info_related_products_hide', 'no' ) ) {
244
  $include_ids = false;
245
  } else {
246
  $include_ids = $this->get_related_products_ids_wc3( $product_id );
@@ -259,7 +259,7 @@ class WCJ_Related_Products extends WCJ_Module {
259
  $include_ids = array( 0 );
260
  $limit = 0;
261
  } else {
262
- $limit = get_option( 'wcj_product_info_related_products_num', 3 );
263
  $limit = $limit > 0 ? $limit : 5;
264
  $limit += 20;
265
  }
@@ -294,7 +294,7 @@ class WCJ_Related_Products extends WCJ_Module {
294
  $query['where'] .= " AND t.term_id !=" . $product_visibility_term_ids['exclude-from-catalog'];
295
  }
296
 
297
- if ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) && $product_visibility_term_ids['outofstock'] ) {
298
  $query['where'] .= " AND t.term_id !=" . $product_visibility_term_ids['outofstock'];
299
  }
300
 
@@ -328,11 +328,11 @@ class WCJ_Related_Products extends WCJ_Module {
328
  */
329
  function fix_empty_initial_related_products( $terms, $product_id ) {
330
  $do_fix = false;
331
- if ( 'yes' === get_option( 'wcj_product_info_related_products_by_attribute_enabled', 'no' ) ) {
332
  $do_fix = true;
333
  } elseif (
334
- 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_product_info_related_products_per_product', 'no' ) ) &&
335
- ( 'yes' === get_post_meta( get_the_ID(), '_' . 'wcj_product_info_related_products_enabled', true ) || ( 'yes' === get_option( 'wcj_product_info_related_products_per_product_cmb_default', 'no' ) ) && '' === get_post_meta( get_the_ID(), '_' . 'wcj_product_info_related_products_enabled', true ) ) &&
336
  '' != get_post_meta( $product_id, '_' . 'wcj_product_info_related_products_ids', true )
337
  ) {
338
  $do_fix = true;
@@ -355,7 +355,7 @@ class WCJ_Related_Products extends WCJ_Module {
355
  * @since 2.6.0
356
  */
357
  function related_products_columns( $columns ) {
358
- return get_option( 'wcj_product_info_related_products_columns', 3 );
359
  }
360
 
361
  /**
@@ -400,25 +400,25 @@ class WCJ_Related_Products extends WCJ_Module {
400
  */
401
  function related_products_args( $args ) {
402
  // Hide Related
403
- if ( 'yes' === get_option( 'wcj_product_info_related_products_hide', 'no' ) ) {
404
  return array();
405
  }
406
  // Related Num
407
- $args['posts_per_page'] = get_option( 'wcj_product_info_related_products_num', 3 );
408
  // Order By
409
- $orderby = get_option( 'wcj_product_info_related_products_orderby', 'rand' );
410
  $args['orderby'] = $orderby;
411
  if ( 'meta_value' === $orderby || 'meta_value_num' === $orderby ) {
412
- $args['meta_key'] = get_option( 'wcj_product_info_related_products_orderby_meta_value_meta_key', '' );
413
  }
414
  // Order
415
  if ( 'rand' != $orderby ) {
416
- $args['order'] = get_option( 'wcj_product_info_related_products_order', 'desc' );
417
  }
418
  // Change Related Products
419
  if (
420
- 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_product_info_related_products_per_product', 'no' ) ) &&
421
- ( 'yes' === get_post_meta( get_the_ID(), '_' . 'wcj_product_info_related_products_enabled', true ) || ( 'yes' === get_option( 'wcj_product_info_related_products_per_product_cmb_default', 'no' ) ) && '' === get_post_meta( get_the_ID(), '_' . 'wcj_product_info_related_products_enabled', true ) )
422
  ) {
423
  // Relate per Product (Manual)
424
  $related_per_product = get_post_meta( get_the_ID(), '_' . 'wcj_product_info_related_products_ids', true );
@@ -427,11 +427,11 @@ class WCJ_Related_Products extends WCJ_Module {
427
  } else {
428
  return array();
429
  }
430
- } elseif ( 'yes' === get_option( 'wcj_product_info_related_products_by_attribute_enabled', 'no' ) ) {
431
  unset( $args['post__in'] );
432
- $attribute_name = get_option( 'wcj_product_info_related_products_by_attribute_attribute_name', '' );
433
- $attribute_value = get_option( 'wcj_product_info_related_products_by_attribute_attribute_value', '' );
434
- if ( 'global' === get_option( 'wcj_product_info_related_products_by_attribute_attribute_type', 'global' ) ) {
435
  // Relate by Global Attributes
436
  // http://snippet.fm/snippets/query-for-woocommerce-products-by-global-product-attributes/
437
  $args['tax_query'] = array(
@@ -464,7 +464,7 @@ class WCJ_Related_Products extends WCJ_Module {
464
  * @version 2.6.0
465
  */
466
  function output_related_products_args( $args ) {
467
- $args['columns'] = get_option( 'wcj_product_info_related_products_columns', 3 );
468
  $args = $this->related_products_args( $args );
469
  return $args;
470
  }
50
 
51
  if ( $this->is_enabled() ) {
52
  // Related per Product
53
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_product_info_related_products_per_product', 'no' ) ) ) {
54
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
55
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
56
  }
73
  add_filter( 'woocommerce_related_products_columns', array( $this, 'related_products_columns' ), PHP_INT_MAX );
74
 
75
  // Relate by Category
76
+ if ( 'no' === wcj_get_option( 'wcj_product_info_related_products_relate_by_category', 'yes' ) ) {
77
  add_filter( 'woocommerce_product_related_posts_relate_by_category', '__return_false', PHP_INT_MAX );
78
  } else {
79
  add_filter( 'woocommerce_product_related_posts_relate_by_category', '__return_true', PHP_INT_MAX );
80
  }
81
 
82
  // Relate by Tag
83
+ if ( 'no' === wcj_get_option( 'wcj_product_info_related_products_relate_by_tag', 'yes' ) ) {
84
  add_filter( 'woocommerce_product_related_posts_relate_by_tag', '__return_false', PHP_INT_MAX );
85
  } else {
86
  add_filter( 'woocommerce_product_related_posts_relate_by_tag', '__return_true', PHP_INT_MAX );
87
  }
88
 
89
  // Hide Related
90
+ if ( 'yes' === wcj_get_option( 'wcj_product_info_related_products_hide', 'no' ) ) {
91
  add_action( ( $this->do_hide_for_all_products() ? 'init' : 'wp_head' ), array( $this, 'remove_output_related_products_action' ), PHP_INT_MAX );
92
  }
93
 
102
  */
103
  function do_hide_for_all_products() {
104
  return (
105
+ '' == wcj_get_option( 'wcj_product_info_related_products_hide_products_incl', '' ) &&
106
+ '' == wcj_get_option( 'wcj_product_info_related_products_hide_products_excl', '' ) &&
107
+ '' == wcj_get_option( 'wcj_product_info_related_products_hide_cats_incl', '' ) &&
108
+ '' == wcj_get_option( 'wcj_product_info_related_products_hide_cats_excl', '' ) &&
109
+ '' == wcj_get_option( 'wcj_product_info_related_products_hide_tags_incl', '' ) &&
110
+ '' == wcj_get_option( 'wcj_product_info_related_products_hide_tags_excl', '' )
111
  );
112
  }
113
 
119
  */
120
  function do_hide_for_product( $product_id ) {
121
  return wcj_is_enabled_for_product( $product_id, array(
122
+ 'include_products' => wcj_get_option( 'wcj_product_info_related_products_hide_products_incl', '' ),
123
+ 'exclude_products' => wcj_get_option( 'wcj_product_info_related_products_hide_products_excl', '' ),
124
+ 'include_categories' => wcj_get_option( 'wcj_product_info_related_products_hide_cats_incl', '' ),
125
+ 'exclude_categories' => wcj_get_option( 'wcj_product_info_related_products_hide_cats_excl', '' ),
126
+ 'include_tags' => wcj_get_option( 'wcj_product_info_related_products_hide_tags_incl', '' ),
127
+ 'exclude_tags' => wcj_get_option( 'wcj_product_info_related_products_hide_tags_excl', '' ),
128
  ) );
129
  }
130
 
150
  */
151
  function related_products_args_wc3( $args ) {
152
  // Related Num
153
+ $args['posts_per_page'] = wcj_get_option( 'wcj_product_info_related_products_num', 3 );
154
  // Order By
155
+ $args['orderby'] = wcj_get_option( 'wcj_product_info_related_products_orderby', 'rand' );
156
  // Order
157
  if ( 'rand' != $args['orderby'] ) {
158
+ $args['order'] = wcj_get_option( 'wcj_product_info_related_products_order', 'desc' );
159
  }
160
  return $args;
161
  }
167
  * @since 2.8.0
168
  */
169
  function output_related_products_args_wc3( $args ) {
170
+ $args['columns'] = wcj_get_option( 'wcj_product_info_related_products_columns', 3 );
171
  $args = $this->related_products_args_wc3( $args );
172
  return $args;
173
  }
182
  $include_ids = array();
183
  // Change Related Products
184
  if (
185
+ 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_product_info_related_products_per_product', 'no' ) ) &&
186
+ ( 'yes' === get_post_meta( get_the_ID(), '_' . 'wcj_product_info_related_products_enabled', true ) || ( 'yes' === wcj_get_option( 'wcj_product_info_related_products_per_product_cmb_default', 'no' ) ) && '' === get_post_meta( get_the_ID(), '_' . 'wcj_product_info_related_products_enabled', true ) )
187
  ) {
188
  // Relate per Product (Manual)
189
  $related_per_product = get_post_meta( get_the_ID(), '_' . 'wcj_product_info_related_products_ids', true );
190
  $include_ids = ( ! empty( $related_per_product ) ? $related_per_product : false );
191
+ } elseif ( 'yes' === wcj_get_option( 'wcj_product_info_related_products_by_attribute_enabled', 'no' ) ) {
192
  $args = array(
193
  'post_type' => 'product',
194
  'post_status' => 'any',
197
  'order' => 'ASC',
198
  'fields' => 'ids',
199
  );
200
+ $attribute_name = wcj_get_option( 'wcj_product_info_related_products_by_attribute_attribute_name', '' );
201
+ $attribute_value = wcj_get_option( 'wcj_product_info_related_products_by_attribute_attribute_value', '' );
202
+ if ( 'global' === wcj_get_option( 'wcj_product_info_related_products_by_attribute_attribute_type', 'global' ) ) {
203
  // Relate by Global Attributes
204
  // http://snippet.fm/snippets/query-for-woocommerce-products-by-global-product-attributes/
205
  $args['tax_query'] = array(
240
  function related_products_query_wc3( $_query, $product_id ) {
241
  //////////////////////////////////////////////////////////////////////
242
  // Pluggabl
243
+ if ( 'yes' === wcj_get_option( 'wcj_product_info_related_products_hide', 'no' ) ) {
244
  $include_ids = false;
245
  } else {
246
  $include_ids = $this->get_related_products_ids_wc3( $product_id );
259
  $include_ids = array( 0 );
260
  $limit = 0;
261
  } else {
262
+ $limit = wcj_get_option( 'wcj_product_info_related_products_num', 3 );
263
  $limit = $limit > 0 ? $limit : 5;
264
  $limit += 20;
265
  }
294
  $query['where'] .= " AND t.term_id !=" . $product_visibility_term_ids['exclude-from-catalog'];
295
  }
296
 
297
+ if ( 'yes' === wcj_get_option( 'woocommerce_hide_out_of_stock_items' ) && $product_visibility_term_ids['outofstock'] ) {
298
  $query['where'] .= " AND t.term_id !=" . $product_visibility_term_ids['outofstock'];
299
  }
300
 
328
  */
329
  function fix_empty_initial_related_products( $terms, $product_id ) {
330
  $do_fix = false;
331
+ if ( 'yes' === wcj_get_option( 'wcj_product_info_related_products_by_attribute_enabled', 'no' ) ) {
332
  $do_fix = true;
333
  } elseif (
334
+ 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_product_info_related_products_per_product', 'no' ) ) &&
335
+ ( 'yes' === get_post_meta( get_the_ID(), '_' . 'wcj_product_info_related_products_enabled', true ) || ( 'yes' === wcj_get_option( 'wcj_product_info_related_products_per_product_cmb_default', 'no' ) ) && '' === get_post_meta( get_the_ID(), '_' . 'wcj_product_info_related_products_enabled', true ) ) &&
336
  '' != get_post_meta( $product_id, '_' . 'wcj_product_info_related_products_ids', true )
337
  ) {
338
  $do_fix = true;
355
  * @since 2.6.0
356
  */
357
  function related_products_columns( $columns ) {
358
+ return wcj_get_option( 'wcj_product_info_related_products_columns', 3 );
359
  }
360
 
361
  /**
400
  */
401
  function related_products_args( $args ) {
402
  // Hide Related
403
+ if ( 'yes' === wcj_get_option( 'wcj_product_info_related_products_hide', 'no' ) ) {
404
  return array();
405
  }
406
  // Related Num
407
+ $args['posts_per_page'] = wcj_get_option( 'wcj_product_info_related_products_num', 3 );
408
  // Order By
409
+ $orderby = wcj_get_option( 'wcj_product_info_related_products_orderby', 'rand' );
410
  $args['orderby'] = $orderby;
411
  if ( 'meta_value' === $orderby || 'meta_value_num' === $orderby ) {
412
+ $args['meta_key'] = wcj_get_option( 'wcj_product_info_related_products_orderby_meta_value_meta_key', '' );
413
  }
414
  // Order
415
  if ( 'rand' != $orderby ) {
416
+ $args['order'] = wcj_get_option( 'wcj_product_info_related_products_order', 'desc' );
417
  }
418
  // Change Related Products
419
  if (
420
+ 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_product_info_related_products_per_product', 'no' ) ) &&
421
+ ( 'yes' === get_post_meta( get_the_ID(), '_' . 'wcj_product_info_related_products_enabled', true ) || ( 'yes' === wcj_get_option( 'wcj_product_info_related_products_per_product_cmb_default', 'no' ) ) && '' === get_post_meta( get_the_ID(), '_' . 'wcj_product_info_related_products_enabled', true ) )
422
  ) {
423
  // Relate per Product (Manual)
424
  $related_per_product = get_post_meta( get_the_ID(), '_' . 'wcj_product_info_related_products_ids', true );
427
  } else {
428
  return array();
429
  }
430
+ } elseif ( 'yes' === wcj_get_option( 'wcj_product_info_related_products_by_attribute_enabled', 'no' ) ) {
431
  unset( $args['post__in'] );
432
+ $attribute_name = wcj_get_option( 'wcj_product_info_related_products_by_attribute_attribute_name', '' );
433
+ $attribute_value = wcj_get_option( 'wcj_product_info_related_products_by_attribute_attribute_value', '' );
434
+ if ( 'global' === wcj_get_option( 'wcj_product_info_related_products_by_attribute_attribute_type', 'global' ) ) {
435
  // Relate by Global Attributes
436
  // http://snippet.fm/snippets/query-for-woocommerce-products-by-global-product-attributes/
437
  $args['tax_query'] = array(
464
  * @version 2.6.0
465
  */
466
  function output_related_products_args( $args ) {
467
+ $args['columns'] = wcj_get_option( 'wcj_product_info_related_products_columns', 3 );
468
  $args = $this->related_products_args( $args );
469
  return $args;
470
  }
includes/class-wcj-sale-flash.php CHANGED
@@ -32,17 +32,17 @@ class WCJ_Sale_Flash extends WCJ_Module {
32
  parent::__construct();
33
 
34
  if ( $this->is_enabled() ) {
35
- $this->globally_enabled = ( 'yes' === get_option( 'wcj_product_images_sale_flash_enabled', 'no' ) );
36
- $this->per_product_enabled = ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_sale_flash_per_product_enabled', 'no' ) ) );
37
- $this->per_category_enabled = ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_sale_flash_per_' . 'product_cat' . '_enabled', 'no' ) ) );
38
- $this->per_tag_enabled = ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_sale_flash_per_' . 'product_tag' . '_enabled', 'no' ) ) );
39
  if ( $this->per_category_enabled ) {
40
- $this->sale_flash_per_taxonomy['product_cat']['terms'] = get_option( 'wcj_sale_flash_per_product_cat_terms', array() );
41
- $this->sale_flash_per_taxonomy['product_cat']['html'] = get_option( 'wcj_sale_flash_per_product_cat', array() );
42
  }
43
  if ( $this->per_tag_enabled ) {
44
- $this->sale_flash_per_taxonomy['product_tag']['terms'] = get_option( 'wcj_sale_flash_per_product_tag_terms', array() );
45
- $this->sale_flash_per_taxonomy['product_tag']['html'] = get_option( 'wcj_sale_flash_per_product_tag', array() );
46
  }
47
  add_filter( 'woocommerce_sale_flash', array( $this, 'customize_sale_flash' ), PHP_INT_MAX, 3 );
48
  if ( $this->per_product_enabled ) {
@@ -108,17 +108,17 @@ class WCJ_Sale_Flash extends WCJ_Module {
108
  }
109
  } elseif ( $this->globally_enabled ) {
110
  // Hiding
111
- if ( 'yes' === get_option( 'wcj_product_images_sale_flash_hide_everywhere', 'no' ) ) {
112
  return '';
113
  }
114
- if ( 'yes' === get_option( 'wcj_product_images_sale_flash_hide_on_archives', 'no' ) && is_archive() ) {
115
  return '';
116
  }
117
- if ( 'yes' === get_option( 'wcj_product_images_sale_flash_hide_on_single', 'no' ) && is_single() && get_the_ID() === $product_id ) {
118
  return '';
119
  }
120
  // Content
121
- return do_shortcode( get_option( 'wcj_product_images_sale_flash_html', '<span class="onsale">' . __( 'Sale!', 'woocommerce' ) . '</span>' ) );
122
  }
123
  return $sale_flash_html;
124
  }
32
  parent::__construct();
33
 
34
  if ( $this->is_enabled() ) {
35
+ $this->globally_enabled = ( 'yes' === wcj_get_option( 'wcj_product_images_sale_flash_enabled', 'no' ) );
36
+ $this->per_product_enabled = ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_sale_flash_per_product_enabled', 'no' ) ) );
37
+ $this->per_category_enabled = ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_sale_flash_per_' . 'product_cat' . '_enabled', 'no' ) ) );
38
+ $this->per_tag_enabled = ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_sale_flash_per_' . 'product_tag' . '_enabled', 'no' ) ) );
39
  if ( $this->per_category_enabled ) {
40
+ $this->sale_flash_per_taxonomy['product_cat']['terms'] = wcj_get_option( 'wcj_sale_flash_per_product_cat_terms', array() );
41
+ $this->sale_flash_per_taxonomy['product_cat']['html'] = wcj_get_option( 'wcj_sale_flash_per_product_cat', array() );
42
  }
43
  if ( $this->per_tag_enabled ) {
44
+ $this->sale_flash_per_taxonomy['product_tag']['terms'] = wcj_get_option( 'wcj_sale_flash_per_product_tag_terms', array() );
45
+ $this->sale_flash_per_taxonomy['product_tag']['html'] = wcj_get_option( 'wcj_sale_flash_per_product_tag', array() );
46
  }
47
  add_filter( 'woocommerce_sale_flash', array( $this, 'customize_sale_flash' ), PHP_INT_MAX, 3 );
48
  if ( $this->per_product_enabled ) {
108
  }
109
  } elseif ( $this->globally_enabled ) {
110
  // Hiding
111
+ if ( 'yes' === wcj_get_option( 'wcj_product_images_sale_flash_hide_everywhere', 'no' ) ) {
112
  return '';
113
  }
114
+ if ( 'yes' === wcj_get_option( 'wcj_product_images_sale_flash_hide_on_archives', 'no' ) && is_archive() ) {
115
  return '';
116
  }
117
+ if ( 'yes' === wcj_get_option( 'wcj_product_images_sale_flash_hide_on_single', 'no' ) && is_single() && get_the_ID() === $product_id ) {
118
  return '';
119
  }
120
  // Content
121
+ return do_shortcode( wcj_get_option( 'wcj_product_images_sale_flash_html', '<span class="onsale">' . __( 'Sale!', 'woocommerce' ) . '</span>' ) );
122
  }
123
  return $sale_flash_html;
124
  }
includes/class-wcj-shipping-by-order-amount.php CHANGED
@@ -30,7 +30,7 @@ class WCJ_Shipping_By_Order_Amount extends WCJ_Module {
30
  parent::__construct();
31
 
32
  if ( $this->is_enabled() ) {
33
- $this->use_shipping_instances = ( 'yes' === get_option( 'wcj_shipping_by_order_amount_use_shipping_instance', 'no' ) );
34
  add_filter( 'woocommerce_package_rates', array( $this, 'available_shipping_methods' ), PHP_INT_MAX, 2 );
35
  }
36
  }
@@ -51,9 +51,9 @@ class WCJ_Shipping_By_Order_Amount extends WCJ_Module {
51
  $total_in_cart = WC()->cart->cart_contents_total;
52
  foreach ( $rates as $rate_key => $rate ) {
53
  $min = ( $this->use_shipping_instances ?
54
- get_option( 'wcj_shipping_by_order_amount_min_instance_' . $rate->instance_id, 0 ) : get_option( 'wcj_shipping_by_order_amount_min_' . $rate->method_id, 0 ) );
55
  $max = ( $this->use_shipping_instances ?
56
- get_option( 'wcj_shipping_by_order_amount_max_instance_' . $rate->instance_id, 0 ) : get_option( 'wcj_shipping_by_order_amount_max_' . $rate->method_id, 0 ) );
57
  if ( 0 != $min && $total_in_cart < $min ) {
58
  unset( $rates[ $rate_key ] );
59
  } elseif ( 0 != $max && $total_in_cart > $max ) {
30
  parent::__construct();
31
 
32
  if ( $this->is_enabled() ) {
33
+ $this->use_shipping_instances = ( 'yes' === wcj_get_option( 'wcj_shipping_by_order_amount_use_shipping_instance', 'no' ) );
34
  add_filter( 'woocommerce_package_rates', array( $this, 'available_shipping_methods' ), PHP_INT_MAX, 2 );
35
  }
36
  }
51
  $total_in_cart = WC()->cart->cart_contents_total;
52
  foreach ( $rates as $rate_key => $rate ) {
53
  $min = ( $this->use_shipping_instances ?
54
+ get_option( 'wcj_shipping_by_order_amount_min_instance_' . $rate->instance_id, 0 ) : wcj_get_option( 'wcj_shipping_by_order_amount_min_' . $rate->method_id, 0 ) );
55
  $max = ( $this->use_shipping_instances ?
56
+ get_option( 'wcj_shipping_by_order_amount_max_instance_' . $rate->instance_id, 0 ) : wcj_get_option( 'wcj_shipping_by_order_amount_max_' . $rate->method_id, 0 ) );
57
  if ( 0 != $min && $total_in_cart < $min ) {
58
  unset( $rates[ $rate_key ] );
59
  } elseif ( 0 != $max && $total_in_cart > $max ) {
includes/class-wcj-shipping-by-order-qty.php CHANGED
@@ -30,15 +30,15 @@ class WCJ_Shipping_By_Order_Qty extends WCJ_Module {
30
  parent::__construct();
31
 
32
  if ( $this->is_enabled() ) {
33
- $this->use_shipping_instances = ( 'yes' === get_option( 'wcj_shipping_by_order_qty_use_shipping_instance', 'no' ) );
34
  $min_option_name = 'wcj_shipping_by_order_qty_min';
35
  $max_option_name = 'wcj_shipping_by_order_qty_max';
36
  if ( $this->use_shipping_instances ) {
37
  $min_option_name .= '_instance';
38
  $max_option_name .= '_instance';
39
  }
40
- $this->min_qty = get_option( $min_option_name, array() );
41
- $this->max_qty = get_option( $max_option_name, array() );
42
  add_filter( 'woocommerce_package_rates', array( $this, 'available_shipping_methods' ), PHP_INT_MAX, 2 );
43
  }
44
  }
30
  parent::__construct();
31
 
32
  if ( $this->is_enabled() ) {
33
+ $this->use_shipping_instances = ( 'yes' === wcj_get_option( 'wcj_shipping_by_order_qty_use_shipping_instance', 'no' ) );
34
  $min_option_name = 'wcj_shipping_by_order_qty_min';
35
  $max_option_name = 'wcj_shipping_by_order_qty_max';
36
  if ( $this->use_shipping_instances ) {
37
  $min_option_name .= '_instance';
38
  $max_option_name .= '_instance';
39
  }
40
+ $this->min_qty = wcj_get_option( $min_option_name, array() );
41
+ $this->max_qty = wcj_get_option( $max_option_name, array() );
42
  add_filter( 'woocommerce_package_rates', array( $this, 'available_shipping_methods' ), PHP_INT_MAX, 2 );
43
  }
44
  }
includes/class-wcj-shipping-by-products.php CHANGED
@@ -90,11 +90,11 @@ class WCJ_Shipping_By_Products extends WCJ_Module_Shipping_By_Condition {
90
  * @todo (maybe) if needed, prepare `$products_variations` earlier (and only once)
91
  */
92
  function check( $options_id, $values, $include_or_exclude, $package ) {
93
- $cart_instead_of_package = ( 'yes' === get_option( 'wcj_shipping_by_' . $options_id . '_cart_not_package', 'yes' ) );
94
  if ( ! $this->check_for_data( $cart_instead_of_package, $package ) ) {
95
  return true;
96
  }
97
- if ( 'products' === $options_id && ( $do_add_variations = ( 'yes' === get_option( 'wcj_shipping_by_' . $options_id . '_add_variations_enabled', 'no' ) ) ) ) {
98
  $products_variations = array();
99
  foreach ( $values as $_product_id ) {
100
  $_product = wc_get_product( $_product_id );
@@ -106,7 +106,7 @@ class WCJ_Shipping_By_Products extends WCJ_Module_Shipping_By_Condition {
106
  }
107
  $values = array_unique( $products_variations );
108
  }
109
- $validate_all_for_include = ( 'include' === $include_or_exclude && 'yes' === get_option( 'wcj_shipping_by_' . $options_id . '_validate_all_enabled', 'no' ) );
110
  foreach ( $this->get_items( $cart_instead_of_package, $package ) as $item ) {
111
  switch( $options_id ) {
112
  case 'products':
@@ -158,7 +158,7 @@ class WCJ_Shipping_By_Products extends WCJ_Module_Shipping_By_Condition {
158
  function get_condition_options( $options_id ) {
159
  switch( $options_id ) {
160
  case 'products':
161
- return wcj_get_products( array(), 'any', 1024, ( 'yes' === get_option( 'wcj_shipping_by_' . $options_id . '_add_variations_enabled', 'no' ) ) );
162
  case 'product_cats':
163
  return wcj_get_terms( 'product_cat' );
164
  case 'product_tags':
90
  * @todo (maybe) if needed, prepare `$products_variations` earlier (and only once)
91
  */
92
  function check( $options_id, $values, $include_or_exclude, $package ) {
93
+ $cart_instead_of_package = ( 'yes' === wcj_get_option( 'wcj_shipping_by_' . $options_id . '_cart_not_package', 'yes' ) );
94
  if ( ! $this->check_for_data( $cart_instead_of_package, $package ) ) {
95
  return true;
96
  }
97
+ if ( 'products' === $options_id && ( $do_add_variations = ( 'yes' === wcj_get_option( 'wcj_shipping_by_' . $options_id . '_add_variations_enabled', 'no' ) ) ) ) {
98
  $products_variations = array();
99
  foreach ( $values as $_product_id ) {
100
  $_product = wc_get_product( $_product_id );
106
  }
107
  $values = array_unique( $products_variations );
108
  }
109
+ $validate_all_for_include = ( 'include' === $include_or_exclude && 'yes' === wcj_get_option( 'wcj_shipping_by_' . $options_id . '_validate_all_enabled', 'no' ) );
110
  foreach ( $this->get_items( $cart_instead_of_package, $package ) as $item ) {
111
  switch( $options_id ) {
112
  case 'products':
158
  function get_condition_options( $options_id ) {
159
  switch( $options_id ) {
160
  case 'products':
161
+ return wcj_get_products( array(), 'any', 1024, ( 'yes' === wcj_get_option( 'wcj_shipping_by_' . $options_id . '_add_variations_enabled', 'no' ) ) );
162
  case 'product_cats':
163
  return wcj_get_terms( 'product_cat' );
164
  case 'product_tags':
includes/class-wcj-shipping-by-time.php CHANGED
@@ -107,7 +107,7 @@ class WCJ_Shipping_By_Time extends WCJ_Module_Shipping_By_Condition {
107
  * @since 4.0.0
108
  */
109
  function get_extra_option_desc( $option_id ) {
110
- $values = get_option( $option_id, '' );
111
  if ( ! empty( $values ) ) {
112
  if ( $parsed_time = $this->parse_time( $values ) ) {
113
  return '. ' . sprintf( __( 'According to current time, your time input will be parsed as: from %s to %s.', 'woocommerce-jetpack' ),
107
  * @since 4.0.0
108
  */
109
  function get_extra_option_desc( $option_id ) {
110
+ $values = wcj_get_option( $option_id, '' );
111
  if ( ! empty( $values ) ) {
112
  if ( $parsed_time = $this->parse_time( $values ) ) {
113
  return '. ' . sprintf( __( 'According to current time, your time input will be parsed as: from %s to %s.', 'woocommerce-jetpack' ),
includes/class-wcj-shipping-by-user-role.php CHANGED
@@ -75,7 +75,7 @@ class WCJ_Shipping_By_User_Role extends WCJ_Module_Shipping_By_Condition {
75
  switch( $options_id ) {
76
  case 'user_roles':
77
  if ( empty( $this->customer_roles ) ) {
78
- $this->customer_roles = 'no' === ( $multi_role_check = get_option( 'wcj_' . $this->id . '_check_multiple_roles', 'no' ) ) ? array( wcj_get_current_user_first_role() ) : wcj_get_current_user_all_roles();
79
  }
80
  return count( array_intersect( $this->customer_roles, $user_roles_or_ids_or_membership_plans ) ) > 0;
81
  case 'user_id':
75
  switch( $options_id ) {
76
  case 'user_roles':
77
  if ( empty( $this->customer_roles ) ) {
78
+ $this->customer_roles = 'no' === ( $multi_role_check = wcj_get_option( 'wcj_' . $this->id . '_check_multiple_roles', 'no' ) ) ? array( wcj_get_current_user_first_role() ) : wcj_get_current_user_all_roles();
79
  }
80
  return count( array_intersect( $this->customer_roles, $user_roles_or_ids_or_membership_plans ) ) > 0;
81
  case 'user_id':
includes/class-wcj-shipping-calculator.php CHANGED
@@ -30,7 +30,7 @@ class WCJ_Shipping_Calculator extends WCJ_Module {
30
  add_filter( 'woocommerce_shipping_calculator_enable_city' , array( $this, 'enable_city' ) );
31
  add_filter( 'woocommerce_shipping_calculator_enable_postcode', array( $this, 'enable_postcode' ) );
32
  add_action( 'wp_head', array( $this, 'add_custom_styles' ) );
33
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_shipping_calculator_labels_enabled', 'no' ) ) ) {
34
  add_action( 'wp_enqueue_scripts', array( $this, 'change_labels' ) );
35
  }
36
  }
@@ -47,8 +47,8 @@ class WCJ_Shipping_Calculator extends WCJ_Module {
47
  wp_enqueue_style( 'wcj-shipping-calculator', wcj_plugin_url() . '/includes/css/wcj-shipping-calculator.css', array(), WCJ()->version );
48
  wp_enqueue_script( 'wcj-shipping-calculator-js', wcj_plugin_url() . '/includes/js/wcj-shipping-calculator.js', array( 'jquery' ), WCJ()->version, true );
49
  wp_localize_script( 'wcj-shipping-calculator-js', 'wcj_object', array(
50
- 'calculate_shipping_label' => get_option( 'wcj_shipping_calculator_label_calculate_shipping', '' ),
51
- 'update_totals_label' => get_option( 'wcj_shipping_calculator_label_update_totals', '' ),
52
  ) );
53
  }
54
  }
@@ -60,14 +60,14 @@ class WCJ_Shipping_Calculator extends WCJ_Module {
60
  */
61
  function add_custom_styles() {
62
  $html = '<style type="text/css">';
63
- if ( 'no' === get_option( 'wcj_shipping_calculator_enable_state' ) ) {
64
  $html .= '#calc_shipping_state { display: none !important; }';
65
  }
66
- if ( 'yes' === get_option( 'wcj_shipping_calculator_enable_force_block_open' ) ) {
67
  $html .= '.shipping-calculator-form { display: block !important; }';
68
- if ( 'hide' === get_option( 'wcj_shipping_calculator_enable_force_block_open_button' ) ) {
69
  $html .= 'a.shipping-calculator-button { display: none !important; }';
70
- } elseif ( 'noclick' === get_option( 'wcj_shipping_calculator_enable_force_block_open_button' ) ) {
71
  $html .= 'a.shipping-calculator-button { pointer-events: none; cursor: default; }';
72
  }
73
  }
@@ -81,7 +81,7 @@ class WCJ_Shipping_Calculator extends WCJ_Module {
81
  * @version 2.8.0
82
  */
83
  function enable_city() {
84
- return ( 'yes' === get_option( 'wcj_shipping_calculator_enable_city' ) );
85
  }
86
 
87
  /**
@@ -90,7 +90,7 @@ class WCJ_Shipping_Calculator extends WCJ_Module {
90
  * @version 2.8.0
91
  */
92
  function enable_postcode() {
93
- return ( 'yes' === get_option( 'wcj_shipping_calculator_enable_postcode' ) );
94
  }
95
 
96
  }
30
  add_filter( 'woocommerce_shipping_calculator_enable_city' , array( $this, 'enable_city' ) );
31
  add_filter( 'woocommerce_shipping_calculator_enable_postcode', array( $this, 'enable_postcode' ) );
32
  add_action( 'wp_head', array( $this, 'add_custom_styles' ) );
33
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_shipping_calculator_labels_enabled', 'no' ) ) ) {
34
  add_action( 'wp_enqueue_scripts', array( $this, 'change_labels' ) );
35
  }
36
  }
47
  wp_enqueue_style( 'wcj-shipping-calculator', wcj_plugin_url() . '/includes/css/wcj-shipping-calculator.css', array(), WCJ()->version );
48
  wp_enqueue_script( 'wcj-shipping-calculator-js', wcj_plugin_url() . '/includes/js/wcj-shipping-calculator.js', array( 'jquery' ), WCJ()->version, true );
49
  wp_localize_script( 'wcj-shipping-calculator-js', 'wcj_object', array(
50
+ 'calculate_shipping_label' => wcj_get_option( 'wcj_shipping_calculator_label_calculate_shipping', '' ),
51
+ 'update_totals_label' => wcj_get_option( 'wcj_shipping_calculator_label_update_totals', '' ),
52
  ) );
53
  }
54
  }
60
  */
61
  function add_custom_styles() {
62
  $html = '<style type="text/css">';
63
+ if ( 'no' === wcj_get_option( 'wcj_shipping_calculator_enable_state' ) ) {
64
  $html .= '#calc_shipping_state { display: none !important; }';
65
  }
66
+ if ( 'yes' === wcj_get_option( 'wcj_shipping_calculator_enable_force_block_open' ) ) {
67
  $html .= '.shipping-calculator-form { display: block !important; }';
68
+ if ( 'hide' === wcj_get_option( 'wcj_shipping_calculator_enable_force_block_open_button' ) ) {
69
  $html .= 'a.shipping-calculator-button { display: none !important; }';
70
+ } elseif ( 'noclick' === wcj_get_option( 'wcj_shipping_calculator_enable_force_block_open_button' ) ) {
71
  $html .= 'a.shipping-calculator-button { pointer-events: none; cursor: default; }';
72
  }
73
  }
81
  * @version 2.8.0
82
  */
83
  function enable_city() {
84
+ return ( 'yes' === wcj_get_option( 'wcj_shipping_calculator_enable_city' ) );
85
  }
86
 
87
  /**
90
  * @version 2.8.0
91
  */
92
  function enable_postcode() {
93
+ return ( 'yes' === wcj_get_option( 'wcj_shipping_calculator_enable_postcode' ) );
94
  }
95
 
96
  }
includes/class-wcj-shipping-description.php CHANGED
@@ -29,8 +29,8 @@ class WCJ_Shipping_Descriptions extends WCJ_Module {
29
  parent::__construct();
30
 
31
  if ( $this->is_enabled() ) {
32
- $this->shipping_descriptions_visibility = apply_filters( 'booster_option', 'both', get_option( 'wcj_shipping_descriptions_visibility', 'both' ) );
33
- $this->shipping_descriptions_position = apply_filters( 'booster_option', 'after', get_option( 'wcj_shipping_descriptions_position', 'after' ) );
34
  add_filter( 'woocommerce_cart_shipping_method_full_label', array( $this, 'shipping_description' ), PHP_INT_MAX, 2 );
35
  }
36
  }
@@ -49,9 +49,9 @@ class WCJ_Shipping_Descriptions extends WCJ_Module {
49
  if ( 'cart_only' === $this->shipping_descriptions_visibility && is_checkout() ) {
50
  return $label;
51
  }
52
- $use_shipping_instances = ( 'yes' === get_option( 'wcj_shipping_descriptions_use_shipping_instance', 'no' ) );
53
  $option_id = 'wcj_shipping_description_' . ( $use_shipping_instances ? 'instance_' . $method->instance_id : $method->method_id );
54
- if ( '' != ( $desc = get_option( $option_id, '' ) ) ) {
55
  switch ( $this->shipping_descriptions_position ) {
56
  case 'before':
57
  return $desc . $label;
29
  parent::__construct();
30
 
31
  if ( $this->is_enabled() ) {
32
+ $this->shipping_descriptions_visibility = apply_filters( 'booster_option', 'both', wcj_get_option( 'wcj_shipping_descriptions_visibility', 'both' ) );
33
+ $this->shipping_descriptions_position = apply_filters( 'booster_option', 'after', wcj_get_option( 'wcj_shipping_descriptions_position', 'after' ) );
34
  add_filter( 'woocommerce_cart_shipping_method_full_label', array( $this, 'shipping_description' ), PHP_INT_MAX, 2 );
35
  }
36
  }
49
  if ( 'cart_only' === $this->shipping_descriptions_visibility && is_checkout() ) {
50
  return $label;
51
  }
52
+ $use_shipping_instances = ( 'yes' === wcj_get_option( 'wcj_shipping_descriptions_use_shipping_instance', 'no' ) );
53
  $option_id = 'wcj_shipping_description_' . ( $use_shipping_instances ? 'instance_' . $method->instance_id : $method->method_id );
54
+ if ( '' != ( $desc = wcj_get_option( $option_id, '' ) ) ) {
55
  switch ( $this->shipping_descriptions_position ) {
56
  case 'before':
57
  return $desc . $label;
includes/class-wcj-shipping-icons.php CHANGED
@@ -40,19 +40,19 @@ class WCJ_Shipping_Icons extends WCJ_Module {
40
  * @since 2.5.6
41
  */
42
  function shipping_icon( $label, $method ) {
43
- $shipping_icons_visibility = apply_filters( 'booster_option', 'both', get_option( 'wcj_shipping_icons_visibility', 'both' ) );
44
  if ( 'checkout_only' === $shipping_icons_visibility && is_cart() ) {
45
  return $label;
46
  }
47
  if ( 'cart_only' === $shipping_icons_visibility && is_checkout() ) {
48
  return $label;
49
  }
50
- $use_shipping_instances = ( 'yes' === get_option( 'wcj_shipping_icons_use_shipping_instance', 'no' ) );
51
  $option_id = 'wcj_shipping_icon_' . ( $use_shipping_instances ? 'instance_' . $method->instance_id : $method->method_id );
52
- if ( '' != ( $icon_url = get_option( $option_id, '' ) ) ) {
53
- $style_html = ( '' != ( $style = get_option( 'wcj_shipping_icons_style', 'display:inline;' ) ) ) ? 'style="' . $style . '" ' : '';
54
  $img = '<img ' . $style_html . 'class="wcj_shipping_icon" id="' . $option_id . '" src="' . $icon_url . '">';
55
- $label = ( 'before' === get_option( 'wcj_shipping_icons_position', 'before' ) ) ? $img . ' ' . $label : $label . ' ' . $img;
56
  }
57
  return $label;
58
  }
40
  * @since 2.5.6
41
  */
42
  function shipping_icon( $label, $method ) {
43
+ $shipping_icons_visibility = apply_filters( 'booster_option', 'both', wcj_get_option( 'wcj_shipping_icons_visibility', 'both' ) );
44
  if ( 'checkout_only' === $shipping_icons_visibility && is_cart() ) {
45
  return $label;
46
  }
47
  if ( 'cart_only' === $shipping_icons_visibility && is_checkout() ) {
48
  return $label;
49
  }
50
+ $use_shipping_instances = ( 'yes' === wcj_get_option( 'wcj_shipping_icons_use_shipping_instance', 'no' ) );
51
  $option_id = 'wcj_shipping_icon_' . ( $use_shipping_instances ? 'instance_' . $method->instance_id : $method->method_id );
52
+ if ( '' != ( $icon_url = wcj_get_option( $option_id, '' ) ) ) {
53
+ $style_html = ( '' != ( $style = wcj_get_option( 'wcj_shipping_icons_style', 'display:inline;' ) ) ) ? 'style="' . $style . '" ' : '';
54
  $img = '<img ' . $style_html . 'class="wcj_shipping_icon" id="' . $option_id . '" src="' . $icon_url . '">';
55
+ $label = ( 'before' === wcj_get_option( 'wcj_shipping_icons_position', 'before' ) ) ? $img . ' ' . $label : $label . ' ' . $img;
56
  }
57
  return $label;
58
  }
includes/class-wcj-shipping-options.php CHANGED
@@ -37,14 +37,14 @@ class WCJ_Shipping_Options extends WCJ_Module {
37
  if ( $this->is_enabled() ) {
38
 
39
  // Hide if free is available
40
- if ( 'yes' === get_option( 'wcj_shipping_hide_if_free_available_all', 'no' ) ) {
41
  add_filter( 'woocommerce_package_rates', array( $this, 'hide_shipping_when_free_is_available' ),
42
  wcj_get_woocommerce_package_rates_module_filter_priority( 'shipping_options_hide_free_shipping' ), 2 );
43
  }
44
  add_filter( 'woocommerce_shipping_settings', array( $this, 'add_hide_shipping_if_free_available_fields' ), PHP_INT_MAX );
45
 
46
  // Free shipping by product
47
- if ( 'yes' === get_option( 'wcj_shipping_free_shipping_by_product_enabled', 'no' ) ) {
48
  add_filter( 'woocommerce_shipping_free_shipping_is_available', array( $this, 'free_shipping_by_product' ), PHP_INT_MAX, 2 );
49
  }
50
 
@@ -65,11 +65,11 @@ class WCJ_Shipping_Options extends WCJ_Module {
65
  * @return array
66
  */
67
  function show_most_expensive_shipping( $rates, $package ) {
68
- if ( 'yes' !== get_option( 'wcj_shipping_most_expensive_enabled', 'no' ) ) {
69
  return $rates;
70
  }
71
  $most_expensive_method = '';
72
- $ignored_method_ids = get_option( 'wcj_shipping_most_expensive_ignored_methods', array( 'free_shipping' ) );
73
  $returned_rates = array();
74
  if ( is_array( $rates ) ) :
75
  foreach ( $rates as $key => $rate ) {
@@ -103,11 +103,11 @@ class WCJ_Shipping_Options extends WCJ_Module {
103
  * @return bool
104
  */
105
  function free_shipping_by_product( $is_available, $package ) {
106
- $free_shipping_granting_products = get_option( 'wcj_shipping_free_shipping_by_product_products', '' );
107
  if ( empty( $free_shipping_granting_products ) ) {
108
  return $is_available;
109
  }
110
- $free_shipping_granting_products_type = apply_filters( 'booster_option', 'all', get_option( 'wcj_shipping_free_shipping_by_product_type', 'all' ) );
111
  $package_grants_free_shipping = false;
112
  foreach( $package['contents'] as $item ) {
113
  if ( in_array( $item['product_id'], $free_shipping_granting_products ) ) {
@@ -139,12 +139,12 @@ class WCJ_Shipping_Options extends WCJ_Module {
139
  $free_shipping_rates[ $rate_key ] = $rate;
140
  } else {
141
  if (
142
- 'except_local_pickup' === apply_filters( 'booster_option', 'hide_all', get_option( 'wcj_shipping_hide_if_free_available_type', 'hide_all' ) ) &&
143
  false !== strpos( $rate_key, 'local_pickup' )
144
  ) {
145
  $free_shipping_rates[ $rate_key ] = $rate;
146
  } elseif (
147
- 'flat_rate_only' === apply_filters( 'booster_option', 'hide_all', get_option( 'wcj_shipping_hide_if_free_available_type', 'hide_all' ) ) &&
148
  false === strpos( $rate_key, 'flat_rate' )
149
  ) {
150
  $free_shipping_rates[ $rate_key ] = $rate;
37
  if ( $this->is_enabled() ) {
38
 
39
  // Hide if free is available
40
+ if ( 'yes' === wcj_get_option( 'wcj_shipping_hide_if_free_available_all', 'no' ) ) {
41
  add_filter( 'woocommerce_package_rates', array( $this, 'hide_shipping_when_free_is_available' ),
42
  wcj_get_woocommerce_package_rates_module_filter_priority( 'shipping_options_hide_free_shipping' ), 2 );
43
  }
44
  add_filter( 'woocommerce_shipping_settings', array( $this, 'add_hide_shipping_if_free_available_fields' ), PHP_INT_MAX );
45
 
46
  // Free shipping by product
47
+ if ( 'yes' === wcj_get_option( 'wcj_shipping_free_shipping_by_product_enabled', 'no' ) ) {
48
  add_filter( 'woocommerce_shipping_free_shipping_is_available', array( $this, 'free_shipping_by_product' ), PHP_INT_MAX, 2 );
49
  }
50
 
65
  * @return array
66
  */
67
  function show_most_expensive_shipping( $rates, $package ) {
68
+ if ( 'yes' !== wcj_get_option( 'wcj_shipping_most_expensive_enabled', 'no' ) ) {
69
  return $rates;
70
  }
71
  $most_expensive_method = '';
72
+ $ignored_method_ids = wcj_get_option( 'wcj_shipping_most_expensive_ignored_methods', array( 'free_shipping' ) );
73
  $returned_rates = array();
74
  if ( is_array( $rates ) ) :
75
  foreach ( $rates as $key => $rate ) {
103
  * @return bool
104
  */
105
  function free_shipping_by_product( $is_available, $package ) {
106
+ $free_shipping_granting_products = wcj_get_option( 'wcj_shipping_free_shipping_by_product_products', '' );
107
  if ( empty( $free_shipping_granting_products ) ) {
108
  return $is_available;
109
  }
110
+ $free_shipping_granting_products_type = apply_filters( 'booster_option', 'all', wcj_get_option( 'wcj_shipping_free_shipping_by_product_type', 'all' ) );
111
  $package_grants_free_shipping = false;
112
  foreach( $package['contents'] as $item ) {
113
  if ( in_array( $item['product_id'], $free_shipping_granting_products ) ) {
139
  $free_shipping_rates[ $rate_key ] = $rate;
140
  } else {
141
  if (
142
+ 'except_local_pickup' === apply_filters( 'booster_option', 'hide_all', wcj_get_option( 'wcj_shipping_hide_if_free_available_type', 'hide_all' ) ) &&
143
  false !== strpos( $rate_key, 'local_pickup' )
144
  ) {
145
  $free_shipping_rates[ $rate_key ] = $rate;
146
  } elseif (
147
+ 'flat_rate_only' === apply_filters( 'booster_option', 'hide_all', wcj_get_option( 'wcj_shipping_hide_if_free_available_type', 'hide_all' ) ) &&
148
  false === strpos( $rate_key, 'flat_rate' )
149
  ) {
150
  $free_shipping_rates[ $rate_key ] = $rate;
includes/class-wcj-shipping.php CHANGED
@@ -32,7 +32,7 @@ if ( ! class_exists( 'WCJ_Shipping' ) ) :
32
  add_filter( 'woocommerce_shipping_methods', array( $this, 'add_wc_shipping_wcj_custom_class' ) );
33
 
34
  // Custom Shipping
35
- if ( 'yes' === get_option( 'wcj_shipping_custom_shipping_w_zones_enabled', 'no' ) ) {
36
  add_action( 'woocommerce_shipping_init', array( $this, 'init_shipping_zones_class' ) );
37
  add_filter( 'woocommerce_shipping_methods', array( $this, 'add_wc_shipping_wcj_custom_w_zones_class' ) );
38
  }
@@ -61,7 +61,7 @@ if ( ! class_exists( 'WCJ_Shipping' ) ) :
61
  * @version 4.7.0
62
  */
63
  function add_wc_shipping_wcj_custom_class( $methods ) {
64
- $total_number = get_option( 'wcj_shipping_custom_shipping_total_number', 1 );
65
  if ( ! class_exists( 'WC_Shipping_WCJ_Custom_Template' ) ) {
66
  $this->init_template_class();
67
  }
32
  add_filter( 'woocommerce_shipping_methods', array( $this, 'add_wc_shipping_wcj_custom_class' ) );
33
 
34
  // Custom Shipping
35
+ if ( 'yes' === wcj_get_option( 'wcj_shipping_custom_shipping_w_zones_enabled', 'no' ) ) {
36
  add_action( 'woocommerce_shipping_init', array( $this, 'init_shipping_zones_class' ) );
37
  add_filter( 'woocommerce_shipping_methods', array( $this, 'add_wc_shipping_wcj_custom_w_zones_class' ) );
38
  }
61
  * @version 4.7.0
62
  */
63
  function add_wc_shipping_wcj_custom_class( $methods ) {
64
+ $total_number = wcj_get_option( 'wcj_shipping_custom_shipping_total_number', 1 );
65
  if ( ! class_exists( 'WC_Shipping_WCJ_Custom_Template' ) ) {
66
  $this->init_template_class();
67
  }
includes/class-wcj-sku.php CHANGED
@@ -35,31 +35,31 @@ class WCJ_SKU extends WCJ_Module {
35
 
36
  if ( $this->is_enabled() ) {
37
  // New product
38
- if ( 'yes' === get_option( 'wcj_sku_new_products_generate_enabled', 'yes' ) ) {
39
  add_action( 'wp_insert_post', array( $this, 'set_sku_for_new_product' ), PHP_INT_MAX, 3 );
40
  add_action( 'woocommerce_duplicate_product', array( $this, 'set_new_product_sku_on_duplicate' ), PHP_INT_MAX, 2 );
41
  }
42
  // Allow duplicates
43
- if ( 'yes' === get_option( 'wcj_sku_allow_duplicates_enabled', 'no' ) ) {
44
  add_filter( 'wc_product_has_unique_sku', '__return_false', PHP_INT_MAX );
45
  }
46
  // SKU in emails
47
- if ( 'yes' === get_option( 'wcj_sku_add_to_customer_emails', 'no' ) ) {
48
  add_filter( 'woocommerce_email_order_items_args', array( $this, 'add_sku_to_customer_emails' ), PHP_INT_MAX, 1 );
49
  }
50
- if ( 'yes' === get_option( 'wcj_sku_remove_from_admin_emails', 'no' ) ) {
51
  add_filter( 'woocommerce_email_order_items_args', array( $this, 'remove_sku_from_admin_emails' ), PHP_INT_MAX, 1 );
52
  }
53
  // Search by SKU
54
- if ( 'yes' === get_option( 'wcj_sku_search_enabled', 'no' ) ) {
55
- if ( 'pre_get_posts' === get_option( 'wcj_sku_search_hook', 'pre_get_posts' ) ) {
56
  add_filter( 'pre_get_posts', array( $this, 'add_search_by_sku_to_frontend' ), PHP_INT_MAX );
57
  } else { // 'posts_search'
58
  add_filter( 'posts_search', array( $this, 'add_search_by_sku_to_frontend_posts_search' ), 9 );
59
  }
60
  }
61
  // Disable SKU
62
- if ( 'yes' === get_option( 'wcj_sku_disabled', 'no' ) ) {
63
  add_filter( 'wc_product_sku_enabled', '__return_false', PHP_INT_MAX );
64
  }
65
  // Generate sku on product save
@@ -83,7 +83,7 @@ class WCJ_SKU extends WCJ_Module {
83
  isset( $_GET['wcj-cat'] ) && 'products' === $_GET['wcj-cat'] &&
84
  isset( $_GET['section'] ) && 'sku' === $_GET['section']
85
  ) {
86
- if ( empty( get_option( 'wcj_sku_hashids_salt_default', '' ) ) ) {
87
  $length = 24;
88
  $random_string = substr( str_shuffle( str_repeat( $x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil( $length / strlen( $x ) ) ) ), 1, $length );
89
  update_option( 'wcj_sku_hashids_salt_default', $random_string );
@@ -102,14 +102,14 @@ class WCJ_SKU extends WCJ_Module {
102
  function get_hashids_lib() {
103
  if (
104
  ! is_admin() ||
105
- 'hashids' !== apply_filters( 'booster_option', 'product_id', get_option( 'wcj_sku_number_generation', 'product_id' ) )
106
  ) {
107
  return;
108
  }
109
  if ( empty( $this->hashids ) ) {
110
  require_once( wcj_plugin_path() . '/includes/lib/hashids/src/Hashids.php' );
111
- $sku_format = get_option( 'wcj_sku_hashids_sku_format', 'letters_and_numbers' );
112
- $characters_case = get_option( 'wcj_sku_characters_case', 'original' );
113
  $letters = 'original' == $characters_case ? 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' : ( 'lower' == $characters_case ? 'abcdefghijklmnopqrstuvwxyz' : 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' );
114
  switch ( $sku_format ) {
115
  case 'only_numbers':
@@ -122,7 +122,7 @@ class WCJ_SKU extends WCJ_Module {
122
  $alphabet = $letters . '1234567890';
123
  break;
124
  }
125
- $this->hashids = new Hashids\Hashids( get_option( 'wcj_sku_hashids_salt', get_option( 'wcj_sku_hashids_salt_default', '' ) ), get_option( 'wcj_sku_hashids_sku_length', 6 ), $alphabet );
126
  }
127
  return $this->hashids;
128
  }
@@ -136,7 +136,7 @@ class WCJ_SKU extends WCJ_Module {
136
  * @param $post_id
137
  */
138
  function set_new_sku_on_save( $post_id ) {
139
- if ( 'no' === get_option( 'wcj_sku_generate_on_save', 'no' ) ) {
140
  return;
141
  }
142
  $this->maybe_get_sequential_counters();
@@ -235,7 +235,7 @@ class WCJ_SKU extends WCJ_Module {
235
  * @since 2.9.0
236
  */
237
  function get_sequential_counter( $product_id ) {
238
- if ( 'yes' === get_option( 'wcj_sku_number_generation_sequential_by_cat', 'no' ) ) {
239
  $product_terms = get_the_terms( $product_id, 'product_cat' );
240
  if ( is_array( $product_terms ) ) {
241
  foreach ( $product_terms as $term ) {
@@ -263,7 +263,7 @@ class WCJ_SKU extends WCJ_Module {
263
  $this->set_sku( $product_id, $sku_object, $is_preview );
264
 
265
  // Handling variable products
266
- $variation_handling = apply_filters( 'booster_option', 'as_variable', get_option( 'wcj_sku_variations_handling', 'as_variable' ) );
267
  if ( $product->is_type( 'variable' ) ) {
268
  $variations = $this->get_all_variations( $product );
269
  if ( 'as_variable' === $variation_handling ) {
@@ -382,7 +382,7 @@ class WCJ_SKU extends WCJ_Module {
382
  }
383
  }
384
  }
385
- $format_template = str_replace( $att_str, implode( get_option( 'wcj_sku_variations_product_slug_sep', '-' ), $att_res ), $format_template );
386
  }
387
  }
388
  return $format_template;
@@ -403,7 +403,7 @@ class WCJ_SKU extends WCJ_Module {
403
  * @return mixed|string
404
  */
405
  function generate_sku( $product_id, $variation_suffix, $parent_product_id, $_product, $get_sku_from_parent = true ) {
406
- switch ( apply_filters( 'booster_option', 'product_id', get_option( 'wcj_sku_number_generation', 'product_id' ) ) ) {
407
  case 'sequential':
408
  $sku_number = $this->get_sequential_counter( $parent_product_id );
409
  break;
@@ -418,7 +418,7 @@ class WCJ_SKU extends WCJ_Module {
418
  break;
419
  }
420
 
421
- $format_template = get_option( 'wcj_sku_template',
422
  '{category_prefix}{prefix}{sku_number}{suffix}{category_suffix}{variation_suffix}' );
423
 
424
  global $post;
@@ -430,7 +430,7 @@ class WCJ_SKU extends WCJ_Module {
430
  $parent_product = wc_get_product( $parent_product_id );
431
 
432
  $old_sku = get_post_meta( $product_id, '_sku', true );
433
- $do_generate_new_sku = ( 'no' === get_option( 'wcj_sku_generate_only_for_empty_sku', 'no' ) || '' === $old_sku );
434
 
435
  // {category_prefix} & {category_suffix}
436
  $category_prefix = array();
@@ -440,25 +440,25 @@ class WCJ_SKU extends WCJ_Module {
440
  if ( is_array( $product_terms ) ) {
441
  foreach ( $product_terms as $term ) {
442
  $product_cat[] = esc_html( $term->name );
443
- $category_prefix[] = get_option( 'wcj_sku_prefix_cat_' . $term->term_id, '' );
444
- $category_suffix[] = get_option( 'wcj_sku_suffix_cat_' . $term->term_id, '' );
445
  }
446
  }
447
  $category_prefix = array_filter( $category_prefix );
448
  $category_suffix = array_filter( $category_suffix );
449
- if ( 'first' === get_option( 'wcj_sku_categories_multiple', 'first' ) ) {
450
  $category_prefix = reset( $category_prefix );
451
  $category_suffix = reset( $category_suffix );
452
  } else {
453
- $category_prefix = implode( get_option( 'wcj_sku_categories_multiple_glue', '' ), $category_prefix );
454
- $category_suffix = implode( get_option( 'wcj_sku_categories_multiple_glue', '' ), $category_suffix );
455
  }
456
  $product_cat = implode( ', ', $product_cat );
457
 
458
  // {variation_attributes}
459
  $variation_attributes = '';
460
  if ( false !== strpos( $format_template, '{variation_attributes}' ) && 'WC_Product_Variation' === get_class( $_product ) ) {
461
- $variation_attributes = implode( get_option( 'wcj_sku_variations_product_slug_sep', '-' ), $_product->get_variation_attributes() );
462
  }
463
 
464
  // {variation_attribute=X}
@@ -490,16 +490,16 @@ class WCJ_SKU extends WCJ_Module {
490
  '{parent_product_slug_acronym}' => $parent_product_slug_acronym,
491
  '{variation_attributes}' => $variation_attributes,
492
  '{category_prefix}' => apply_filters( 'booster_option', '', $category_prefix ),
493
- '{prefix}' => get_option( 'wcj_sku_prefix', '' ),
494
- '{sku_number}' => sprintf( '%0' . get_option( 'wcj_sku_minimum_number_length', 0 ) . 's', $sku_number ),
495
- '{suffix}' => get_option( 'wcj_sku_suffix', '' ),
496
  '{category_suffix}' => $category_suffix,
497
  '{variation_suffix}' => $variation_suffix,
498
  );
499
 
500
  if ( $do_generate_new_sku ) {
501
  $the_sku = str_replace( array_keys( $replace_values ), $replace_values, $format_template );
502
- if ( 'original' != ( $characters_case = get_option( 'wcj_sku_characters_case', 'original' ) ) ) {
503
  $the_sku = ( 'lower' == $characters_case ? strtolower( $the_sku ) : strtoupper( $the_sku ) );
504
  }
505
  } else {
@@ -551,13 +551,13 @@ class WCJ_SKU extends WCJ_Module {
551
  * @since 2.9.0
552
  */
553
  function maybe_get_sequential_counters() {
554
- if ( 'sequential' === apply_filters( 'booster_option', 'product_id', get_option( 'wcj_sku_number_generation', 'product_id' ) ) ) {
555
- $this->sequential_counter = apply_filters( 'booster_option', 1, get_option( 'wcj_sku_number_generation_sequential', 1 ) );
556
- if ( 'yes' === get_option( 'wcj_sku_number_generation_sequential_by_cat', 'no' ) ) {
557
  $this->product_categories = get_terms( 'product_cat', 'orderby=name&hide_empty=0' );
558
  if ( ! empty( $this->product_categories ) && ! is_wp_error( $this->product_categories ) ) {
559
  foreach ( $this->product_categories as $product_category ) {
560
- $this->sequential_counter_cats[ $product_category->term_id ] = get_option( 'wcj_sku_counter_cat_' . $product_category->term_id, 1 );
561
  }
562
  }
563
  }
@@ -571,9 +571,9 @@ class WCJ_SKU extends WCJ_Module {
571
  * @since 2.9.0
572
  */
573
  function maybe_save_sequential_counters( $is_preview = false ) {
574
- if ( 'sequential' === apply_filters( 'booster_option', 'product_id', get_option( 'wcj_sku_number_generation', 'product_id' ) ) && ! $is_preview ) {
575
  update_option( 'wcj_sku_number_generation_sequential', $this->sequential_counter );
576
- if ( 'yes' === get_option( 'wcj_sku_number_generation_sequential_by_cat', 'no' ) ) {
577
  if ( ! empty( $this->product_categories ) && ! is_wp_error( $this->product_categories ) ) {
578
  foreach ( $this->product_categories as $product_category ) {
579
  update_option( 'wcj_sku_counter_cat_' . $product_category->term_id, $this->sequential_counter_cats[ $product_category->term_id ] );
@@ -640,7 +640,7 @@ class WCJ_SKU extends WCJ_Module {
640
  if ( 'product' != $post->post_type ) {
641
  return;
642
  }
643
- $do_generate_only_on_first_publish = ( 'yes' === get_option( 'wcj_sku_new_products_generate_only_on_publish', 'no' ) );
644
  if (
645
  ( false === $update && ! $do_generate_only_on_first_publish ) ||
646
  ( $do_generate_only_on_first_publish && 'publish' === $post->post_status && '' == get_post_meta( $post_ID, '_sku', true ) )
35
 
36
  if ( $this->is_enabled() ) {
37
  // New product
38
+ if ( 'yes' === wcj_get_option( 'wcj_sku_new_products_generate_enabled', 'yes' ) ) {
39
  add_action( 'wp_insert_post', array( $this, 'set_sku_for_new_product' ), PHP_INT_MAX, 3 );
40
  add_action( 'woocommerce_duplicate_product', array( $this, 'set_new_product_sku_on_duplicate' ), PHP_INT_MAX, 2 );
41
  }
42
  // Allow duplicates
43
+ if ( 'yes' === wcj_get_option( 'wcj_sku_allow_duplicates_enabled', 'no' ) ) {
44
  add_filter( 'wc_product_has_unique_sku', '__return_false', PHP_INT_MAX );
45
  }
46
  // SKU in emails
47
+ if ( 'yes' === wcj_get_option( 'wcj_sku_add_to_customer_emails', 'no' ) ) {
48
  add_filter( 'woocommerce_email_order_items_args', array( $this, 'add_sku_to_customer_emails' ), PHP_INT_MAX, 1 );
49
  }
50
+ if ( 'yes' === wcj_get_option( 'wcj_sku_remove_from_admin_emails', 'no' ) ) {
51
  add_filter( 'woocommerce_email_order_items_args', array( $this, 'remove_sku_from_admin_emails' ), PHP_INT_MAX, 1 );
52
  }
53
  // Search by SKU
54
+ if ( 'yes' === wcj_get_option( 'wcj_sku_search_enabled', 'no' ) ) {
55
+ if ( 'pre_get_posts' === wcj_get_option( 'wcj_sku_search_hook', 'pre_get_posts' ) ) {
56
  add_filter( 'pre_get_posts', array( $this, 'add_search_by_sku_to_frontend' ), PHP_INT_MAX );
57
  } else { // 'posts_search'
58
  add_filter( 'posts_search', array( $this, 'add_search_by_sku_to_frontend_posts_search' ), 9 );
59
  }
60
  }
61
  // Disable SKU
62
+ if ( 'yes' === wcj_get_option( 'wcj_sku_disabled', 'no' ) ) {
63
  add_filter( 'wc_product_sku_enabled', '__return_false', PHP_INT_MAX );
64
  }
65
  // Generate sku on product save
83
  isset( $_GET['wcj-cat'] ) && 'products' === $_GET['wcj-cat'] &&
84
  isset( $_GET['section'] ) && 'sku' === $_GET['section']
85
  ) {
86
+ if ( empty( wcj_get_option( 'wcj_sku_hashids_salt_default', '' ) ) ) {
87
  $length = 24;
88
  $random_string = substr( str_shuffle( str_repeat( $x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil( $length / strlen( $x ) ) ) ), 1, $length );
89
  update_option( 'wcj_sku_hashids_salt_default', $random_string );
102
  function get_hashids_lib() {
103
  if (
104
  ! is_admin() ||
105
+ 'hashids' !== apply_filters( 'booster_option', 'product_id', wcj_get_option( 'wcj_sku_number_generation', 'product_id' ) )
106
  ) {
107
  return;
108
  }
109
  if ( empty( $this->hashids ) ) {
110
  require_once( wcj_plugin_path() . '/includes/lib/hashids/src/Hashids.php' );
111
+ $sku_format = wcj_get_option( 'wcj_sku_hashids_sku_format', 'letters_and_numbers' );
112
+ $characters_case = wcj_get_option( 'wcj_sku_characters_case', 'original' );
113
  $letters = 'original' == $characters_case ? 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' : ( 'lower' == $characters_case ? 'abcdefghijklmnopqrstuvwxyz' : 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' );
114
  switch ( $sku_format ) {
115
  case 'only_numbers':
122
  $alphabet = $letters . '1234567890';
123
  break;
124
  }
125
+ $this->hashids = new Hashids\Hashids( wcj_get_option( 'wcj_sku_hashids_salt', wcj_get_option( 'wcj_sku_hashids_salt_default', '' ) ), wcj_get_option( 'wcj_sku_hashids_sku_length', 6 ), $alphabet );
126
  }
127
  return $this->hashids;
128
  }
136
  * @param $post_id
137
  */
138
  function set_new_sku_on_save( $post_id ) {
139
+ if ( 'no' === wcj_get_option( 'wcj_sku_generate_on_save', 'no' ) ) {
140
  return;
141
  }
142
  $this->maybe_get_sequential_counters();
235
  * @since 2.9.0
236
  */
237
  function get_sequential_counter( $product_id ) {
238
+ if ( 'yes' === wcj_get_option( 'wcj_sku_number_generation_sequential_by_cat', 'no' ) ) {
239
  $product_terms = get_the_terms( $product_id, 'product_cat' );
240
  if ( is_array( $product_terms ) ) {
241
  foreach ( $product_terms as $term ) {
263
  $this->set_sku( $product_id, $sku_object, $is_preview );
264
 
265
  // Handling variable products
266
+ $variation_handling = apply_filters( 'booster_option', 'as_variable', wcj_get_option( 'wcj_sku_variations_handling', 'as_variable' ) );
267
  if ( $product->is_type( 'variable' ) ) {
268
  $variations = $this->get_all_variations( $product );
269
  if ( 'as_variable' === $variation_handling ) {
382
  }
383
  }
384
  }
385
+ $format_template = str_replace( $att_str, implode( wcj_get_option( 'wcj_sku_variations_product_slug_sep', '-' ), $att_res ), $format_template );
386
  }
387
  }
388
  return $format_template;
403
  * @return mixed|string
404
  */
405
  function generate_sku( $product_id, $variation_suffix, $parent_product_id, $_product, $get_sku_from_parent = true ) {
406
+ switch ( apply_filters( 'booster_option', 'product_id', wcj_get_option( 'wcj_sku_number_generation', 'product_id' ) ) ) {
407
  case 'sequential':
408
  $sku_number = $this->get_sequential_counter( $parent_product_id );
409
  break;
418
  break;
419
  }
420
 
421
+ $format_template = wcj_get_option( 'wcj_sku_template',
422
  '{category_prefix}{prefix}{sku_number}{suffix}{category_suffix}{variation_suffix}' );
423
 
424
  global $post;
430
  $parent_product = wc_get_product( $parent_product_id );
431
 
432
  $old_sku = get_post_meta( $product_id, '_sku', true );
433
+ $do_generate_new_sku = ( 'no' === wcj_get_option( 'wcj_sku_generate_only_for_empty_sku', 'no' ) || '' === $old_sku );
434
 
435
  // {category_prefix} & {category_suffix}
436
  $category_prefix = array();
440
  if ( is_array( $product_terms ) ) {
441
  foreach ( $product_terms as $term ) {
442
  $product_cat[] = esc_html( $term->name );
443
+ $category_prefix[] = wcj_get_option( 'wcj_sku_prefix_cat_' . $term->term_id, '' );
444
+ $category_suffix[] = wcj_get_option( 'wcj_sku_suffix_cat_' . $term->term_id, '' );
445
  }
446
  }
447
  $category_prefix = array_filter( $category_prefix );
448
  $category_suffix = array_filter( $category_suffix );
449
+ if ( 'first' === wcj_get_option( 'wcj_sku_categories_multiple', 'first' ) ) {
450
  $category_prefix = reset( $category_prefix );
451
  $category_suffix = reset( $category_suffix );
452
  } else {
453
+ $category_prefix = implode( wcj_get_option( 'wcj_sku_categories_multiple_glue', '' ), $category_prefix );
454
+ $category_suffix = implode( wcj_get_option( 'wcj_sku_categories_multiple_glue', '' ), $category_suffix );
455
  }
456
  $product_cat = implode( ', ', $product_cat );
457
 
458
  // {variation_attributes}
459
  $variation_attributes = '';
460
  if ( false !== strpos( $format_template, '{variation_attributes}' ) && 'WC_Product_Variation' === get_class( $_product ) ) {
461
+ $variation_attributes = implode( wcj_get_option( 'wcj_sku_variations_product_slug_sep', '-' ), $_product->get_variation_attributes() );
462
  }
463
 
464
  // {variation_attribute=X}
490
  '{parent_product_slug_acronym}' => $parent_product_slug_acronym,
491
  '{variation_attributes}' => $variation_attributes,
492
  '{category_prefix}' => apply_filters( 'booster_option', '', $category_prefix ),
493
+ '{prefix}' => wcj_get_option( 'wcj_sku_prefix', '' ),
494
+ '{sku_number}' => sprintf( '%0' . wcj_get_option( 'wcj_sku_minimum_number_length', 0 ) . 's', $sku_number ),
495
+ '{suffix}' => wcj_get_option( 'wcj_sku_suffix', '' ),
496
  '{category_suffix}' => $category_suffix,
497
  '{variation_suffix}' => $variation_suffix,
498
  );
499
 
500
  if ( $do_generate_new_sku ) {
501
  $the_sku = str_replace( array_keys( $replace_values ), $replace_values, $format_template );
502
+ if ( 'original' != ( $characters_case = wcj_get_option( 'wcj_sku_characters_case', 'original' ) ) ) {
503
  $the_sku = ( 'lower' == $characters_case ? strtolower( $the_sku ) : strtoupper( $the_sku ) );
504
  }
505
  } else {
551
  * @since 2.9.0
552
  */
553
  function maybe_get_sequential_counters() {
554
+ if ( 'sequential' === apply_filters( 'booster_option', 'product_id', wcj_get_option( 'wcj_sku_number_generation', 'product_id' ) ) ) {
555
+ $this->sequential_counter = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_sku_number_generation_sequential', 1 ) );
556
+ if ( 'yes' === wcj_get_option( 'wcj_sku_number_generation_sequential_by_cat', 'no' ) ) {
557
  $this->product_categories = get_terms( 'product_cat', 'orderby=name&hide_empty=0' );
558
  if ( ! empty( $this->product_categories ) && ! is_wp_error( $this->product_categories ) ) {
559
  foreach ( $this->product_categories as $product_category ) {
560
+ $this->sequential_counter_cats[ $product_category->term_id ] = wcj_get_option( 'wcj_sku_counter_cat_' . $product_category->term_id, 1 );
561
  }
562
  }
563
  }
571
  * @since 2.9.0
572
  */
573
  function maybe_save_sequential_counters( $is_preview = false ) {
574
+ if ( 'sequential' === apply_filters( 'booster_option', 'product_id', wcj_get_option( 'wcj_sku_number_generation', 'product_id' ) ) && ! $is_preview ) {
575
  update_option( 'wcj_sku_number_generation_sequential', $this->sequential_counter );
576
+ if ( 'yes' === wcj_get_option( 'wcj_sku_number_generation_sequential_by_cat', 'no' ) ) {
577
  if ( ! empty( $this->product_categories ) && ! is_wp_error( $this->product_categories ) ) {
578
  foreach ( $this->product_categories as $product_category ) {
579
  update_option( 'wcj_sku_counter_cat_' . $product_category->term_id, $this->sequential_counter_cats[ $product_category->term_id ] );
640
  if ( 'product' != $post->post_type ) {
641
  return;
642
  }
643
+ $do_generate_only_on_first_publish = ( 'yes' === wcj_get_option( 'wcj_sku_new_products_generate_only_on_publish', 'no' ) );
644
  if (
645
  ( false === $update && ! $do_generate_only_on_first_publish ) ||
646
  ( $do_generate_only_on_first_publish && 'publish' === $post->post_status && '' == get_post_meta( $post_ID, '_sku', true ) )
includes/class-wcj-sorting.php CHANGED
@@ -29,7 +29,7 @@ class WCJ_Sorting extends WCJ_Module {
29
 
30
  if ( $this->is_enabled() ) {
31
 
32
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_sorting_remove_all_enabled', 'no' ) ) ) {
33
  // Remove All Sorting
34
  add_action( 'wp_loaded', array( $this, 'remove_sorting' ), PHP_INT_MAX );
35
  add_filter( 'wc_get_template', array( $this, 'remove_sorting_template' ), PHP_INT_MAX, 5 );
@@ -37,27 +37,27 @@ class WCJ_Sorting extends WCJ_Module {
37
  } else {
38
 
39
  // Add Custom Sorting
40
- if ( 'yes' === get_option( 'wcj_more_sorting_enabled', 'yes' ) ) {
41
  add_filter( 'woocommerce_get_catalog_ordering_args', array( $this, 'custom_woocommerce_get_catalog_ordering_args' ), PHP_INT_MAX ); // Sorting
42
  add_filter( 'woocommerce_catalog_orderby', array( $this, 'custom_woocommerce_catalog_orderby' ), PHP_INT_MAX ); // Front end
43
  add_filter( 'woocommerce_default_catalog_orderby_options', array( $this, 'custom_woocommerce_catalog_orderby' ), PHP_INT_MAX ); // Back end (default sorting)
44
  }
45
 
46
  // Remove or Rename Default Sorting
47
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_sorting_default_sorting_enabled', 'no' ) ) ) {
48
  add_filter( 'woocommerce_catalog_orderby', array( $this, 'remove_default_sortings' ), PHP_INT_MAX );
49
  add_filter( 'woocommerce_catalog_orderby', array( $this, 'rename_default_sortings' ), PHP_INT_MAX );
50
  add_filter( 'woocommerce_default_catalog_orderby_options', array( $this, 'remove_default_sortings' ), PHP_INT_MAX );
51
  }
52
 
53
  // Rearrange All Sorting
54
- if ( 'yes' === get_option( 'wcj_sorting_rearrange_enabled', 'no' ) ) {
55
  add_filter( 'woocommerce_catalog_orderby', array( $this, 'rearrange_sorting' ), PHP_INT_MAX );
56
  add_filter( 'woocommerce_default_catalog_orderby_options', array( $this, 'rearrange_sorting' ), PHP_INT_MAX );
57
  }
58
 
59
  // Restore Default WooCommerce Sorting
60
- if ( 'yes' === get_option( 'wcj_sorting_restore_default_sorting', 'no' ) ) {
61
  $this->restore_default_sorting();
62
  }
63
  }
@@ -100,7 +100,7 @@ class WCJ_Sorting extends WCJ_Module {
100
  * @since 4.3.0
101
  */
102
  function restore_default_sorting() {
103
- $theme = get_option( 'wcj_sorting_restore_default_sorting_theme', 'avada' );
104
  switch ( $theme ) {
105
  case 'avada':
106
  $this->restore_default_sorting_on_avada();
@@ -128,7 +128,7 @@ class WCJ_Sorting extends WCJ_Module {
128
  * @since 2.6.0
129
  */
130
  function rearrange_sorting( $sortby ) {
131
- $rearranged_sorting = get_option( 'wcj_sorting_rearrange', false );
132
  if ( false === $rearranged_sorting ) {
133
  $rearranged_sorting = $this->get_woocommerce_sortings_order();
134
  } else {
@@ -156,7 +156,7 @@ class WCJ_Sorting extends WCJ_Module {
156
  $default_sortings = $this->get_woocommerce_default_sortings();
157
  foreach ( $default_sortings as $sorting_key => $sorting_desc ) {
158
  $option_key = str_replace( '-', '_', $sorting_key );
159
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_sorting_default_sorting_' . $option_key . '_disable', 'no' ) ) ) {
160
  unset( $sortby[ $sorting_key ] );
161
  }
162
  }
@@ -240,8 +240,8 @@ class WCJ_Sorting extends WCJ_Module {
240
  * @since 2.2.4
241
  */
242
  function maybe_add_sorting( $sortby, $option_name, $key ) {
243
- if ( '' != get_option( $option_name ) ) {
244
- $sortby[ $key ] = get_option( $option_name );
245
  }
246
  return $sortby;
247
  }
@@ -291,13 +291,13 @@ class WCJ_Sorting extends WCJ_Module {
291
  $args['meta_key'] = '';
292
  break;
293
  case 'sku_asc':
294
- $args['orderby'] = ( 'no' === apply_filters( 'booster_option', 'no', get_option( 'wcj_sorting_by_sku_num_enabled', 'no' ) ) ) ?
295
  'meta_value' : 'meta_value_num';
296
  $args['order'] = 'asc';
297
  $args['meta_key'] = '_sku';
298
  break;
299
  case 'sku_desc':
300
- $args['orderby'] = ( 'no' === apply_filters( 'booster_option', 'no', get_option( 'wcj_sorting_by_sku_num_enabled', 'no' ) ) ) ?
301
  'meta_value' : 'meta_value_num';
302
  $args['order'] = 'desc';
303
  $args['meta_key'] = '_sku';
29
 
30
  if ( $this->is_enabled() ) {
31
 
32
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_sorting_remove_all_enabled', 'no' ) ) ) {
33
  // Remove All Sorting
34
  add_action( 'wp_loaded', array( $this, 'remove_sorting' ), PHP_INT_MAX );
35
  add_filter( 'wc_get_template', array( $this, 'remove_sorting_template' ), PHP_INT_MAX, 5 );
37
  } else {
38
 
39
  // Add Custom Sorting
40
+ if ( 'yes' === wcj_get_option( 'wcj_more_sorting_enabled', 'yes' ) ) {
41
  add_filter( 'woocommerce_get_catalog_ordering_args', array( $this, 'custom_woocommerce_get_catalog_ordering_args' ), PHP_INT_MAX ); // Sorting
42
  add_filter( 'woocommerce_catalog_orderby', array( $this, 'custom_woocommerce_catalog_orderby' ), PHP_INT_MAX ); // Front end
43
  add_filter( 'woocommerce_default_catalog_orderby_options', array( $this, 'custom_woocommerce_catalog_orderby' ), PHP_INT_MAX ); // Back end (default sorting)
44
  }
45
 
46
  // Remove or Rename Default Sorting
47
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_sorting_default_sorting_enabled', 'no' ) ) ) {
48
  add_filter( 'woocommerce_catalog_orderby', array( $this, 'remove_default_sortings' ), PHP_INT_MAX );
49
  add_filter( 'woocommerce_catalog_orderby', array( $this, 'rename_default_sortings' ), PHP_INT_MAX );
50
  add_filter( 'woocommerce_default_catalog_orderby_options', array( $this, 'remove_default_sortings' ), PHP_INT_MAX );
51
  }
52
 
53
  // Rearrange All Sorting
54
+ if ( 'yes' === wcj_get_option( 'wcj_sorting_rearrange_enabled', 'no' ) ) {
55
  add_filter( 'woocommerce_catalog_orderby', array( $this, 'rearrange_sorting' ), PHP_INT_MAX );
56
  add_filter( 'woocommerce_default_catalog_orderby_options', array( $this, 'rearrange_sorting' ), PHP_INT_MAX );
57
  }
58
 
59
  // Restore Default WooCommerce Sorting
60
+ if ( 'yes' === wcj_get_option( 'wcj_sorting_restore_default_sorting', 'no' ) ) {
61
  $this->restore_default_sorting();
62
  }
63
  }
100
  * @since 4.3.0
101
  */
102
  function restore_default_sorting() {
103
+ $theme = wcj_get_option( 'wcj_sorting_restore_default_sorting_theme', 'avada' );
104
  switch ( $theme ) {
105
  case 'avada':
106
  $this->restore_default_sorting_on_avada();
128
  * @since 2.6.0
129
  */
130
  function rearrange_sorting( $sortby ) {
131
+ $rearranged_sorting = wcj_get_option( 'wcj_sorting_rearrange', false );
132
  if ( false === $rearranged_sorting ) {
133
  $rearranged_sorting = $this->get_woocommerce_sortings_order();
134
  } else {
156
  $default_sortings = $this->get_woocommerce_default_sortings();
157
  foreach ( $default_sortings as $sorting_key => $sorting_desc ) {
158
  $option_key = str_replace( '-', '_', $sorting_key );
159
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_sorting_default_sorting_' . $option_key . '_disable', 'no' ) ) ) {
160
  unset( $sortby[ $sorting_key ] );
161
  }
162
  }
240
  * @since 2.2.4
241
  */
242
  function maybe_add_sorting( $sortby, $option_name, $key ) {
243
+ if ( '' != wcj_get_option( $option_name ) ) {
244
+ $sortby[ $key ] = wcj_get_option( $option_name );
245
  }
246
  return $sortby;
247
  }
291
  $args['meta_key'] = '';
292
  break;
293
  case 'sku_asc':
294
+ $args['orderby'] = ( 'no' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_sorting_by_sku_num_enabled', 'no' ) ) ) ?
295
  'meta_value' : 'meta_value_num';
296
  $args['order'] = 'asc';
297
  $args['meta_key'] = '_sku';
298
  break;
299
  case 'sku_desc':
300
+ $args['orderby'] = ( 'no' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_sorting_by_sku_num_enabled', 'no' ) ) ) ?
301
  'meta_value' : 'meta_value_num';
302
  $args['order'] = 'desc';
303
  $args['meta_key'] = '_sku';
includes/class-wcj-stock.php CHANGED
@@ -32,15 +32,15 @@ class WCJ_Stock extends WCJ_Module {
32
 
33
  if ( $this->is_enabled() ) {
34
  // Custom "In Stock", "Out of Stock", "Available on backorder"
35
- $this->is_custom_in_stock = ( 'yes' === get_option( 'wcj_stock_custom_in_stock_section_enabled', 'no' ) );
36
- $this->is_custom_in_stock_text = ( 'yes' === get_option( 'wcj_stock_custom_in_stock_enabled', 'no' ) );
37
- $this->is_custom_in_stock_class = ( 'yes' === get_option( 'wcj_stock_custom_in_stock_class_enabled', 'no' ) );
38
- $this->is_custom_out_of_stock = ( 'yes' === get_option( 'wcj_stock_custom_out_of_stock_section_enabled', 'no' ) );
39
- $this->is_custom_out_of_stock_text = ( 'yes' === get_option( 'wcj_stock_custom_out_of_stock_enabled', 'no' ) );
40
- $this->is_custom_out_of_stock_class = ( 'yes' === get_option( 'wcj_stock_custom_out_of_stock_class_enabled', 'no' ) );
41
- $this->is_custom_backorder = ( 'yes' === get_option( 'wcj_stock_custom_backorder_section_enabled', 'no' ) );
42
- $this->is_custom_backorder_text = ( 'yes' === get_option( 'wcj_stock_custom_backorder_enabled', 'no' ) );
43
- $this->is_custom_backorder_class = ( 'yes' === get_option( 'wcj_stock_custom_backorder_class_enabled', 'no' ) );
44
  if ( $this->is_custom_in_stock || $this->is_custom_out_of_stock || $this->is_custom_backorder ) {
45
  if ( $this->is_custom_in_stock_text || $this->is_custom_out_of_stock_text || $this->is_custom_backorder_text ) {
46
  add_filter( 'woocommerce_get_availability_text', array( $this, 'custom_availability_text' ), PHP_INT_MAX, 2 );
@@ -50,7 +50,7 @@ class WCJ_Stock extends WCJ_Module {
50
  }
51
  }
52
  // Custom stock HTML
53
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_stock_custom_stock_html_section_enabled', 'no' ) ) ) {
54
  if ( WCJ_IS_WC_VERSION_BELOW_3 ) {
55
  add_filter( 'woocommerce_stock_html', array( $this, 'custom_stock_html_below_wc_3' ), PHP_INT_MAX, 3 );
56
  } else {
@@ -58,7 +58,7 @@ class WCJ_Stock extends WCJ_Module {
58
  }
59
  }
60
  // Remove stock display
61
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_stock_remove_frontend_display_enabled', 'no' ) ) ) {
62
  add_filter( ( WCJ_IS_WC_VERSION_BELOW_3 ? 'woocommerce_stock_html' : 'woocommerce_get_stock_html' ), '__return_empty_string', PHP_INT_MAX );
63
  }
64
  }
@@ -79,29 +79,29 @@ class WCJ_Stock extends WCJ_Module {
79
  if ( ! $_product->is_in_stock() ) {
80
  if ( $this->is_custom_out_of_stock && $this->is_custom_out_of_stock_text ) {
81
  // Out of stock
82
- return do_shortcode( get_option( 'wcj_stock_custom_out_of_stock', '' ) );
83
  }
84
  } elseif ( $_product->managing_stock() && $_product->is_on_backorder( 1 ) ) {
85
  if ( $this->is_custom_backorder && $this->is_custom_backorder_text ) {
86
  // Available on backorder
87
- return $_product->backorders_require_notification() ? do_shortcode( get_option( 'wcj_stock_custom_backorder', '' ) ) : '';
88
  }
89
  } elseif ( $_product->managing_stock() ) {
90
  if ( $this->is_custom_in_stock && $this->is_custom_in_stock_text ) {
91
  // In stock
92
  if (
93
- '' != ( $low_amount_text = get_option( 'wcj_stock_custom_in_stock_low_amount', '' ) ) &&
94
- 'low_amount' === get_option( 'woocommerce_stock_format' ) && $_product->get_stock_quantity() <= get_option( 'woocommerce_notify_low_stock_amount' )
95
  ) {
96
  // Only %s left in stock
97
  $return = sprintf( do_shortcode( $low_amount_text ),
98
  wc_format_stock_quantity_for_display( $_product->get_stock_quantity(), $_product ) );
99
  } else {
100
  // %s in stock && In stock
101
- $return = sprintf( do_shortcode( get_option( 'wcj_stock_custom_in_stock', '' ) ),
102
  wc_format_stock_quantity_for_display( $_product->get_stock_quantity(), $_product ) );
103
  }
104
- if ( '' != ( $can_be_backordered_text = get_option( 'wcj_stock_custom_in_stock_can_be_backordered', '' ) ) &&
105
  $_product->backorders_allowed() && $_product->backorders_require_notification()
106
  ) {
107
  // (can be backordered)
@@ -125,17 +125,17 @@ class WCJ_Stock extends WCJ_Module {
125
  if ( ! $_product->is_in_stock() ) {
126
  if ( $this->is_custom_out_of_stock && $this->is_custom_out_of_stock_class ) {
127
  // 'out-of-stock'
128
- return get_option( 'wcj_stock_custom_out_of_stock_class', '' );
129
  }
130
  } elseif ( $_product->managing_stock() && $_product->is_on_backorder( 1 ) ) {
131
  if ( $this->is_custom_backorder && $this->is_custom_backorder_class ) {
132
  // 'available-on-backorder'
133
- return get_option( 'wcj_stock_custom_backorder_class', '' );
134
  }
135
  } else {
136
  if ( $this->is_custom_in_stock && $this->is_custom_in_stock_class ) {
137
  // 'in-stock'
138
- return get_option( 'wcj_stock_custom_in_stock_class', '' );
139
  }
140
  }
141
  return $class;
32
 
33
  if ( $this->is_enabled() ) {
34
  // Custom "In Stock", "Out of Stock", "Available on backorder"
35
+ $this->is_custom_in_stock = ( 'yes' === wcj_get_option( 'wcj_stock_custom_in_stock_section_enabled', 'no' ) );
36
+ $this->is_custom_in_stock_text = ( 'yes' === wcj_get_option( 'wcj_stock_custom_in_stock_enabled', 'no' ) );
37
+ $this->is_custom_in_stock_class = ( 'yes' === wcj_get_option( 'wcj_stock_custom_in_stock_class_enabled', 'no' ) );
38
+ $this->is_custom_out_of_stock = ( 'yes' === wcj_get_option( 'wcj_stock_custom_out_of_stock_section_enabled', 'no' ) );
39
+ $this->is_custom_out_of_stock_text = ( 'yes' === wcj_get_option( 'wcj_stock_custom_out_of_stock_enabled', 'no' ) );
40
+ $this->is_custom_out_of_stock_class = ( 'yes' === wcj_get_option( 'wcj_stock_custom_out_of_stock_class_enabled', 'no' ) );
41
+ $this->is_custom_backorder = ( 'yes' === wcj_get_option( 'wcj_stock_custom_backorder_section_enabled', 'no' ) );
42
+ $this->is_custom_backorder_text = ( 'yes' === wcj_get_option( 'wcj_stock_custom_backorder_enabled', 'no' ) );
43
+ $this->is_custom_backorder_class = ( 'yes' === wcj_get_option( 'wcj_stock_custom_backorder_class_enabled', 'no' ) );
44
  if ( $this->is_custom_in_stock || $this->is_custom_out_of_stock || $this->is_custom_backorder ) {
45
  if ( $this->is_custom_in_stock_text || $this->is_custom_out_of_stock_text || $this->is_custom_backorder_text ) {
46
  add_filter( 'woocommerce_get_availability_text', array( $this, 'custom_availability_text' ), PHP_INT_MAX, 2 );
50
  }
51
  }
52
  // Custom stock HTML
53
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_stock_custom_stock_html_section_enabled', 'no' ) ) ) {
54
  if ( WCJ_IS_WC_VERSION_BELOW_3 ) {
55
  add_filter( 'woocommerce_stock_html', array( $this, 'custom_stock_html_below_wc_3' ), PHP_INT_MAX, 3 );
56
  } else {
58
  }
59
  }
60
  // Remove stock display
61
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_stock_remove_frontend_display_enabled', 'no' ) ) ) {
62
  add_filter( ( WCJ_IS_WC_VERSION_BELOW_3 ? 'woocommerce_stock_html' : 'woocommerce_get_stock_html' ), '__return_empty_string', PHP_INT_MAX );
63
  }
64
  }
79
  if ( ! $_product->is_in_stock() ) {
80
  if ( $this->is_custom_out_of_stock && $this->is_custom_out_of_stock_text ) {
81
  // Out of stock
82
+ return do_shortcode( wcj_get_option( 'wcj_stock_custom_out_of_stock', '' ) );
83
  }
84
  } elseif ( $_product->managing_stock() && $_product->is_on_backorder( 1 ) ) {
85
  if ( $this->is_custom_backorder && $this->is_custom_backorder_text ) {
86
  // Available on backorder
87
+ return $_product->backorders_require_notification() ? do_shortcode( wcj_get_option( 'wcj_stock_custom_backorder', '' ) ) : '';
88
  }
89
  } elseif ( $_product->managing_stock() ) {
90
  if ( $this->is_custom_in_stock && $this->is_custom_in_stock_text ) {
91
  // In stock
92
  if (
93
+ '' != ( $low_amount_text = wcj_get_option( 'wcj_stock_custom_in_stock_low_amount', '' ) ) &&
94
+ 'low_amount' === wcj_get_option( 'woocommerce_stock_format' ) && $_product->get_stock_quantity() <= wcj_get_option( 'woocommerce_notify_low_stock_amount' )
95
  ) {
96
  // Only %s left in stock
97
  $return = sprintf( do_shortcode( $low_amount_text ),
98
  wc_format_stock_quantity_for_display( $_product->get_stock_quantity(), $_product ) );
99
  } else {
100
  // %s in stock && In stock
101
+ $return = sprintf( do_shortcode( wcj_get_option( 'wcj_stock_custom_in_stock', '' ) ),
102
  wc_format_stock_quantity_for_display( $_product->get_stock_quantity(), $_product ) );
103
  }
104
+ if ( '' != ( $can_be_backordered_text = wcj_get_option( 'wcj_stock_custom_in_stock_can_be_backordered', '' ) ) &&
105
  $_product->backorders_allowed() && $_product->backorders_require_notification()
106
  ) {
107
  // (can be backordered)
125
  if ( ! $_product->is_in_stock() ) {
126
  if ( $this->is_custom_out_of_stock && $this->is_custom_out_of_stock_class ) {
127
  // 'out-of-stock'
128
+ return wcj_get_option( 'wcj_stock_custom_out_of_stock_class', '' );
129
  }
130
  } elseif ( $_product->managing_stock() && $_product->is_on_backorder( 1 ) ) {
131
  if ( $this->is_custom_backorder && $this->is_custom_backorder_class ) {
132
  // 'available-on-backorder'
133
+ return wcj_get_option( 'wcj_stock_custom_backorder_class', '' );
134
  }
135
  } else {
136
  if ( $this->is_custom_in_stock && $this->is_custom_in_stock_class ) {
137
  // 'in-stock'
138
+ return wcj_get_option( 'wcj_stock_custom_in_stock_class', '' );
139
  }
140
  }
141
  return $class;
includes/class-wcj-tax-display.php CHANGED
@@ -30,18 +30,18 @@ class WCJ_Tax_Display extends WCJ_Module {
30
  if ( $this->is_enabled() ) {
31
 
32
  // Tax Incl./Excl. by product/category
33
- if ( 'yes' === get_option( 'wcj_product_listings_display_taxes_by_products_enabled', 'no' ) ) {
34
  add_filter( 'option_woocommerce_tax_display_shop', array( $this, 'tax_display_by_product' ), PHP_INT_MAX );
35
  }
36
 
37
  // Tax Incl./Excl. by user role
38
- if ( 'yes' === get_option( 'wcj_product_listings_display_taxes_by_user_role_enabled', 'no' ) ) {
39
  add_filter( 'option_woocommerce_tax_display_shop', array( $this, 'tax_display_by_user_role' ), PHP_INT_MAX );
40
  add_filter( 'option_woocommerce_tax_display_cart', array( $this, 'tax_display_by_user_role' ), PHP_INT_MAX );
41
  }
42
 
43
  // Tax toggle
44
- if ( 'yes' === get_option( 'wcj_tax_display_toggle_enabled', 'no' ) ) {
45
  add_action( 'init', array( $this, 'tax_display_toggle_param' ), PHP_INT_MAX );
46
  add_filter( 'option_woocommerce_tax_display_shop', array( $this, 'tax_display_toggle' ), PHP_INT_MAX );
47
  }
@@ -57,7 +57,7 @@ class WCJ_Tax_Display extends WCJ_Module {
57
  function tax_display_toggle_param() {
58
  wcj_session_maybe_start();
59
  if ( isset( $_REQUEST['wcj_button_toggle_tax_display'] ) ) {
60
- $current_value = ( '' == ( $session_value = wcj_session_get( 'wcj_toggle_tax_display' ) ) ? get_option( 'woocommerce_tax_display_shop', 'excl' ) : $session_value );
61
  wcj_session_set( 'wcj_toggle_tax_display', ( 'incl' === $current_value ? 'excl' : 'incl' ) );
62
  }
63
  }
@@ -91,12 +91,12 @@ class WCJ_Tax_Display extends WCJ_Module {
91
  if ( ! wcj_is_frontend() ) {
92
  return $value;
93
  }
94
- if ( '' != ( $display_taxes_by_user_role_roles = get_option( 'wcj_product_listings_display_taxes_by_user_role_roles', '' ) ) ) {
95
  $current_user_roles = wcj_get_current_user_all_roles();
96
  foreach ( $current_user_roles as $current_user_first_role ) {
97
  if ( in_array( $current_user_first_role, $display_taxes_by_user_role_roles ) ) {
98
  $option_name = 'option_woocommerce_tax_display_shop' === current_filter() ? 'wcj_product_listings_display_taxes_by_user_role_' . $current_user_first_role : 'wcj_product_listings_display_taxes_on_cart_by_user_role_' . $current_user_first_role;
99
- if ( 'no_changes' != ( $tax_display = get_option( $option_name, 'no_changes' ) ) ) {
100
  return $tax_display;
101
  }
102
  }
@@ -117,10 +117,10 @@ class WCJ_Tax_Display extends WCJ_Module {
117
  }
118
  $product_id = get_the_ID();
119
  if ( 'product' === get_post_type( $product_id ) ) {
120
- $products_incl_tax = get_option( 'wcj_product_listings_display_taxes_products_incl_tax', '' );
121
- $products_excl_tax = get_option( 'wcj_product_listings_display_taxes_products_excl_tax', '' );
122
- $product_cats_incl_tax = get_option( 'wcj_product_listings_display_taxes_product_cats_incl_tax', '' );
123
- $product_cats_excl_tax = get_option( 'wcj_product_listings_display_taxes_product_cats_excl_tax', '' );
124
  if ( '' != $products_incl_tax || '' != $products_incl_tax || '' != $products_incl_tax || '' != $products_incl_tax ) {
125
  // Products
126
  if ( ! empty( $products_incl_tax ) ) {
30
  if ( $this->is_enabled() ) {
31
 
32
  // Tax Incl./Excl. by product/category
33
+ if ( 'yes' === wcj_get_option( 'wcj_product_listings_display_taxes_by_products_enabled', 'no' ) ) {
34
  add_filter( 'option_woocommerce_tax_display_shop', array( $this, 'tax_display_by_product' ), PHP_INT_MAX );
35
  }
36
 
37
  // Tax Incl./Excl. by user role
38
+ if ( 'yes' === wcj_get_option( 'wcj_product_listings_display_taxes_by_user_role_enabled', 'no' ) ) {
39
  add_filter( 'option_woocommerce_tax_display_shop', array( $this, 'tax_display_by_user_role' ), PHP_INT_MAX );
40
  add_filter( 'option_woocommerce_tax_display_cart', array( $this, 'tax_display_by_user_role' ), PHP_INT_MAX );
41
  }
42
 
43
  // Tax toggle
44
+ if ( 'yes' === wcj_get_option( 'wcj_tax_display_toggle_enabled', 'no' ) ) {
45
  add_action( 'init', array( $this, 'tax_display_toggle_param' ), PHP_INT_MAX );
46
  add_filter( 'option_woocommerce_tax_display_shop', array( $this, 'tax_display_toggle' ), PHP_INT_MAX );
47
  }
57
  function tax_display_toggle_param() {
58
  wcj_session_maybe_start();
59
  if ( isset( $_REQUEST['wcj_button_toggle_tax_display'] ) ) {
60
+ $current_value = ( '' == ( $session_value = wcj_session_get( 'wcj_toggle_tax_display' ) ) ? wcj_get_option( 'woocommerce_tax_display_shop', 'excl' ) : $session_value );
61
  wcj_session_set( 'wcj_toggle_tax_display', ( 'incl' === $current_value ? 'excl' : 'incl' ) );
62
  }
63
  }
91
  if ( ! wcj_is_frontend() ) {
92
  return $value;
93
  }
94
+ if ( '' != ( $display_taxes_by_user_role_roles = wcj_get_option( 'wcj_product_listings_display_taxes_by_user_role_roles', '' ) ) ) {
95
  $current_user_roles = wcj_get_current_user_all_roles();
96
  foreach ( $current_user_roles as $current_user_first_role ) {
97
  if ( in_array( $current_user_first_role, $display_taxes_by_user_role_roles ) ) {
98
  $option_name = 'option_woocommerce_tax_display_shop' === current_filter() ? 'wcj_product_listings_display_taxes_by_user_role_' . $current_user_first_role : 'wcj_product_listings_display_taxes_on_cart_by_user_role_' . $current_user_first_role;
99
+ if ( 'no_changes' != ( $tax_display = wcj_get_option( $option_name, 'no_changes' ) ) ) {
100
  return $tax_display;
101
  }
102
  }
117
  }
118
  $product_id = get_the_ID();
119
  if ( 'product' === get_post_type( $product_id ) ) {
120
+ $products_incl_tax = wcj_get_option( 'wcj_product_listings_display_taxes_products_incl_tax', '' );
121
+ $products_excl_tax = wcj_get_option( 'wcj_product_listings_display_taxes_products_excl_tax', '' );
122
+ $product_cats_incl_tax = wcj_get_option( 'wcj_product_listings_display_taxes_product_cats_incl_tax', '' );
123
+ $product_cats_excl_tax = wcj_get_option( 'wcj_product_listings_display_taxes_product_cats_excl_tax', '' );
124
  if ( '' != $products_incl_tax || '' != $products_incl_tax || '' != $products_incl_tax || '' != $products_incl_tax ) {
125
  // Products
126
  if ( ! empty( $products_incl_tax ) ) {
includes/class-wcj-template-editor.php CHANGED
@@ -30,7 +30,7 @@ class WCJ_Template_Editor extends WCJ_Module {
30
  add_action( 'woojetpack_after_settings_save', array( $this, 'create_templates' ), PHP_INT_MAX, 2 );
31
 
32
  if ( $this->is_enabled() ) {
33
- $this->templates_to_edit = get_option( 'wcj_template_editor_templates_to_edit', array() );
34
  add_filter( 'wc_get_template', array( $this, 'replace_template' ), PHP_INT_MAX, 5 );
35
  }
36
 
@@ -46,8 +46,8 @@ class WCJ_Template_Editor extends WCJ_Module {
46
  function create_templates( $sections, $current_section ) {
47
  if ( $this->id === $current_section ) {
48
  $this->delete_dir( wcj_get_wcj_uploads_dir( 'templates' ) );
49
- $templates_content = get_option( 'wcj_template_editor_templates_content', array() );
50
- foreach ( get_option( 'wcj_template_editor_templates_to_edit', array() ) as $template ) {
51
  if ( isset( $templates_content[ $template ] ) ) {
52
  $_template = explode( '/', $template );
53
  $_template_file = $_template[ count( $_template ) - 1 ];
@@ -84,7 +84,7 @@ class WCJ_Template_Editor extends WCJ_Module {
84
  * @return int|string
85
  */
86
  function get_path_by_template( $template ) {
87
- $templates_by_path = get_option( 'wcj_template_editor_templates_by_path', array() );
88
  foreach ( $templates_by_path as $path => $templates ) {
89
  if ( in_array( $template, $templates ) ) {
90
  return $path;
@@ -102,7 +102,7 @@ class WCJ_Template_Editor extends WCJ_Module {
102
  * @return array
103
  */
104
  function get_paths() {
105
- $paths_arr = explode( "\n", str_replace( "\r", "", get_option( 'wcj_template_editor_paths', '/woocommerce/templates/' ) ) );
106
  return array_map( function ( $path ) {
107
  return trailingslashit( str_replace( '\\', '/', WP_PLUGIN_DIR . $path ) );
108
  }, $paths_arr );
30
  add_action( 'woojetpack_after_settings_save', array( $this, 'create_templates' ), PHP_INT_MAX, 2 );
31
 
32
  if ( $this->is_enabled() ) {
33
+ $this->templates_to_edit = wcj_get_option( 'wcj_template_editor_templates_to_edit', array() );
34
  add_filter( 'wc_get_template', array( $this, 'replace_template' ), PHP_INT_MAX, 5 );
35
  }
36
 
46
  function create_templates( $sections, $current_section ) {
47
  if ( $this->id === $current_section ) {
48
  $this->delete_dir( wcj_get_wcj_uploads_dir( 'templates' ) );
49
+ $templates_content = wcj_get_option( 'wcj_template_editor_templates_content', array() );
50
+ foreach ( wcj_get_option( 'wcj_template_editor_templates_to_edit', array() ) as $template ) {
51
  if ( isset( $templates_content[ $template ] ) ) {
52
  $_template = explode( '/', $template );
53
  $_template_file = $_template[ count( $_template ) - 1 ];
84
  * @return int|string
85
  */
86
  function get_path_by_template( $template ) {
87
+ $templates_by_path = wcj_get_option( 'wcj_template_editor_templates_by_path', array() );
88
  foreach ( $templates_by_path as $path => $templates ) {
89
  if ( in_array( $template, $templates ) ) {
90
  return $path;
102
  * @return array
103
  */
104
  function get_paths() {
105
+ $paths_arr = explode( "\n", str_replace( "\r", "", wcj_get_option( 'wcj_template_editor_paths', '/woocommerce/templates/' ) ) );
106
  return array_map( function ( $path ) {
107
  return trailingslashit( str_replace( '\\', '/', WP_PLUGIN_DIR . $path ) );
108
  }, $paths_arr );
includes/class-wcj-track-users.php CHANGED
@@ -43,13 +43,13 @@ class WCJ_User_Tracking extends WCJ_Module {
43
  add_action( 'wp_ajax_' . 'wcj_track_users', array( $this, 'track_users' ) );
44
  add_action( 'wp_ajax_nopriv_' . 'wcj_track_users', array( $this, 'track_users' ) );
45
  // Stats in dashboard widgets
46
- if ( 'yes' === get_option( 'wcj_track_users_by_country_widget_enabled', 'yes' ) ) {
47
  add_action( 'wp_dashboard_setup', array( $this, 'add_track_users_dashboard_widgets' ) );
48
  add_action( 'admin_init', array( $this, 'maybe_delete_track_users_stats' ) );
49
  add_action( 'admin_init', array( $this, 'track_users_update_county_stats' ) );
50
  }
51
  // Order tracking
52
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_track_users_save_order_http_referer_enabled', 'no' ) ) ) {
53
  add_action( 'woocommerce_new_order', array( $this, 'add_http_referer_to_order' ) );
54
  add_action( 'add_meta_boxes', array( $this, 'add_http_referer_order_meta_box' ) );
55
  }
@@ -59,8 +59,8 @@ class WCJ_User_Tracking extends WCJ_Module {
59
  add_action( 'wcj_track_users_generate_stats', array( $this, 'track_users_generate_stats_cron' ) );
60
  // Orders columns
61
  if (
62
- 'yes' === get_option( 'wcj_track_users_shop_order_columns_referer', 'no' ) ||
63
- 'yes' === get_option( 'wcj_track_users_shop_order_columns_referer_type', 'no' )
64
  ) {
65
  add_filter( 'manage_edit-shop_order_columns', array( $this, 'add_order_columns' ), PHP_INT_MAX - 2 );
66
  add_action( 'manage_shop_order_posts_custom_column', array( $this, 'render_order_columns' ), PHP_INT_MAX );
@@ -75,10 +75,10 @@ class WCJ_User_Tracking extends WCJ_Module {
75
  * @since 3.6.0
76
  */
77
  function add_order_columns( $columns ) {
78
- if ( 'yes' === get_option( 'wcj_track_users_shop_order_columns_referer', 'no' ) ) {
79
  $columns['wcj_track_users_referer'] = __( 'Referer', 'woocommerce-jetpack' );
80
  }
81
- if ( 'yes' === get_option( 'wcj_track_users_shop_order_columns_referer_type', 'no' ) ) {
82
  $columns['wcj_track_users_referer_type'] = __( 'Referer Type', 'woocommerce-jetpack' );
83
  }
84
  return $columns;
@@ -145,7 +145,7 @@ class WCJ_User_Tracking extends WCJ_Module {
145
  */
146
  function track_users_generate_stats_cron( $interval ) {
147
  update_option( 'wcj_track_users_cron_time_last_run', time() );
148
- $stats = get_option( 'wcj_track_users_stats_by_country', array() );
149
  foreach ( $this->track_users_scopes as $scope => $scope_title ) {
150
  $stats[ $scope ] = $this->generate_track_users_stats_by_country( $scope );
151
  }
@@ -262,7 +262,7 @@ class WCJ_User_Tracking extends WCJ_Module {
262
  * @since 2.9.1
263
  */
264
  function get_saved_track_users_stats_by_country( $scope ) {
265
- $stats = get_option( 'wcj_track_users_stats_by_country', array() );
266
  return ( isset( $stats[ $scope ] ) ? $stats[ $scope ] : array() );
267
  }
268
 
@@ -308,9 +308,9 @@ class WCJ_User_Tracking extends WCJ_Module {
308
  * @todo (maybe) display stats by state
309
  */
310
  function track_users_by_country_dashboard_widget( $post, $args ) {
311
- $top_count = get_option( 'wcj_track_users_by_country_widget_top_count', 10 );
312
  foreach ( $this->track_users_scopes as $scope => $scope_title ) {
313
- if ( ! in_array( $scope, get_option( 'wcj_track_users_by_country_widget_scopes', array( '1', '28' ) ) ) ) {
314
  continue;
315
  }
316
  $totals = $this->get_saved_track_users_stats_by_country( $scope );
@@ -335,8 +335,8 @@ class WCJ_User_Tracking extends WCJ_Module {
335
  'onclick="return confirm(\'' . __( 'Are you sure?', 'woocommerce-jetpack' ) . '\')"' .
336
  '>' . __( 'Delete all tracking data', 'woocommerce-jetpack' ) . '</a>' .
337
  '</p>';
338
- $cron_last_run = ( '' != ( $_time = get_option( 'wcj_track_users_cron_time_last_run', '' ) ) ? date( 'Y-m-d H:i:s', $_time ) : '-' );
339
- $cron_next_schedule = ( '' != ( $_time = get_option( 'wcj_track_users_cron_time_schedule', '' ) ) ? date( 'Y-m-d H:i:s', $_time ) : '-' );
340
  echo '<p>' .
341
  sprintf( __( 'Stats generated at %s. Next update is scheduled at %s.', 'woocommerce-jetpack' ), $cron_last_run, $cron_next_schedule ) . ' ' .
342
  '<a href="' . add_query_arg( 'wcj_track_users_update_county_stats', '1' ) . '">' . __( 'Update now', 'woocommerce-jetpack' ) . '</a>.' .
43
  add_action( 'wp_ajax_' . 'wcj_track_users', array( $this, 'track_users' ) );
44
  add_action( 'wp_ajax_nopriv_' . 'wcj_track_users', array( $this, 'track_users' ) );
45
  // Stats in dashboard widgets
46
+ if ( 'yes' === wcj_get_option( 'wcj_track_users_by_country_widget_enabled', 'yes' ) ) {
47
  add_action( 'wp_dashboard_setup', array( $this, 'add_track_users_dashboard_widgets' ) );
48
  add_action( 'admin_init', array( $this, 'maybe_delete_track_users_stats' ) );
49
  add_action( 'admin_init', array( $this, 'track_users_update_county_stats' ) );
50
  }
51
  // Order tracking
52
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_track_users_save_order_http_referer_enabled', 'no' ) ) ) {
53
  add_action( 'woocommerce_new_order', array( $this, 'add_http_referer_to_order' ) );
54
  add_action( 'add_meta_boxes', array( $this, 'add_http_referer_order_meta_box' ) );
55
  }
59
  add_action( 'wcj_track_users_generate_stats', array( $this, 'track_users_generate_stats_cron' ) );
60
  // Orders columns
61
  if (
62
+ 'yes' === wcj_get_option( 'wcj_track_users_shop_order_columns_referer', 'no' ) ||
63
+ 'yes' === wcj_get_option( 'wcj_track_users_shop_order_columns_referer_type', 'no' )
64
  ) {
65
  add_filter( 'manage_edit-shop_order_columns', array( $this, 'add_order_columns' ), PHP_INT_MAX - 2 );
66
  add_action( 'manage_shop_order_posts_custom_column', array( $this, 'render_order_columns' ), PHP_INT_MAX );
75
  * @since 3.6.0
76
  */
77
  function add_order_columns( $columns ) {
78
+ if ( 'yes' === wcj_get_option( 'wcj_track_users_shop_order_columns_referer', 'no' ) ) {
79
  $columns['wcj_track_users_referer'] = __( 'Referer', 'woocommerce-jetpack' );
80
  }
81
+ if ( 'yes' === wcj_get_option( 'wcj_track_users_shop_order_columns_referer_type', 'no' ) ) {
82
  $columns['wcj_track_users_referer_type'] = __( 'Referer Type', 'woocommerce-jetpack' );
83
  }
84
  return $columns;
145
  */
146
  function track_users_generate_stats_cron( $interval ) {
147
  update_option( 'wcj_track_users_cron_time_last_run', time() );
148
+ $stats = wcj_get_option( 'wcj_track_users_stats_by_country', array() );
149
  foreach ( $this->track_users_scopes as $scope => $scope_title ) {
150
  $stats[ $scope ] = $this->generate_track_users_stats_by_country( $scope );
151
  }
262
  * @since 2.9.1
263
  */
264
  function get_saved_track_users_stats_by_country( $scope ) {
265
+ $stats = wcj_get_option( 'wcj_track_users_stats_by_country', array() );
266
  return ( isset( $stats[ $scope ] ) ? $stats[ $scope ] : array() );
267
  }
268
 
308
  * @todo (maybe) display stats by state
309
  */
310
  function track_users_by_country_dashboard_widget( $post, $args ) {
311
+ $top_count = wcj_get_option( 'wcj_track_users_by_country_widget_top_count', 10 );
312
  foreach ( $this->track_users_scopes as $scope => $scope_title ) {
313
+ if ( ! in_array( $scope, wcj_get_option( 'wcj_track_users_by_country_widget_scopes', array( '1', '28' ) ) ) ) {
314
  continue;
315
  }
316
  $totals = $this->get_saved_track_users_stats_by_country( $scope );
335
  'onclick="return confirm(\'' . __( 'Are you sure?', 'woocommerce-jetpack' ) . '\')"' .
336
  '>' . __( 'Delete all tracking data', 'woocommerce-jetpack' ) . '</a>' .
337
  '</p>';
338
+ $cron_last_run = ( '' != ( $_time = wcj_get_option( 'wcj_track_users_cron_time_last_run', '' ) ) ? date( 'Y-m-d H:i:s', $_time ) : '-' );
339
+ $cron_next_schedule = ( '' != ( $_time = wcj_get_option( 'wcj_track_users_cron_time_schedule', '' ) ) ? date( 'Y-m-d H:i:s', $_time ) : '-' );
340
  echo '<p>' .
341
  sprintf( __( 'Stats generated at %s. Next update is scheduled at %s.', 'woocommerce-jetpack' ), $cron_last_run, $cron_next_schedule ) . ' ' .
342
  '<a href="' . add_query_arg( 'wcj_track_users_update_county_stats', '1' ) . '">' . __( 'Update now', 'woocommerce-jetpack' ) . '</a>.' .
includes/class-wcj-upsells.php CHANGED
@@ -37,14 +37,14 @@ class WCJ_Upsells extends WCJ_Module {
37
  add_filter( 'woocommerce_upsells_total', array( $this, 'upsells_total' ), PHP_INT_MAX );
38
  add_filter( 'woocommerce_upsells_columns', array( $this, 'upsells_columns' ), PHP_INT_MAX );
39
  add_filter( 'woocommerce_upsells_orderby', array( $this, 'upsells_orderby' ), PHP_INT_MAX );
40
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_upsells_global_enabled', 'no' ) ) ) {
41
  $upsell_ids_filter = ( WCJ_IS_WC_VERSION_BELOW_3 ? 'woocommerce_product_upsell_ids' : 'woocommerce_product_get_upsell_ids' );
42
  add_filter( $upsell_ids_filter, array( $this, 'upsell_ids' ), PHP_INT_MAX, 2 );
43
  }
44
- if ( 'yes' === get_option( 'wcj_upsells_hide', 'no' ) ) {
45
  add_action( 'init', array( $this, 'hide_upsells' ), PHP_INT_MAX );
46
  }
47
- if ( 'no_changes' != get_option( 'wcj_upsells_position', 'no_changes' ) ) {
48
  add_action( 'init', array( $this, 'reposition_upsells' ), PHP_INT_MAX );
49
  }
50
  }
@@ -60,9 +60,9 @@ class WCJ_Upsells extends WCJ_Module {
60
  function reposition_upsells() {
61
  $this->hide_upsells();
62
  if ( function_exists( 'storefront_upsell_display' ) ) {
63
- add_action( get_option( 'wcj_upsells_position', 'no_changes' ), 'storefront_upsell_display', get_option( 'wcj_upsells_position_priority', 15 ) );
64
  } else {
65
- add_action( get_option( 'wcj_upsells_position', 'no_changes' ), 'woocommerce_upsell_display', get_option( 'wcj_upsells_position_priority', 15 ) );
66
  }
67
  }
68
 
@@ -84,7 +84,7 @@ class WCJ_Upsells extends WCJ_Module {
84
  * @since 3.6.0
85
  */
86
  function upsell_ids( $ids, $_product ) {
87
- $global_upsells = get_option( 'wcj_upsells_global_ids', '' );
88
  if ( ! empty( $global_upsells ) ) {
89
  $global_upsells = array_unique( $global_upsells );
90
  $product_id = wcj_get_product_id_or_variation_parent_id( $_product );
@@ -103,7 +103,7 @@ class WCJ_Upsells extends WCJ_Module {
103
  * @todo (maybe) check for `isset( $args['orderby'] )`
104
  */
105
  function upsells_orderby( $orderby ) {
106
- return ( 'no_changes' != ( $_orderby = get_option( 'wcj_upsells_orderby', 'no_changes' ) ) ? $_orderby : $orderby );
107
  }
108
 
109
  /**
@@ -114,7 +114,7 @@ class WCJ_Upsells extends WCJ_Module {
114
  * @todo (maybe) check for `isset( $args['columns'] )`
115
  */
116
  function upsells_columns( $columns ) {
117
- return ( 0 != ( $_columns = get_option( 'wcj_upsells_columns', 0 ) ) ? $_columns : $columns );
118
  }
119
 
120
  /**
@@ -125,7 +125,7 @@ class WCJ_Upsells extends WCJ_Module {
125
  * @todo (maybe) check for `isset( $args['posts_per_page'] )`
126
  */
127
  function upsells_total( $limit ) {
128
- return ( 0 != ( $_limit = get_option( 'wcj_upsells_total', 0 ) ) ? $_limit : $limit );
129
  }
130
 
131
  }
37
  add_filter( 'woocommerce_upsells_total', array( $this, 'upsells_total' ), PHP_INT_MAX );
38
  add_filter( 'woocommerce_upsells_columns', array( $this, 'upsells_columns' ), PHP_INT_MAX );
39
  add_filter( 'woocommerce_upsells_orderby', array( $this, 'upsells_orderby' ), PHP_INT_MAX );
40
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_upsells_global_enabled', 'no' ) ) ) {
41
  $upsell_ids_filter = ( WCJ_IS_WC_VERSION_BELOW_3 ? 'woocommerce_product_upsell_ids' : 'woocommerce_product_get_upsell_ids' );
42
  add_filter( $upsell_ids_filter, array( $this, 'upsell_ids' ), PHP_INT_MAX, 2 );
43
  }
44
+ if ( 'yes' === wcj_get_option( 'wcj_upsells_hide', 'no' ) ) {
45
  add_action( 'init', array( $this, 'hide_upsells' ), PHP_INT_MAX );
46
  }
47
+ if ( 'no_changes' != wcj_get_option( 'wcj_upsells_position', 'no_changes' ) ) {
48
  add_action( 'init', array( $this, 'reposition_upsells' ), PHP_INT_MAX );
49
  }
50
  }
60
  function reposition_upsells() {
61
  $this->hide_upsells();
62
  if ( function_exists( 'storefront_upsell_display' ) ) {
63
+ add_action( wcj_get_option( 'wcj_upsells_position', 'no_changes' ), 'storefront_upsell_display', wcj_get_option( 'wcj_upsells_position_priority', 15 ) );
64
  } else {
65
+ add_action( wcj_get_option( 'wcj_upsells_position', 'no_changes' ), 'woocommerce_upsell_display', wcj_get_option( 'wcj_upsells_position_priority', 15 ) );
66
  }
67
  }
68
 
84
  * @since 3.6.0
85
  */
86
  function upsell_ids( $ids, $_product ) {
87
+ $global_upsells = wcj_get_option( 'wcj_upsells_global_ids', '' );
88
  if ( ! empty( $global_upsells ) ) {
89
  $global_upsells = array_unique( $global_upsells );
90
  $product_id = wcj_get_product_id_or_variation_parent_id( $_product );
103
  * @todo (maybe) check for `isset( $args['orderby'] )`
104
  */
105
  function upsells_orderby( $orderby ) {
106
+ return ( 'no_changes' != ( $_orderby = wcj_get_option( 'wcj_upsells_orderby', 'no_changes' ) ) ? $_orderby : $orderby );
107
  }
108
 
109
  /**
114
  * @todo (maybe) check for `isset( $args['columns'] )`
115
  */
116
  function upsells_columns( $columns ) {
117
+ return ( 0 != ( $_columns = wcj_get_option( 'wcj_upsells_columns', 0 ) ) ? $_columns : $columns );
118
  }
119
 
120
  /**
125
  * @todo (maybe) check for `isset( $args['posts_per_page'] )`
126
  */
127
  function upsells_total( $limit ) {
128
+ return ( 0 != ( $_limit = wcj_get_option( 'wcj_upsells_total', 0 ) ) ? $_limit : $limit );
129
  }
130
 
131
  }
includes/class-wcj-url-coupons.php CHANGED
@@ -39,13 +39,13 @@ class WCJ_URL_Coupons extends WCJ_Module {
39
  * @since 2.9.1
40
  */
41
  function get_redirect_url( $arg_key ) {
42
- switch ( apply_filters( 'booster_option', 'no', get_option( 'wcj_url_coupons_redirect', 'no' ) ) ) {
43
  case 'cart':
44
  return wc_get_cart_url();
45
  case 'checkout':
46
  return wc_get_checkout_url();
47
  case 'custom':
48
- return get_option( 'wcj_url_coupons_redirect_custom_url', '' );
49
  default: // 'no'
50
  return remove_query_arg( $arg_key );
51
  }
@@ -59,7 +59,7 @@ class WCJ_URL_Coupons extends WCJ_Module {
59
  * @todo (maybe) check if coupon is valid
60
  */
61
  function maybe_add_products_to_cart( $coupon_code ) {
62
- if ( 'no' === apply_filters( 'booster_option', 'no', get_option( 'wcj_url_coupons_fixed_product_discount_add_products', 'no' ) ) ) {
63
  return false;
64
  }
65
  // Coupons are globally disabled.
@@ -91,7 +91,7 @@ class WCJ_URL_Coupons extends WCJ_Module {
91
  * @todo (maybe) if ( ! WC()->cart->has_discount( $coupon_code ) ) {}
92
  */
93
  function maybe_apply_url_coupon() {
94
- $arg_key = get_option( 'wcj_url_coupons_key', 'wcj_apply_coupon' );
95
  if ( isset( $_GET[ $arg_key ] ) && '' != $_GET[ $arg_key ] ) {
96
  $coupon_code = sanitize_text_field( $_GET[ $arg_key ] );
97
  $this->maybe_add_products_to_cart( $coupon_code );
39
  * @since 2.9.1
40
  */
41
  function get_redirect_url( $arg_key ) {
42
+ switch ( apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_url_coupons_redirect', 'no' ) ) ) {
43
  case 'cart':
44
  return wc_get_cart_url();
45
  case 'checkout':
46
  return wc_get_checkout_url();
47
  case 'custom':
48
+ return wcj_get_option( 'wcj_url_coupons_redirect_custom_url', '' );
49
  default: // 'no'
50
  return remove_query_arg( $arg_key );
51
  }
59
  * @todo (maybe) check if coupon is valid
60
  */
61
  function maybe_add_products_to_cart( $coupon_code ) {
62
+ if ( 'no' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_url_coupons_fixed_product_discount_add_products', 'no' ) ) ) {
63
  return false;
64
  }
65
  // Coupons are globally disabled.
91
  * @todo (maybe) if ( ! WC()->cart->has_discount( $coupon_code ) ) {}
92
  */
93
  function maybe_apply_url_coupon() {
94
+ $arg_key = wcj_get_option( 'wcj_url_coupons_key', 'wcj_apply_coupon' );
95
  if ( isset( $_GET[ $arg_key ] ) && '' != $_GET[ $arg_key ] ) {
96
  $coupon_code = sanitize_text_field( $_GET[ $arg_key ] );
97
  $this->maybe_add_products_to_cart( $coupon_code );
includes/class-wcj-wholesale-price.php CHANGED
@@ -32,7 +32,7 @@ class WCJ_Wholesale_Price extends WCJ_Module {
32
 
33
  if ( $this->is_enabled() ) {
34
 
35
- if ( 'yes' === get_option( 'wcj_wholesale_price_per_product_enable', 'yes' ) ) {
36
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
37
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
38
  }
@@ -46,7 +46,7 @@ class WCJ_Wholesale_Price extends WCJ_Module {
46
  add_filter( 'woocommerce_product_variation_get_price', array( $this, 'wholesale_price' ), $this->price_hooks_priority, 2 );
47
  }
48
 
49
- if ( 'yes' === get_option( 'wcj_wholesale_price_show_info_on_cart', 'no' ) ) {
50
  add_filter( 'woocommerce_cart_item_price', array( $this, 'add_discount_info_to_cart_page' ), PHP_INT_MAX, 3 );
51
  }
52
  }
@@ -59,8 +59,8 @@ class WCJ_Wholesale_Price extends WCJ_Module {
59
  * @since 3.4.0
60
  */
61
  function get_price_for_cart( $price, $_product ) {
62
- $product_prices_include_tax = ( 'yes' === get_option( 'woocommerce_prices_include_tax' ) );
63
- $cart_prices_include_tax = ( 'incl' === get_option( 'woocommerce_tax_display_cart' ) );
64
  if ( $product_prices_include_tax != $cart_prices_include_tax ) {
65
  return ( $cart_prices_include_tax ?
66
  wc_get_price_including_tax( $_product, array( 'price' => $price, 'qty' => 1 ) ) :
@@ -77,7 +77,7 @@ class WCJ_Wholesale_Price extends WCJ_Module {
77
  * @since 3.6.0
78
  */
79
  function get_quantity( $cart, $cart_item ) {
80
- switch ( get_option( 'wcj_wholesale_price_use_total_cart_quantity', 'no' ) ) {
81
  case 'total_wholesale': // Total cart quantity (wholesale products only)
82
  $qty = $cart->cart_contents_count;
83
  foreach ( $cart->cart_contents as $item_key => $item ) {
@@ -106,7 +106,7 @@ class WCJ_Wholesale_Price extends WCJ_Module {
106
  if ( 0 != $discount ) {
107
  $discount_type = ( wcj_is_product_wholesale_enabled_per_product( $cart_item['product_id'] ) )
108
  ? get_post_meta( $cart_item['product_id'], '_' . 'wcj_wholesale_price_discount_type', true )
109
- : get_option( 'wcj_wholesale_price_discount_type', 'percent' );
110
  $_product = $cart_item['data'];
111
  if ( 'price_directly' === $discount_type ) {
112
  $saved_wcj_wholesale_price = false;
@@ -114,19 +114,19 @@ class WCJ_Wholesale_Price extends WCJ_Module {
114
  $saved_wcj_wholesale_price = $_product->wcj_wholesale_price;
115
  unset( $_product->wcj_wholesale_price );
116
  }
117
- $price = 'do_not_consider_qty' === get_option( 'wcj_wholesale_price_template_vars_discount_value_pdt', 'do_not_consider_qty' ) ? $_product->get_price() - $discount : ( $_product->get_price() - $discount ) * $the_quantity;
118
  $discount = wc_price( $this->get_price_for_cart( $price, $_product ) );
119
  if ( false !== $saved_wcj_wholesale_price ) {
120
  $_product->wcj_wholesale_price = $saved_wcj_wholesale_price;
121
  }
122
  } elseif ( 'fixed' === $discount_type ) {
123
- $price = 'do_not_consider_qty' === get_option( 'wcj_wholesale_price_template_vars_discount_value_fdt', 'do_not_consider_qty' ) ? $discount : $discount * $the_quantity;
124
  $discount = wc_price( $this->get_price_for_cart( $price, $_product ) );
125
  } else {
126
  $discount = $discount . '%';
127
  }
128
  $old_price_html = wc_price( $cart_item['wcj_wholesale_price_old'] );
129
- $wholesale_price_html = get_option( 'wcj_wholesale_price_show_info_on_cart_format' );
130
  $replaced_values = array(
131
  '%old_price%' => $old_price_html,
132
  '%price%' => $price_html,
@@ -151,7 +151,7 @@ class WCJ_Wholesale_Price extends WCJ_Module {
151
 
152
  // Check for user role options
153
  $role_option_name_addon = '';
154
- $user_roles = get_option( 'wcj_wholesale_price_by_user_role_roles', '' );
155
  if ( ! empty( $user_roles ) ) {
156
  $current_user_role = wcj_get_current_user_first_role();
157
  foreach ( $user_roles as $user_role_key ) {
@@ -163,7 +163,7 @@ class WCJ_Wholesale_Price extends WCJ_Module {
163
  }
164
 
165
  // Get discount
166
- $max_qty_level = get_option( 'wcj_wholesale_price_max_qty_level', 1 );
167
  $discount = 0;
168
  if ( wcj_is_product_wholesale_enabled_per_product( $product_id ) ) {
169
  for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_post_meta( $product_id, '_' . 'wcj_wholesale_price_levels_number' . $role_option_name_addon, true ) ); $i++ ) {
@@ -174,11 +174,11 @@ class WCJ_Wholesale_Price extends WCJ_Module {
174
  }
175
  }
176
  } else {
177
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_wholesale_price_levels_number' . $role_option_name_addon, 1 ) ); $i++ ) {
178
- $level_qty = get_option( 'wcj_wholesale_price_level_min_qty' . $role_option_name_addon . '_' . $i, PHP_INT_MAX );
179
  if ( $quantity >= $level_qty && $level_qty >= $max_qty_level ) {
180
  $max_qty_level = $level_qty;
181
- $discount = get_option( 'wcj_wholesale_price_level_discount_percent' . $role_option_name_addon . '_' . $i, 0 );
182
  }
183
  }
184
  }
@@ -195,7 +195,7 @@ class WCJ_Wholesale_Price extends WCJ_Module {
195
  $discount = $this->get_discount_by_quantity( $quantity, $product_id );
196
  $discount_type = ( wcj_is_product_wholesale_enabled_per_product( $product_id ) )
197
  ? get_post_meta( $product_id, '_' . 'wcj_wholesale_price_discount_type', true )
198
- : get_option( 'wcj_wholesale_price_discount_type', 'percent' );
199
  if ( 'price_directly' === $discount_type ) {
200
  return ( 0 != $discount ) ? apply_filters( 'wcj_get_wholesale_price', $discount, $product_id ) : $price;
201
  } elseif ( 'percent' === $discount_type ) {
@@ -245,7 +245,7 @@ class WCJ_Wholesale_Price extends WCJ_Module {
245
  continue;
246
  }
247
 
248
- if ( 'yes' === get_option( 'wcj_wholesale_price_check_for_product_changes_price', 'no' ) && $_product ) {
249
  $product_changes = $_product->get_changes();
250
  if ( ! empty( $product_changes ) && isset( $product_changes['price'] ) ) {
251
  continue;
@@ -257,7 +257,7 @@ class WCJ_Wholesale_Price extends WCJ_Module {
257
  $price_old = wcj_get_product_display_price( $_product, '', 1, 'cart' ); // used for display only
258
 
259
  // If other discount was applied in cart...
260
- if ( 'yes' === get_option( 'wcj_wholesale_price_apply_only_if_no_other_discounts', 'no' ) ) {
261
  if ( WC()->cart->get_total_discount() > 0 || sizeof( WC()->cart->applied_coupons ) > 0 ) {
262
  continue;
263
  }
@@ -267,8 +267,8 @@ class WCJ_Wholesale_Price extends WCJ_Module {
267
  $the_quantity = $this->get_quantity( $cart, $item );
268
  if ( $the_quantity > 0 ) {
269
  $wholesale_price = $this->get_wholesale_price( $price, $the_quantity, wcj_get_product_id_or_variation_parent_id( $_product ) );
270
- if ( 'yes' === get_option( 'wcj_wholesale_price_rounding_enabled', 'yes' ) ) {
271
- $wholesale_price = round( $wholesale_price, get_option( 'woocommerce_price_num_decimals', 2 ) );
272
  }
273
  if ( $wholesale_price != $price ) {
274
  // Setting wholesale price
32
 
33
  if ( $this->is_enabled() ) {
34
 
35
+ if ( 'yes' === wcj_get_option( 'wcj_wholesale_price_per_product_enable', 'yes' ) ) {
36
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
37
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
38
  }
46
  add_filter( 'woocommerce_product_variation_get_price', array( $this, 'wholesale_price' ), $this->price_hooks_priority, 2 );
47
  }
48
 
49
+ if ( 'yes' === wcj_get_option( 'wcj_wholesale_price_show_info_on_cart', 'no' ) ) {
50
  add_filter( 'woocommerce_cart_item_price', array( $this, 'add_discount_info_to_cart_page' ), PHP_INT_MAX, 3 );
51
  }
52
  }
59
  * @since 3.4.0
60
  */
61
  function get_price_for_cart( $price, $_product ) {
62
+ $product_prices_include_tax = ( 'yes' === wcj_get_option( 'woocommerce_prices_include_tax' ) );
63
+ $cart_prices_include_tax = ( 'incl' === wcj_get_option( 'woocommerce_tax_display_cart' ) );
64
  if ( $product_prices_include_tax != $cart_prices_include_tax ) {
65
  return ( $cart_prices_include_tax ?
66
  wc_get_price_including_tax( $_product, array( 'price' => $price, 'qty' => 1 ) ) :
77
  * @since 3.6.0
78
  */
79
  function get_quantity( $cart, $cart_item ) {
80
+ switch ( wcj_get_option( 'wcj_wholesale_price_use_total_cart_quantity', 'no' ) ) {
81
  case 'total_wholesale': // Total cart quantity (wholesale products only)
82
  $qty = $cart->cart_contents_count;
83
  foreach ( $cart->cart_contents as $item_key => $item ) {
106
  if ( 0 != $discount ) {
107
  $discount_type = ( wcj_is_product_wholesale_enabled_per_product( $cart_item['product_id'] ) )
108
  ? get_post_meta( $cart_item['product_id'], '_' . 'wcj_wholesale_price_discount_type', true )
109
+ : wcj_get_option( 'wcj_wholesale_price_discount_type', 'percent' );
110
  $_product = $cart_item['data'];
111
  if ( 'price_directly' === $discount_type ) {
112
  $saved_wcj_wholesale_price = false;
114
  $saved_wcj_wholesale_price = $_product->wcj_wholesale_price;
115
  unset( $_product->wcj_wholesale_price );
116
  }
117
+ $price = 'do_not_consider_qty' === wcj_get_option( 'wcj_wholesale_price_template_vars_discount_value_pdt', 'do_not_consider_qty' ) ? $_product->get_price() - $discount : ( $_product->get_price() - $discount ) * $the_quantity;
118
  $discount = wc_price( $this->get_price_for_cart( $price, $_product ) );
119
  if ( false !== $saved_wcj_wholesale_price ) {
120
  $_product->wcj_wholesale_price = $saved_wcj_wholesale_price;
121
  }
122
  } elseif ( 'fixed' === $discount_type ) {
123
+ $price = 'do_not_consider_qty' === wcj_get_option( 'wcj_wholesale_price_template_vars_discount_value_fdt', 'do_not_consider_qty' ) ? $discount : $discount * $the_quantity;
124
  $discount = wc_price( $this->get_price_for_cart( $price, $_product ) );
125
  } else {
126
  $discount = $discount . '%';
127
  }
128
  $old_price_html = wc_price( $cart_item['wcj_wholesale_price_old'] );
129
+ $wholesale_price_html = wcj_get_option( 'wcj_wholesale_price_show_info_on_cart_format' );
130
  $replaced_values = array(
131
  '%old_price%' => $old_price_html,
132
  '%price%' => $price_html,
151
 
152
  // Check for user role options
153
  $role_option_name_addon = '';
154
+ $user_roles = wcj_get_option( 'wcj_wholesale_price_by_user_role_roles', '' );
155
  if ( ! empty( $user_roles ) ) {
156
  $current_user_role = wcj_get_current_user_first_role();
157
  foreach ( $user_roles as $user_role_key ) {
163
  }
164
 
165
  // Get discount
166
+ $max_qty_level = wcj_get_option( 'wcj_wholesale_price_max_qty_level', 1 );
167
  $discount = 0;
168
  if ( wcj_is_product_wholesale_enabled_per_product( $product_id ) ) {
169
  for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_post_meta( $product_id, '_' . 'wcj_wholesale_price_levels_number' . $role_option_name_addon, true ) ); $i++ ) {
174
  }
175
  }
176
  } else {
177
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_wholesale_price_levels_number' . $role_option_name_addon, 1 ) ); $i++ ) {
178
+ $level_qty = wcj_get_option( 'wcj_wholesale_price_level_min_qty' . $role_option_name_addon . '_' . $i, PHP_INT_MAX );
179
  if ( $quantity >= $level_qty && $level_qty >= $max_qty_level ) {
180
  $max_qty_level = $level_qty;
181
+ $discount = wcj_get_option( 'wcj_wholesale_price_level_discount_percent' . $role_option_name_addon . '_' . $i, 0 );
182
  }
183
  }
184
  }
195
  $discount = $this->get_discount_by_quantity( $quantity, $product_id );
196
  $discount_type = ( wcj_is_product_wholesale_enabled_per_product( $product_id ) )
197
  ? get_post_meta( $product_id, '_' . 'wcj_wholesale_price_discount_type', true )
198
+ : wcj_get_option( 'wcj_wholesale_price_discount_type', 'percent' );
199
  if ( 'price_directly' === $discount_type ) {
200
  return ( 0 != $discount ) ? apply_filters( 'wcj_get_wholesale_price', $discount, $product_id ) : $price;
201
  } elseif ( 'percent' === $discount_type ) {
245
  continue;
246
  }
247
 
248
+ if ( 'yes' === wcj_get_option( 'wcj_wholesale_price_check_for_product_changes_price', 'no' ) && $_product ) {
249
  $product_changes = $_product->get_changes();
250
  if ( ! empty( $product_changes ) && isset( $product_changes['price'] ) ) {
251
  continue;
257
  $price_old = wcj_get_product_display_price( $_product, '', 1, 'cart' ); // used for display only
258
 
259
  // If other discount was applied in cart...
260
+ if ( 'yes' === wcj_get_option( 'wcj_wholesale_price_apply_only_if_no_other_discounts', 'no' ) ) {
261
  if ( WC()->cart->get_total_discount() > 0 || sizeof( WC()->cart->applied_coupons ) > 0 ) {
262
  continue;
263
  }
267
  $the_quantity = $this->get_quantity( $cart, $item );
268
  if ( $the_quantity > 0 ) {
269
  $wholesale_price = $this->get_wholesale_price( $price, $the_quantity, wcj_get_product_id_or_variation_parent_id( $_product ) );
270
+ if ( 'yes' === wcj_get_option( 'wcj_wholesale_price_rounding_enabled', 'yes' ) ) {
271
+ $wholesale_price = round( $wholesale_price, wcj_get_option( 'woocommerce_price_num_decimals', 2 ) );
272
  }
273
  if ( $wholesale_price != $price ) {
274
  // Setting wholesale price
includes/class-wcj-wpml.php CHANGED
@@ -33,7 +33,7 @@ class WCJ_WPML extends WCJ_Module {
33
 
34
  if ( $this->is_enabled() ) {
35
  add_action( 'init', array( $this, 'create_wpml_xml_file_tool' ), PHP_INT_MAX );
36
- if ( 'yes' === get_option( 'wcj_wpml_config_xml_auto_regenerate', 'no' ) ) {
37
  add_action( 'wcj_version_updated', array( $this, 'create_wpml_xml_file' ) );
38
  }
39
  add_action( 'wcml_switch_currency', array( $this, 'switch_currency_using_multicurrency' ) );
@@ -63,7 +63,7 @@ class WCJ_WPML extends WCJ_Module {
63
  function update_meta_on_correspondent_language_product( $meta_id, $object_id, $meta_key, $meta_value ) {
64
  $allowed_metas_like = array( '_wcj_price_by_country_' );
65
  if (
66
- 'no' === get_option( 'wcj_wpml_sync_metas', 'no' )
67
  || ( 'product' != get_post_type( $object_id ) && 'product_variation' != get_post_type( $object_id ) )
68
  || count( array_filter( $allowed_metas_like, function ( $item ) use ( $meta_key ) {
69
  return strpos( $meta_key, $item ) !== false;
@@ -100,7 +100,7 @@ class WCJ_WPML extends WCJ_Module {
100
  */
101
  function switch_currency_using_multicurrency( $currency ) {
102
  if (
103
- 'no' === get_option( 'wcj_wpml_switch_booster_currency', 'no' ) ||
104
  ! WCJ()->modules['multicurrency']->is_enabled()
105
  ) {
106
  return;
@@ -239,7 +239,7 @@ class WCJ_WPML extends WCJ_Module {
239
  * @since 2.4.4
240
  */
241
  function is_wpml_section( $section ) {
242
- return ( ! in_array( $section, get_option( 'wcj_wpml_config_xml_modules_to_skip', $this->get_default_modules_to_skip() ) ) );
243
  }
244
 
245
  /**
@@ -253,7 +253,7 @@ class WCJ_WPML extends WCJ_Module {
253
  $is_type_ok = ( 'textarea' === $value['type'] || 'custom_textarea' === $value['type'] || 'text' === $value['type'] );
254
 
255
  // ID
256
- $values_to_skip = array_filter( array_map( 'trim', explode( '|', get_option( 'wcj_wpml_config_xml_values_to_skip', $this->get_default_values_to_skip() ) ) ) );
257
  $is_id_ok = true;
258
  foreach ( $values_to_skip as $value_to_skip ) {
259
  if ( false !== strpos( $value['id'], $value_to_skip ) ) {
33
 
34
  if ( $this->is_enabled() ) {
35
  add_action( 'init', array( $this, 'create_wpml_xml_file_tool' ), PHP_INT_MAX );
36
+ if ( 'yes' === wcj_get_option( 'wcj_wpml_config_xml_auto_regenerate', 'no' ) ) {
37
  add_action( 'wcj_version_updated', array( $this, 'create_wpml_xml_file' ) );
38
  }
39
  add_action( 'wcml_switch_currency', array( $this, 'switch_currency_using_multicurrency' ) );
63
  function update_meta_on_correspondent_language_product( $meta_id, $object_id, $meta_key, $meta_value ) {
64
  $allowed_metas_like = array( '_wcj_price_by_country_' );
65
  if (
66
+ 'no' === wcj_get_option( 'wcj_wpml_sync_metas', 'no' )
67
  || ( 'product' != get_post_type( $object_id ) && 'product_variation' != get_post_type( $object_id ) )
68
  || count( array_filter( $allowed_metas_like, function ( $item ) use ( $meta_key ) {
69
  return strpos( $meta_key, $item ) !== false;
100
  */
101
  function switch_currency_using_multicurrency( $currency ) {
102
  if (
103
+ 'no' === wcj_get_option( 'wcj_wpml_switch_booster_currency', 'no' ) ||
104
  ! WCJ()->modules['multicurrency']->is_enabled()
105
  ) {
106
  return;
239
  * @since 2.4.4
240
  */
241
  function is_wpml_section( $section ) {
242
+ return ( ! in_array( $section, wcj_get_option( 'wcj_wpml_config_xml_modules_to_skip', $this->get_default_modules_to_skip() ) ) );
243
  }
244
 
245
  /**
253
  $is_type_ok = ( 'textarea' === $value['type'] || 'custom_textarea' === $value['type'] || 'text' === $value['type'] );
254
 
255
  // ID
256
+ $values_to_skip = array_filter( array_map( 'trim', explode( '|', wcj_get_option( 'wcj_wpml_config_xml_values_to_skip', $this->get_default_values_to_skip() ) ) ) );
257
  $is_id_ok = true;
258
  foreach ( $values_to_skip as $value_to_skip ) {
259
  if ( false !== strpos( $value['id'], $value_to_skip ) ) {
includes/classes/class-wcj-invoice.php CHANGED
@@ -38,9 +38,9 @@ class WCJ_Invoice {
38
  function delete() {
39
  update_post_meta( $this->order_id, '_wcj_invoicing_' . $this->invoice_type . '_number_id', 0 );
40
  update_post_meta( $this->order_id, '_wcj_invoicing_' . $this->invoice_type . '_date', '' );
41
- if ( 'yes' === get_option( 'wcj_invoicing_' . $this->invoice_type . '_sequential_enabled', 'no' ) ) {
42
  $option_name = 'wcj_invoicing_' . $this->invoice_type . '_numbering_counter';
43
- $the_invoice_counter = get_option( $option_name, 1 );
44
  update_option( $option_name, ( $the_invoice_counter - 1 ) );
45
  }
46
  }
@@ -54,14 +54,14 @@ class WCJ_Invoice {
54
  function create( $date = '' ) {
55
  $order_id = $this->order_id;
56
  $invoice_type = $this->invoice_type;
57
- if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type . '_skip_zero_total', 'no' ) ) {
58
  $_order = wc_get_order( $order_id );
59
  if ( 0 == $_order->get_total() ) {
60
  return;
61
  }
62
  }
63
- if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type . '_sequential_enabled', 'no' ) ) {
64
- $the_invoice_number = get_option( 'wcj_invoicing_' . $invoice_type . '_numbering_counter', 1 );
65
  update_option( 'wcj_invoicing_' . $invoice_type . '_numbering_counter', ( $the_invoice_number + 1 ) );
66
  } else {
67
  $the_invoice_number = $order_id;
@@ -77,7 +77,7 @@ class WCJ_Invoice {
77
  * @version 3.5.0
78
  */
79
  function get_file_name() {
80
- $_file_name = sanitize_file_name( do_shortcode( get_option( 'wcj_invoicing_' . $this->invoice_type . '_file_name', '' ) ) );
81
  if ( '' === $_file_name ) {
82
  $_file_name = $this->invoice_type . '-' . $this->order_id;
83
  }
@@ -99,10 +99,10 @@ class WCJ_Invoice {
99
  */
100
  function get_invoice_number() {
101
  $replaced_values = array(
102
- '%prefix%' => get_option( 'wcj_invoicing_' . $this->invoice_type . '_numbering_prefix', '' ),
103
- '%counter%' => sprintf( '%0' . get_option( 'wcj_invoicing_' . $this->invoice_type . '_numbering_counter_width', 0 ) . 'd',
104
  get_post_meta( $this->order_id, '_wcj_invoicing_' . $this->invoice_type . '_number_id', true ) ),
105
- '%suffix%' => get_option( 'wcj_invoicing_' . $this->invoice_type . '_numbering_suffix', '' ),
106
  );
107
  return apply_filters( 'wcj_get_' . $this->invoice_type . '_number',
108
  do_shortcode( str_replace( array_keys( $replaced_values ), $replaced_values,
38
  function delete() {
39
  update_post_meta( $this->order_id, '_wcj_invoicing_' . $this->invoice_type . '_number_id', 0 );
40
  update_post_meta( $this->order_id, '_wcj_invoicing_' . $this->invoice_type . '_date', '' );
41
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $this->invoice_type . '_sequential_enabled', 'no' ) ) {
42
  $option_name = 'wcj_invoicing_' . $this->invoice_type . '_numbering_counter';
43
+ $the_invoice_counter = wcj_get_option( $option_name, 1 );
44
  update_option( $option_name, ( $the_invoice_counter - 1 ) );
45
  }
46
  }
54
  function create( $date = '' ) {
55
  $order_id = $this->order_id;
56
  $invoice_type = $this->invoice_type;
57
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_skip_zero_total', 'no' ) ) {
58
  $_order = wc_get_order( $order_id );
59
  if ( 0 == $_order->get_total() ) {
60
  return;
61
  }
62
  }
63
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_sequential_enabled', 'no' ) ) {
64
+ $the_invoice_number = wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_numbering_counter', 1 );
65
  update_option( 'wcj_invoicing_' . $invoice_type . '_numbering_counter', ( $the_invoice_number + 1 ) );
66
  } else {
67
  $the_invoice_number = $order_id;
77
  * @version 3.5.0
78
  */
79
  function get_file_name() {
80
+ $_file_name = sanitize_file_name( do_shortcode( wcj_get_option( 'wcj_invoicing_' . $this->invoice_type . '_file_name', '' ) ) );
81
  if ( '' === $_file_name ) {
82
  $_file_name = $this->invoice_type . '-' . $this->order_id;
83
  }
99
  */
100
  function get_invoice_number() {
101
  $replaced_values = array(
102
+ '%prefix%' => wcj_get_option( 'wcj_invoicing_' . $this->invoice_type . '_numbering_prefix', '' ),
103
+ '%counter%' => sprintf( '%0' . wcj_get_option( 'wcj_invoicing_' . $this->invoice_type . '_numbering_counter_width', 0 ) . 'd',
104
  get_post_meta( $this->order_id, '_wcj_invoicing_' . $this->invoice_type . '_number_id', true ) ),
105
+ '%suffix%' => wcj_get_option( 'wcj_invoicing_' . $this->invoice_type . '_numbering_suffix', '' ),
106
  );
107
  return apply_filters( 'wcj_get_' . $this->invoice_type . '_number',
108
  do_shortcode( str_replace( array_keys( $replaced_values ), $replaced_values,
includes/classes/class-wcj-module-product-by-condition.php CHANGED
@@ -29,15 +29,15 @@ abstract class WCJ_Module_Product_By_Condition extends WCJ_Module {
29
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
30
  // Core
31
  if ( wcj_is_frontend() ) {
32
- if ( 'yes' === get_option( 'wcj_' . $this->id . '_visibility', 'yes' ) ) {
33
  add_filter( 'woocommerce_product_is_visible', array( $this, 'is_visible' ), PHP_INT_MAX, 2 );
34
  }
35
- if ( 'yes' === get_option( 'wcj_' . $this->id . '_purchasable', 'no' ) ) {
36
  add_filter( 'woocommerce_is_purchasable', array( $this, 'is_purchasable' ), PHP_INT_MAX, 2 );
37
  }
38
- if ( 'yes' === get_option( 'wcj_' . $this->id . '_query', 'no' ) ) {
39
  add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
40
- if ( 'yes' === get_option( 'wcj_' . $this->id . '_query_widgets', 'no' ) ) {
41
  add_filter( 'woocommerce_products_widget_query_args', array( $this, 'products_widget_query' ), PHP_INT_MAX );
42
  }
43
  }
@@ -45,19 +45,19 @@ abstract class WCJ_Module_Product_By_Condition extends WCJ_Module {
45
  }
46
  // Quick and bulk edit
47
  if (
48
- 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_' . $this->id . '_admin_bulk_edit', 'no' ) ) ||
49
- 'yes' === get_option( 'wcj_' . $this->id . '_admin_quick_edit', 'no' )
50
  ) {
51
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_' . $this->id . '_admin_bulk_edit', 'no' ) ) ) {
52
  add_action( 'woocommerce_product_bulk_edit_end', array( $this, 'add_bulk_and_quick_edit_fields' ), PHP_INT_MAX );
53
  }
54
- if ( 'yes' === get_option( 'wcj_' . $this->id . '_admin_quick_edit', 'no' ) ) {
55
  add_action( 'woocommerce_product_quick_edit_end', array( $this, 'add_bulk_and_quick_edit_fields' ), PHP_INT_MAX );
56
  }
57
  add_action( 'woocommerce_product_bulk_and_quick_edit', array( $this, 'save_bulk_and_quick_edit_fields' ), PHP_INT_MAX, 2 );
58
  }
59
  // Admin products list
60
- if ( 'yes' === get_option( 'wcj_' . $this->id . '_admin_add_column', 'no' ) ) {
61
  add_filter( 'manage_edit-product_columns', array( $this, 'add_product_columns' ), PHP_INT_MAX );
62
  add_action( 'manage_product_posts_custom_column', array( $this, 'render_product_column' ), PHP_INT_MAX );
63
  }
@@ -113,14 +113,14 @@ abstract class WCJ_Module_Product_By_Condition extends WCJ_Module {
113
  */
114
  function get_invisible_products_query_args() {
115
  $meta_query = array();
116
- if ( 'invisible' != apply_filters( 'booster_option', 'visible', get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
117
  $meta_query[] = array(
118
  'key' => '_' . 'wcj_' . $this->id . '_visible',
119
  'value' => '',
120
  'compare' => '!=',
121
  );
122
  }
123
- if ( 'visible' != apply_filters( 'booster_option', 'visible', get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
124
  $meta_query[] = array(
125
  'key' => '_' . 'wcj_' . $this->id . '_invisible',
126
  'value' => '',
@@ -228,14 +228,14 @@ abstract class WCJ_Module_Product_By_Condition extends WCJ_Module {
228
  function render_product_column( $column ) {
229
  if ( 'wcj_' . $this->id === $column ) {
230
  $result = '';
231
- if ( 'invisible' != apply_filters( 'booster_option', 'visible', get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
232
  if ( $visible = get_post_meta( wcj_maybe_get_product_id_wpml( get_the_ID() ), '_' . 'wcj_' . $this->id . '_visible', true ) ) {
233
  if ( is_array( $visible ) ) {
234
  $result .= '<span style="color:green;">' . implode( ', ', $visible ) . '</span>';
235
  }
236
  }
237
  }
238
- if ( 'visible' != apply_filters( 'booster_option', 'visible', get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
239
  if ( $invisible = get_post_meta( wcj_maybe_get_product_id_wpml( get_the_ID() ), '_' . 'wcj_' . $this->id . '_invisible', true ) ) {
240
  if ( is_array( $invisible ) ) {
241
  if ( '' != $result ) {
@@ -261,7 +261,7 @@ abstract class WCJ_Module_Product_By_Condition extends WCJ_Module {
261
  foreach ( $this->get_options_list() as $id => $desc ) {
262
  $all_options .= '<option value="' . $id . '">' . $desc . '</option>';
263
  }
264
- if ( 'invisible' != apply_filters( 'booster_option', 'visible', get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
265
  ?><br class="clear" />
266
  <label>
267
  <span class="title"><?php echo $this->title . ': ' . esc_html_e( 'Visible', 'woocommerce-jetpack' ); ?></span>
@@ -270,7 +270,7 @@ abstract class WCJ_Module_Product_By_Condition extends WCJ_Module {
270
  </select>
271
  </label><?php
272
  }
273
- if ( 'visible' != apply_filters( 'booster_option', 'visible', get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
274
  ?><br class="clear" />
275
  <label>
276
  <span class="title"><?php echo $this->title . ': ' . esc_html_e( 'Invisible', 'woocommerce-jetpack' ); ?></span>
@@ -302,23 +302,23 @@ abstract class WCJ_Module_Product_By_Condition extends WCJ_Module {
302
  }
303
  // Check bulk or quick edit.
304
  if ( ! empty( $_REQUEST['woocommerce_quick_edit'] ) ) { // WPCS: input var ok.
305
- if ( 'no' === get_option( 'wcj_' . $this->id . '_admin_quick_edit', 'no' ) ) {
306
  return $post_id;
307
  }
308
  } else {
309
- if ( 'no' === apply_filters( 'booster_option', 'no', get_option( 'wcj_' . $this->id . '_admin_bulk_edit', 'no' ) ) ) {
310
  return $post_id;
311
  }
312
  }
313
  // Save.
314
- if ( 'invisible' != apply_filters( 'booster_option', 'visible', get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
315
  if ( ! isset( $_REQUEST[ 'wcj_' . $this->id . '_visible' ] ) ) {
316
  update_post_meta( $post_id, '_' . 'wcj_' . $this->id . '_visible', array() );
317
  } elseif ( is_array( $_REQUEST[ 'wcj_' . $this->id . '_visible' ] ) && ! in_array( 'wcj_no_change', $_REQUEST[ 'wcj_' . $this->id . '_visible' ] ) ) {
318
  update_post_meta( $post_id, '_' . 'wcj_' . $this->id . '_visible', $_REQUEST[ 'wcj_' . $this->id . '_visible' ] );
319
  }
320
  }
321
- if ( 'visible' != apply_filters( 'booster_option', 'visible', get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
322
  if ( ! isset( $_REQUEST[ 'wcj_' . $this->id . '_invisible' ] ) ) {
323
  update_post_meta( $post_id, '_' . 'wcj_' . $this->id . '_invisible', array() );
324
  } elseif ( is_array( $_REQUEST[ 'wcj_' . $this->id . '_invisible' ] ) && ! in_array( 'wcj_no_change', $_REQUEST[ 'wcj_' . $this->id . '_invisible' ] ) ) {
@@ -407,7 +407,7 @@ abstract class WCJ_Module_Product_By_Condition extends WCJ_Module {
407
  * @todo (maybe) replace with `abstract is_product_visible()`
408
  */
409
  function is_product_visible( $product_id, $option_to_check ) {
410
- if ( 'invisible' != apply_filters( 'booster_option', 'visible', get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
411
  $visible = get_post_meta( wcj_maybe_get_product_id_wpml( $product_id ), '_' . 'wcj_' . $this->id . '_visible', true );
412
  if ( ! empty( $visible ) && is_array( $visible ) ) {
413
  if ( is_array( $option_to_check ) ) {
@@ -422,7 +422,7 @@ abstract class WCJ_Module_Product_By_Condition extends WCJ_Module {
422
  }
423
  }
424
  }
425
- if ( 'visible' != apply_filters( 'booster_option', 'visible', get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
426
  $invisible = get_post_meta( wcj_maybe_get_product_id_wpml( $product_id ), '_' . 'wcj_' . $this->id . '_invisible', true );
427
  if ( ! empty( $invisible ) && is_array( $invisible ) ) {
428
  if ( is_array( $option_to_check ) ) {
29
  add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
30
  // Core
31
  if ( wcj_is_frontend() ) {
32
+ if ( 'yes' === wcj_get_option( 'wcj_' . $this->id . '_visibility', 'yes' ) ) {
33
  add_filter( 'woocommerce_product_is_visible', array( $this, 'is_visible' ), PHP_INT_MAX, 2 );
34
  }
35
+ if ( 'yes' === wcj_get_option( 'wcj_' . $this->id . '_purchasable', 'no' ) ) {
36
  add_filter( 'woocommerce_is_purchasable', array( $this, 'is_purchasable' ), PHP_INT_MAX, 2 );
37
  }
38
+ if ( 'yes' === wcj_get_option( 'wcj_' . $this->id . '_query', 'no' ) ) {
39
  add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
40
+ if ( 'yes' === wcj_get_option( 'wcj_' . $this->id . '_query_widgets', 'no' ) ) {
41
  add_filter( 'woocommerce_products_widget_query_args', array( $this, 'products_widget_query' ), PHP_INT_MAX );
42
  }
43
  }
45
  }
46
  // Quick and bulk edit
47
  if (
48
+ 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_' . $this->id . '_admin_bulk_edit', 'no' ) ) ||
49
+ 'yes' === wcj_get_option( 'wcj_' . $this->id . '_admin_quick_edit', 'no' )
50
  ) {
51
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_' . $this->id . '_admin_bulk_edit', 'no' ) ) ) {
52
  add_action( 'woocommerce_product_bulk_edit_end', array( $this, 'add_bulk_and_quick_edit_fields' ), PHP_INT_MAX );
53
  }
54
+ if ( 'yes' === wcj_get_option( 'wcj_' . $this->id . '_admin_quick_edit', 'no' ) ) {
55
  add_action( 'woocommerce_product_quick_edit_end', array( $this, 'add_bulk_and_quick_edit_fields' ), PHP_INT_MAX );
56
  }
57
  add_action( 'woocommerce_product_bulk_and_quick_edit', array( $this, 'save_bulk_and_quick_edit_fields' ), PHP_INT_MAX, 2 );
58
  }
59
  // Admin products list
60
+ if ( 'yes' === wcj_get_option( 'wcj_' . $this->id . '_admin_add_column', 'no' ) ) {
61
  add_filter( 'manage_edit-product_columns', array( $this, 'add_product_columns' ), PHP_INT_MAX );
62
  add_action( 'manage_product_posts_custom_column', array( $this, 'render_product_column' ), PHP_INT_MAX );
63
  }
113
  */
114
  function get_invisible_products_query_args() {
115
  $meta_query = array();
116
+ if ( 'invisible' != apply_filters( 'booster_option', 'visible', wcj_get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
117
  $meta_query[] = array(
118
  'key' => '_' . 'wcj_' . $this->id . '_visible',
119
  'value' => '',
120
  'compare' => '!=',
121
  );
122
  }
123
+ if ( 'visible' != apply_filters( 'booster_option', 'visible', wcj_get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
124
  $meta_query[] = array(
125
  'key' => '_' . 'wcj_' . $this->id . '_invisible',
126
  'value' => '',
228
  function render_product_column( $column ) {
229
  if ( 'wcj_' . $this->id === $column ) {
230
  $result = '';
231
+ if ( 'invisible' != apply_filters( 'booster_option', 'visible', wcj_get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
232
  if ( $visible = get_post_meta( wcj_maybe_get_product_id_wpml( get_the_ID() ), '_' . 'wcj_' . $this->id . '_visible', true ) ) {
233
  if ( is_array( $visible ) ) {
234
  $result .= '<span style="color:green;">' . implode( ', ', $visible ) . '</span>';
235
  }
236
  }
237
  }
238
+ if ( 'visible' != apply_filters( 'booster_option', 'visible', wcj_get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
239
  if ( $invisible = get_post_meta( wcj_maybe_get_product_id_wpml( get_the_ID() ), '_' . 'wcj_' . $this->id . '_invisible', true ) ) {
240
  if ( is_array( $invisible ) ) {
241
  if ( '' != $result ) {
261
  foreach ( $this->get_options_list() as $id => $desc ) {
262
  $all_options .= '<option value="' . $id . '">' . $desc . '</option>';
263
  }
264
+ if ( 'invisible' != apply_filters( 'booster_option', 'visible', wcj_get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
265
  ?><br class="clear" />
266
  <label>
267
  <span class="title"><?php echo $this->title . ': ' . esc_html_e( 'Visible', 'woocommerce-jetpack' ); ?></span>
270
  </select>
271
  </label><?php
272
  }
273
+ if ( 'visible' != apply_filters( 'booster_option', 'visible', wcj_get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
274
  ?><br class="clear" />
275
  <label>
276
  <span class="title"><?php echo $this->title . ': ' . esc_html_e( 'Invisible', 'woocommerce-jetpack' ); ?></span>
302
  }
303
  // Check bulk or quick edit.
304
  if ( ! empty( $_REQUEST['woocommerce_quick_edit'] ) ) { // WPCS: input var ok.
305
+ if ( 'no' === wcj_get_option( 'wcj_' . $this->id . '_admin_quick_edit', 'no' ) ) {
306
  return $post_id;
307
  }
308
  } else {
309
+ if ( 'no' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_' . $this->id . '_admin_bulk_edit', 'no' ) ) ) {
310
  return $post_id;
311
  }
312
  }
313
  // Save.
314
+ if ( 'invisible' != apply_filters( 'booster_option', 'visible', wcj_get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
315
  if ( ! isset( $_REQUEST[ 'wcj_' . $this->id . '_visible' ] ) ) {
316
  update_post_meta( $post_id, '_' . 'wcj_' . $this->id . '_visible', array() );
317
  } elseif ( is_array( $_REQUEST[ 'wcj_' . $this->id . '_visible' ] ) && ! in_array( 'wcj_no_change', $_REQUEST[ 'wcj_' . $this->id . '_visible' ] ) ) {
318
  update_post_meta( $post_id, '_' . 'wcj_' . $this->id . '_visible', $_REQUEST[ 'wcj_' . $this->id . '_visible' ] );
319
  }
320
  }
321
+ if ( 'visible' != apply_filters( 'booster_option', 'visible', wcj_get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
322
  if ( ! isset( $_REQUEST[ 'wcj_' . $this->id . '_invisible' ] ) ) {
323
  update_post_meta( $post_id, '_' . 'wcj_' . $this->id . '_invisible', array() );
324
  } elseif ( is_array( $_REQUEST[ 'wcj_' . $this->id . '_invisible' ] ) && ! in_array( 'wcj_no_change', $_REQUEST[ 'wcj_' . $this->id . '_invisible' ] ) ) {
407
  * @todo (maybe) replace with `abstract is_product_visible()`
408
  */
409
  function is_product_visible( $product_id, $option_to_check ) {
410
+ if ( 'invisible' != apply_filters( 'booster_option', 'visible', wcj_get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
411
  $visible = get_post_meta( wcj_maybe_get_product_id_wpml( $product_id ), '_' . 'wcj_' . $this->id . '_visible', true );
412
  if ( ! empty( $visible ) && is_array( $visible ) ) {
413
  if ( is_array( $option_to_check ) ) {
422
  }
423
  }
424
  }
425
+ if ( 'visible' != apply_filters( 'booster_option', 'visible', wcj_get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
426
  $invisible = get_post_meta( wcj_maybe_get_product_id_wpml( $product_id ), '_' . 'wcj_' . $this->id . '_invisible', true );
427
  if ( ! empty( $invisible ) && is_array( $invisible ) ) {
428
  if ( is_array( $option_to_check ) ) {
includes/classes/class-wcj-module-shipping-by-condition.php CHANGED
@@ -22,7 +22,7 @@ abstract class WCJ_Module_Shipping_By_Condition extends WCJ_Module {
22
  function __construct( $type = 'module' ) {
23
  parent::__construct( $type );
24
  if ( $this->is_enabled() ) {
25
- $this->use_shipping_instances = ( 'yes' === get_option( 'wcj_' . $this->id . '_use_shipping_instance', 'no' ) );
26
  add_filter( 'woocommerce_package_rates', array( $this, 'available_shipping_methods' ), wcj_get_woocommerce_package_rates_module_filter_priority( $this->id ) , 2 );
27
  }
28
  }
@@ -51,7 +51,7 @@ abstract class WCJ_Module_Shipping_By_Condition extends WCJ_Module {
51
  $exclude_arr = array();
52
  foreach ( $rates as $rate_key => $rate ) {
53
  foreach ( $this->condition_options as $options_id => $options_data ) {
54
- if ( 'no' === get_option( 'wcj_shipping_by_' . $options_id . '_section_enabled', 'yes' ) ) {
55
  continue;
56
  }
57
  $include = ( $this->use_shipping_instances ?
22
  function __construct( $type = 'module' ) {
23
  parent::__construct( $type );
24
  if ( $this->is_enabled() ) {
25
+ $this->use_shipping_instances = ( 'yes' === wcj_get_option( 'wcj_' . $this->id . '_use_shipping_instance', 'no' ) );
26
  add_filter( 'woocommerce_package_rates', array( $this, 'available_shipping_methods' ), wcj_get_woocommerce_package_rates_module_filter_priority( $this->id ) , 2 );
27
  }
28
  }
51
  $exclude_arr = array();
52
  foreach ( $rates as $rate_key => $rate ) {
53
  foreach ( $this->condition_options as $options_id => $options_data ) {
54
+ if ( 'no' === wcj_get_option( 'wcj_shipping_by_' . $options_id . '_section_enabled', 'yes' ) ) {
55
  continue;
56
  }
57
  $include = ( $this->use_shipping_instances ?
includes/classes/class-wcj-module.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce Module
4
  *
5
- * @version 5.2.1
6
  * @since 2.2.0
7
  * @author Pluggabl LLC.
8
  * @todo [dev] maybe should be `abstract` ?
@@ -25,24 +25,6 @@ class WCJ_Module {
25
  public $link;
26
  public $options = array();
27
 
28
- /**
29
- * Gets an option from database or from the class itself for performance reasons.
30
- *
31
- * @version 4.5.0
32
- * @since 4.5.0
33
- *
34
- * @param $option_name
35
- * @param null $default
36
- *
37
- * @return mixed
38
- */
39
- function get_option( $option_name, $default = null ){
40
- if ( ! isset( $this->options[ $option_name ] ) ) {
41
- $this->options[ $option_name ] = get_option( $option_name, $default );
42
- }
43
- return $this->options[ $option_name ];
44
- }
45
-
46
  /**
47
  * Constructor.
48
  *
@@ -56,7 +38,7 @@ class WCJ_Module {
56
  $this->parent_id = '';
57
  }
58
 
59
- if ( 'no' === get_option( 'wcj_load_modules_on_init', 'no' ) ) {
60
  add_action( 'init', array( $this, 'add_settings' ) );
61
  add_action( 'init', array( $this, 'reset_settings' ), PHP_INT_MAX );
62
  } else {
@@ -106,7 +88,7 @@ class WCJ_Module {
106
  * @since 4.7.0
107
  */
108
  function remove_wpml_hooks() {
109
- if ( 'no' === get_option( 'wcj_' . $this->id . '_wpml_get_products_all_lang', 'no' ) ) {
110
  return;
111
  }
112
 
@@ -123,7 +105,7 @@ class WCJ_Module {
123
  * @param null $module_id
124
  */
125
  function restore_wpml_args_on_get_products( $module_id = null ){
126
- if ( 'no' === get_option( 'wcj_' . $this->id . '_wpml_get_products_all_lang', 'no' ) ) {
127
  return;
128
  }
129
  remove_action( 'pre_get_posts', array( $this, 'suppress_filters' ) );
@@ -142,7 +124,7 @@ class WCJ_Module {
142
  * @param null $module_id
143
  */
144
  function add_wpml_args_on_get_products( $module_id = null ) {
145
- if ( 'no' === get_option( 'wcj_' . $this->id . '_wpml_get_products_all_lang', 'no' ) ) {
146
  return;
147
  }
148
  add_action( 'pre_get_posts', array( $this, 'suppress_filters' ) );
@@ -216,7 +198,7 @@ class WCJ_Module {
216
  * @since 4.6.0
217
  */
218
  function remove_wpml_functions_before_get_terms( $module_id = null ) {
219
- if ( 'no' === get_option( 'wcj_' . $this->id . '_wpml_get_terms_all_lang', 'no' ) ) {
220
  return;
221
  }
222
  wcj_remove_wpml_terms_filters();
@@ -235,7 +217,7 @@ class WCJ_Module {
235
  * @since 4.6.0
236
  */
237
  function restore_wpml_functions_after_get_terms( $module_id = null ) {
238
- if ( 'no' === get_option( 'wcj_' . $this->id . '_wpml_get_terms_all_lang', 'no' ) ) {
239
  return;
240
  }
241
  wcj_add_wpml_terms_filters();
@@ -260,9 +242,9 @@ class WCJ_Module {
260
  function handle_deprecated_options() {
261
  if ( $deprecated_options = $this->get_deprecated_options() ) {
262
  foreach ( $deprecated_options as $new_option => $old_options ) {
263
- $new_value = get_option( $new_option, array() );
264
  foreach ( $old_options as $new_key => $old_option ) {
265
- if ( null !== ( $old_value = get_option( $old_option, null ) ) ) {
266
  $new_value[ $new_key ] = $old_value;
267
  delete_option( $old_option );
268
  }
@@ -490,9 +472,30 @@ class WCJ_Module {
490
  $settings = $this->add_tools_list( $settings );
491
  }
492
  $settings = $this->add_reset_settings_button( $settings );
 
493
  return $this->add_enable_module_setting( $settings, $module_desc );
494
  }
495
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
496
  /**
497
  * get_settings.
498
  *
2
  /**
3
  * Booster for WooCommerce Module
4
  *
5
+ * @version 5.3.3
6
  * @since 2.2.0
7
  * @author Pluggabl LLC.
8
  * @todo [dev] maybe should be `abstract` ?
25
  public $link;
26
  public $options = array();
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  /**
29
  * Constructor.
30
  *
38
  $this->parent_id = '';
39
  }
40
 
41
+ if ( 'no' === wcj_get_option( 'wcj_load_modules_on_init', 'no' ) ) {
42
  add_action( 'init', array( $this, 'add_settings' ) );
43
  add_action( 'init', array( $this, 'reset_settings' ), PHP_INT_MAX );
44
  } else {
88
  * @since 4.7.0
89
  */
90
  function remove_wpml_hooks() {
91
+ if ( 'no' === wcj_get_option( 'wcj_' . $this->id . '_wpml_get_products_all_lang', 'no' ) ) {
92
  return;
93
  }
94
 
105
  * @param null $module_id
106
  */
107
  function restore_wpml_args_on_get_products( $module_id = null ){
108
+ if ( 'no' === wcj_get_option( 'wcj_' . $this->id . '_wpml_get_products_all_lang', 'no' ) ) {
109
  return;
110
  }
111
  remove_action( 'pre_get_posts', array( $this, 'suppress_filters' ) );
124
  * @param null $module_id
125
  */
126
  function add_wpml_args_on_get_products( $module_id = null ) {
127
+ if ( 'no' === wcj_get_option( 'wcj_' . $this->id . '_wpml_get_products_all_lang', 'no' ) ) {
128
  return;
129
  }
130
  add_action( 'pre_get_posts', array( $this, 'suppress_filters' ) );
198
  * @since 4.6.0
199
  */
200
  function remove_wpml_functions_before_get_terms( $module_id = null ) {
201
+ if ( 'no' === wcj_get_option( 'wcj_' . $this->id . '_wpml_get_terms_all_lang', 'no' ) ) {
202
  return;
203
  }
204
  wcj_remove_wpml_terms_filters();
217
  * @since 4.6.0
218
  */
219
  function restore_wpml_functions_after_get_terms( $module_id = null ) {
220
+ if ( 'no' === wcj_get_option( 'wcj_' . $this->id . '_wpml_get_terms_all_lang', 'no' ) ) {
221
  return;
222
  }
223
  wcj_add_wpml_terms_filters();
242
  function handle_deprecated_options() {
243
  if ( $deprecated_options = $this->get_deprecated_options() ) {
244
  foreach ( $deprecated_options as $new_option => $old_options ) {
245
+ $new_value = wcj_get_option( $new_option, array() );
246
  foreach ( $old_options as $new_key => $old_option ) {
247
+ if ( null !== ( $old_value = wcj_get_option( $old_option, null ) ) ) {
248
  $new_value[ $new_key ] = $old_value;
249
  delete_option( $old_option );
250
  }
472
  $settings = $this->add_tools_list( $settings );
473
  }
474
  $settings = $this->add_reset_settings_button( $settings );
475
+ $settings = $this->setup_default_autoload( $settings );
476
  return $this->add_enable_module_setting( $settings, $module_desc );
477
  }
478
 
479
+ /**
480
+ * setup_default_autoload.
481
+ *
482
+ * @version 5.3.3
483
+ * @since 5.3.3
484
+ *
485
+ * @param $settings
486
+ *
487
+ * @return array
488
+ */
489
+ function setup_default_autoload( $settings ) {
490
+ $settings = array_map( function ( $item ) {
491
+ if ( ! isset( $item['autoload'] ) ) {
492
+ $item['autoload'] = false;
493
+ }
494
+ return $item;
495
+ }, $settings );
496
+ return $settings;
497
+ }
498
+
499
  /**
500
  * get_settings.
501
  *
includes/classes/class-wcj-pdf-invoice.php CHANGED
@@ -36,7 +36,7 @@ class WCJ_PDF_Invoice extends WCJ_Invoice {
36
 
37
  $invoice_type = $this->invoice_type;
38
 
39
- $page_format = get_option( 'wcj_invoicing_' . $invoice_type . '_page_format', 'A4' );
40
  if ( 'custom' === $page_format ) {
41
  $page_format = array(
42
  get_option( 'wcj_invoicing_' . $invoice_type . '_page_format_custom_width', 0 ),
@@ -72,12 +72,12 @@ class WCJ_PDF_Invoice extends WCJ_Invoice {
72
  $pdf->SetKeywords( 'invoice, PDF' );
73
 
74
  // Header - set default header data
75
- if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type . '_header_enabled', 'yes' ) ) {
76
  $the_logo = '';
77
  $the_logo_width_mm = 0;
78
- if ( '' != ( $header_image = do_shortcode( get_option( 'wcj_invoicing_' . $invoice_type . '_header_image', '' ) ) ) ) {
79
  $the_logo = parse_url( $header_image, PHP_URL_PATH );
80
- $the_logo_width_mm = get_option( 'wcj_invoicing_' . $invoice_type . '_header_image_width_mm', 50 );
81
  if ( ! file_exists( K_PATH_IMAGES . $the_logo ) ) {
82
  $the_logo = '';
83
  $the_logo_width_mm = 0;
@@ -86,19 +86,19 @@ class WCJ_PDF_Invoice extends WCJ_Invoice {
86
  $pdf->SetHeaderData(
87
  $the_logo,
88
  $the_logo_width_mm,
89
- do_shortcode( get_option( 'wcj_invoicing_' . $invoice_type . '_header_title_text', $invoice_title ) ),
90
- do_shortcode( get_option( 'wcj_invoicing_' . $invoice_type . '_header_text' , __( 'Company Name', 'woocommerce-jetpack' ) ) ),
91
- wcj_hex2rgb( get_option( 'wcj_invoicing_' . $invoice_type . '_header_text_color', '#cccccc' ) ),
92
- wcj_hex2rgb( get_option( 'wcj_invoicing_' . $invoice_type . '_header_line_color', '#cccccc' ) ) );
93
  } else {
94
  $pdf->SetPrintHeader( false );
95
  }
96
 
97
  // Footer
98
- if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type . '_footer_enabled', 'yes' ) ) {
99
  $pdf->setFooterData(
100
- wcj_hex2rgb( get_option( 'wcj_invoicing_' . $invoice_type . '_footer_text_color', '#cccccc' ) ),
101
- wcj_hex2rgb( get_option( 'wcj_invoicing_' . $invoice_type . '_footer_line_color', '#cccccc' ) )
102
  );
103
  } else {
104
  $pdf->SetPrintFooter( false );
@@ -119,11 +119,11 @@ class WCJ_PDF_Invoice extends WCJ_Invoice {
119
  get_option( 'wcj_invoicing_' . $invoice_type . '_margin_top', 27 ),
120
  get_option( 'wcj_invoicing_' . $invoice_type . '_margin_right', 15 )
121
  );
122
- $pdf->SetHeaderMargin( get_option( 'wcj_invoicing_' . $invoice_type . '_margin_header', 10 ) );
123
- $pdf->SetFooterMargin( get_option( 'wcj_invoicing_' . $invoice_type . '_margin_footer', 10 ) );
124
 
125
  // Set auto page breaks
126
- $pdf->SetAutoPageBreak( true, get_option( 'wcj_invoicing_' . $invoice_type . '_margin_bottom', 10 ) );
127
 
128
  // Set image scale factor
129
  $pdf->setImageScale( PDF_IMAGE_SCALE_RATIO );
@@ -132,19 +132,19 @@ class WCJ_PDF_Invoice extends WCJ_Invoice {
132
  $pdf->setFontSubsetting( true );
133
 
134
  // Set font
135
- $pdf->SetFont( $tcpdf_font, '', get_option( 'wcj_invoicing_' . $invoice_type . '_general_font_size', 8 ), '', true );
136
 
137
  // Add a page
138
  $pdf->AddPage();
139
 
140
  // Set text shadow effect
141
- if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type . '_general_font_shadowed', 'no' ) ) {
142
  $pdf->setTextShadow( array( 'enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array( 196, 196, 196 ), 'opacity' => 1, 'blend_mode' => 'Normal' ) );
143
  }
144
 
145
  // Background image
146
- if ( '' != ( $background_image = do_shortcode( get_option( 'wcj_invoicing_' . $invoice_type . '_background_image', '' ) ) ) ) {
147
- $background_image = 'yes' === ( $parse_bkg_image = get_option( 'wcj_invoicing_' . $invoice_type . '_background_image_parse', 'yes' ) ) ? $_SERVER['DOCUMENT_ROOT'] . parse_url( $background_image, PHP_URL_PATH ) : $background_image;
148
  $pdf->Image( $background_image, 0, 0, $pdf->getPageWidth(), $pdf->getPageHeight() );
149
  }
150
 
@@ -183,7 +183,7 @@ class WCJ_PDF_Invoice extends WCJ_Invoice {
183
  */
184
  function get_html( $order_id, $pdf ) {
185
  $this->original_internal_coding = mb_internal_encoding();
186
- if ( ! empty( $internal_encoding = get_option( 'wcj_general_advanced_mb_internal_encoding', '' ) ) ) {
187
  mb_internal_encoding( $internal_encoding );
188
  }
189
  $_GET['order_id'] = $order_id;
@@ -198,7 +198,7 @@ class WCJ_PDF_Invoice extends WCJ_Invoice {
198
  if ( ! isset( $wcj_pdf_invoice_data['user_id'] ) ) {
199
  $wcj_pdf_invoice_data['user_id'] = ( WCJ_IS_WC_VERSION_BELOW_3 ? $the_order->customer_user : $the_order->get_customer_id() );
200
  }
201
- $html = do_shortcode( get_option( 'wcj_invoicing_' . $this->invoice_type . '_template',
202
  WCJ()->modules['pdf_invoicing_templates']->get_default_template( $this->invoice_type ) ) );
203
  $html = $this->maybe_replace_tcpdf_method_params( $html, $pdf );
204
  $html = force_balance_tags( $html );
@@ -215,7 +215,7 @@ class WCJ_PDF_Invoice extends WCJ_Invoice {
215
  function get_pdf( $dest ) {
216
  $pdf = $this->prepare_pdf();
217
  $html = $this->get_html( $this->order_id, $pdf );
218
- $styling = '<style>' . get_option( 'wcj_invoicing_' . $this->invoice_type . '_css',
219
  WCJ()->modules['pdf_invoicing_styling']->get_default_css_template( $this->invoice_type ) ) . '</style>';
220
  $pdf->writeHTMLCell( 0, 0, '', '', $styling . $html, 0, 1, 0, true, '', true );
221
  $result_pdf = $pdf->Output( '', 'S' );
@@ -237,7 +237,7 @@ class WCJ_PDF_Invoice extends WCJ_Invoice {
237
  header( "Content-type: application/pdf" );
238
  header( "Content-Disposition: inline; filename=" . urlencode( $file_name ) );
239
  }
240
- if ( 'yes' === get_option( 'wcj_general_advanced_disable_save_sys_temp_dir', 'no' ) ) {
241
  header( "Content-Length: " . strlen( $result_pdf ) );
242
  echo $result_pdf;
243
  } else {
36
 
37
  $invoice_type = $this->invoice_type;
38
 
39
+ $page_format = wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_page_format', 'A4' );
40
  if ( 'custom' === $page_format ) {
41
  $page_format = array(
42
  get_option( 'wcj_invoicing_' . $invoice_type . '_page_format_custom_width', 0 ),
72
  $pdf->SetKeywords( 'invoice, PDF' );
73
 
74
  // Header - set default header data
75
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_header_enabled', 'yes' ) ) {
76
  $the_logo = '';
77
  $the_logo_width_mm = 0;
78
+ if ( '' != ( $header_image = do_shortcode( wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_header_image', '' ) ) ) ) {
79
  $the_logo = parse_url( $header_image, PHP_URL_PATH );
80
+ $the_logo_width_mm = wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_header_image_width_mm', 50 );
81
  if ( ! file_exists( K_PATH_IMAGES . $the_logo ) ) {
82
  $the_logo = '';
83
  $the_logo_width_mm = 0;
86
  $pdf->SetHeaderData(
87
  $the_logo,
88
  $the_logo_width_mm,
89
+ do_shortcode( wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_header_title_text', $invoice_title ) ),
90
+ do_shortcode( wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_header_text' , __( 'Company Name', 'woocommerce-jetpack' ) ) ),
91
+ wcj_hex2rgb( wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_header_text_color', '#cccccc' ) ),
92
+ wcj_hex2rgb( wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_header_line_color', '#cccccc' ) ) );
93
  } else {
94
  $pdf->SetPrintHeader( false );
95
  }
96
 
97
  // Footer
98
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_footer_enabled', 'yes' ) ) {
99
  $pdf->setFooterData(
100
+ wcj_hex2rgb( wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_footer_text_color', '#cccccc' ) ),
101
+ wcj_hex2rgb( wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_footer_line_color', '#cccccc' ) )
102
  );
103
  } else {
104
  $pdf->SetPrintFooter( false );
119
  get_option( 'wcj_invoicing_' . $invoice_type . '_margin_top', 27 ),
120
  get_option( 'wcj_invoicing_' . $invoice_type . '_margin_right', 15 )
121
  );
122
+ $pdf->SetHeaderMargin( wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_margin_header', 10 ) );
123
+ $pdf->SetFooterMargin( wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_margin_footer', 10 ) );
124
 
125
  // Set auto page breaks
126
+ $pdf->SetAutoPageBreak( true, wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_margin_bottom', 10 ) );
127
 
128
  // Set image scale factor
129
  $pdf->setImageScale( PDF_IMAGE_SCALE_RATIO );
132
  $pdf->setFontSubsetting( true );
133
 
134
  // Set font
135
+ $pdf->SetFont( $tcpdf_font, '', wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_general_font_size', 8 ), '', true );
136
 
137
  // Add a page
138
  $pdf->AddPage();
139
 
140
  // Set text shadow effect
141
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_general_font_shadowed', 'no' ) ) {
142
  $pdf->setTextShadow( array( 'enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array( 196, 196, 196 ), 'opacity' => 1, 'blend_mode' => 'Normal' ) );
143
  }
144
 
145
  // Background image
146
+ if ( '' != ( $background_image = do_shortcode( wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_background_image', '' ) ) ) ) {
147
+ $background_image = 'yes' === ( $parse_bkg_image = wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_background_image_parse', 'yes' ) ) ? $_SERVER['DOCUMENT_ROOT'] . parse_url( $background_image, PHP_URL_PATH ) : $background_image;
148
  $pdf->Image( $background_image, 0, 0, $pdf->getPageWidth(), $pdf->getPageHeight() );
149
  }
150
 
183
  */
184
  function get_html( $order_id, $pdf ) {
185
  $this->original_internal_coding = mb_internal_encoding();
186
+ if ( ! empty( $internal_encoding = wcj_get_option( 'wcj_general_advanced_mb_internal_encoding', '' ) ) ) {
187
  mb_internal_encoding( $internal_encoding );
188
  }
189
  $_GET['order_id'] = $order_id;
198
  if ( ! isset( $wcj_pdf_invoice_data['user_id'] ) ) {
199
  $wcj_pdf_invoice_data['user_id'] = ( WCJ_IS_WC_VERSION_BELOW_3 ? $the_order->customer_user : $the_order->get_customer_id() );
200
  }
201
+ $html = do_shortcode( wcj_get_option( 'wcj_invoicing_' . $this->invoice_type . '_template',
202
  WCJ()->modules['pdf_invoicing_templates']->get_default_template( $this->invoice_type ) ) );
203
  $html = $this->maybe_replace_tcpdf_method_params( $html, $pdf );
204
  $html = force_balance_tags( $html );
215
  function get_pdf( $dest ) {
216
  $pdf = $this->prepare_pdf();
217
  $html = $this->get_html( $this->order_id, $pdf );
218
+ $styling = '<style>' . wcj_get_option( 'wcj_invoicing_' . $this->invoice_type . '_css',
219
  WCJ()->modules['pdf_invoicing_styling']->get_default_css_template( $this->invoice_type ) ) . '</style>';
220
  $pdf->writeHTMLCell( 0, 0, '', '', $styling . $html, 0, 1, 0, true, '', true );
221
  $result_pdf = $pdf->Output( '', 'S' );
237
  header( "Content-type: application/pdf" );
238
  header( "Content-Disposition: inline; filename=" . urlencode( $file_name ) );
239
  }
240
+ if ( 'yes' === wcj_get_option( 'wcj_general_advanced_disable_save_sys_temp_dir', 'no' ) ) {
241
  header( "Content-Length: " . strlen( $result_pdf ) );
242
  echo $result_pdf;
243
  } else {
includes/classes/class-wcj-tcpdf.php CHANGED
@@ -37,16 +37,16 @@ class WCJ_TCPDF extends TCPDF {
37
  */
38
  function Footer() {
39
  $invoice_type = $this->invoice_type;
40
- $footer_text = get_option( 'wcj_invoicing_' . $invoice_type . '_footer_text', __( 'Page %page_number% / %total_pages%', 'woocommerce-jetpack' ) );
41
  $footer_text = str_replace( '%page_number%', $this->getAliasNumPage(), $footer_text );
42
  $footer_text = str_replace( '%total_pages%', $this->getAliasNbPages(), $footer_text );
43
  $border_desc = array(
44
  'T' => array(
45
- 'color' => wcj_hex2rgb( get_option( 'wcj_invoicing_' . $invoice_type . '_footer_line_color', '#cccccc' ) ),
46
  'width' => 0,
47
  ),
48
  );
49
- $footer_text_color_rgb = wcj_hex2rgb( get_option( 'wcj_invoicing_' . $invoice_type . '_footer_text_color', '#cccccc' ) );
50
  $this->SetTextColor( $footer_text_color_rgb[0], $footer_text_color_rgb[1], $footer_text_color_rgb[2] );
51
  $this->writeHTMLCell( 0, 0, '', '', do_shortcode( $footer_text ), $border_desc, 1, 0, true, '', true );
52
  }
37
  */
38
  function Footer() {
39
  $invoice_type = $this->invoice_type;
40
+ $footer_text = wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_footer_text', __( 'Page %page_number% / %total_pages%', 'woocommerce-jetpack' ) );
41
  $footer_text = str_replace( '%page_number%', $this->getAliasNumPage(), $footer_text );
42
  $footer_text = str_replace( '%total_pages%', $this->getAliasNbPages(), $footer_text );
43
  $border_desc = array(
44
  'T' => array(
45
+ 'color' => wcj_hex2rgb( wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_footer_line_color', '#cccccc' ) ),
46
  'width' => 0,
47
  ),
48
  );
49
+ $footer_text_color_rgb = wcj_hex2rgb( wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_footer_text_color', '#cccccc' ) );
50
  $this->SetTextColor( $footer_text_color_rgb[0], $footer_text_color_rgb[1], $footer_text_color_rgb[2] );
51
  $this->writeHTMLCell( 0, 0, '', '', do_shortcode( $footer_text ), $border_desc, 1, 0, true, '', true );
52
  }
includes/core/class-wcj-admin.php CHANGED
@@ -99,7 +99,7 @@ class WCJ_Admin {
99
  'woocommerce',
100
  __( 'Booster for WooCommerce', 'woocommerce-jetpack' ),
101
  __( 'Booster Settings', 'woocommerce-jetpack' ) ,
102
- ( 'yes' === get_option( 'wcj_' . 'admin_tools' . '_enabled', 'no' ) && 'yes' === get_option( 'wcj_admin_tools_show_menus_to_admin_only', 'no' ) ? 'manage_options' : 'manage_woocommerce' ),
103
  'admin.php?page=wc-settings&tab=jetpack'
104
  );
105
  }
99
  'woocommerce',
100
  __( 'Booster for WooCommerce', 'woocommerce-jetpack' ),
101
  __( 'Booster Settings', 'woocommerce-jetpack' ) ,
102
+ ( 'yes' === wcj_get_option( 'wcj_' . 'admin_tools' . '_enabled', 'no' ) && 'yes' === wcj_get_option( 'wcj_admin_tools_show_menus_to_admin_only', 'no' ) ? 'manage_options' : 'manage_woocommerce' ),
103
  'admin.php?page=wc-settings&tab=jetpack'
104
  );
105
  }
includes/core/class-wcj-scripts.php CHANGED
@@ -84,7 +84,7 @@ class WCJ_Scripts {
84
  * @since 2.4.0
85
  */
86
  function maybe_enqueue_datepicker_scripts() {
87
- if ( ! wcj_is_module_enabled( 'general' ) || ( wcj_is_module_enabled( 'general' ) && 'no' === get_option( 'wcj_general_advanced_disable_datepicker_js', 'no' ) ) ) {
88
  wp_enqueue_script( 'jquery-ui-datepicker' );
89
  wp_enqueue_script( 'wcj-datepicker', wcj_plugin_url() . '/includes/js/wcj-datepicker.js',
90
  array( 'jquery' ),
@@ -104,7 +104,7 @@ class WCJ_Scripts {
104
  * @since 2.4.0
105
  */
106
  function maybe_enqueue_timepicker_scripts() {
107
- if ( ! wcj_is_module_enabled( 'general' ) || ( wcj_is_module_enabled( 'general' ) && 'no' === get_option( 'wcj_general_advanced_disable_timepicker_js', 'no' ) ) ) {
108
  wp_enqueue_script( 'jquery-ui-timepicker',
109
  wcj_plugin_url() . '/includes/lib/timepicker/jquery.timepicker.min.js',
110
  array( 'jquery' ),
@@ -124,10 +124,10 @@ class WCJ_Scripts {
124
  * @since 2.4.0
125
  */
126
  function maybe_enqueue_datepicker_style() {
127
- if ( ! wcj_is_module_enabled( 'general' ) || ( wcj_is_module_enabled( 'general' ) && 'no' === get_option( 'wcj_general_advanced_disable_datepicker_css', 'no' ) ) ) {
128
  $datepicker_css_path = '//ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/themes/base/jquery-ui.css';
129
  if ( wcj_is_module_enabled( 'general' ) ) {
130
- $datepicker_css_path = get_option( 'wcj_general_advanced_datepicker_css', $datepicker_css_path );
131
  }
132
  wp_enqueue_style( 'jquery-ui-style', $datepicker_css_path );
133
  }
@@ -140,7 +140,7 @@ class WCJ_Scripts {
140
  * @since 2.4.0
141
  */
142
  function maybe_enqueue_timepicker_style() {
143
- if ( ! wcj_is_module_enabled( 'general' ) || ( wcj_is_module_enabled( 'general' ) && 'no' === get_option( 'wcj_general_advanced_disable_timepicker_css', 'no' ) ) ) {
144
  wp_enqueue_style( 'wcj-timepicker-style', wcj_plugin_url() . '/includes/lib/timepicker/jquery.timepicker.min.css', array(), WCJ()->version );
145
  }
146
  }
84
  * @since 2.4.0
85
  */
86
  function maybe_enqueue_datepicker_scripts() {
87
+ if ( ! wcj_is_module_enabled( 'general' ) || ( wcj_is_module_enabled( 'general' ) && 'no' === wcj_get_option( 'wcj_general_advanced_disable_datepicker_js', 'no' ) ) ) {
88
  wp_enqueue_script( 'jquery-ui-datepicker' );
89
  wp_enqueue_script( 'wcj-datepicker', wcj_plugin_url() . '/includes/js/wcj-datepicker.js',
90
  array( 'jquery' ),
104
  * @since 2.4.0
105
  */
106
  function maybe_enqueue_timepicker_scripts() {
107
+ if ( ! wcj_is_module_enabled( 'general' ) || ( wcj_is_module_enabled( 'general' ) && 'no' === wcj_get_option( 'wcj_general_advanced_disable_timepicker_js', 'no' ) ) ) {
108
  wp_enqueue_script( 'jquery-ui-timepicker',
109
  wcj_plugin_url() . '/includes/lib/timepicker/jquery.timepicker.min.js',
110
  array( 'jquery' ),
124
  * @since 2.4.0
125
  */
126
  function maybe_enqueue_datepicker_style() {
127
+ if ( ! wcj_is_module_enabled( 'general' ) || ( wcj_is_module_enabled( 'general' ) && 'no' === wcj_get_option( 'wcj_general_advanced_disable_datepicker_css', 'no' ) ) ) {
128
  $datepicker_css_path = '//ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/themes/base/jquery-ui.css';
129
  if ( wcj_is_module_enabled( 'general' ) ) {
130
+ $datepicker_css_path = wcj_get_option( 'wcj_general_advanced_datepicker_css', $datepicker_css_path );
131
  }
132
  wp_enqueue_style( 'jquery-ui-style', $datepicker_css_path );
133
  }
140
  * @since 2.4.0
141
  */
142
  function maybe_enqueue_timepicker_style() {
143
+ if ( ! wcj_is_module_enabled( 'general' ) || ( wcj_is_module_enabled( 'general' ) && 'no' === wcj_get_option( 'wcj_general_advanced_disable_timepicker_css', 'no' ) ) ) {
144
  wp_enqueue_style( 'wcj-timepicker-style', wcj_plugin_url() . '/includes/lib/timepicker/jquery.timepicker.min.css', array(), WCJ()->version );
145
  }
146
  }
includes/core/wcj-constants.php CHANGED
@@ -16,7 +16,7 @@ if ( ! defined( 'WCJ_WC_VERSION' ) ) {
16
  * @version 2.7.0
17
  * @since 2.7.0
18
  */
19
- define( 'WCJ_WC_VERSION', get_option( 'woocommerce_version', null ) );
20
  }
21
 
22
  if ( ! defined( 'WCJ_IS_WC_VERSION_BELOW_3' ) ) {
@@ -97,7 +97,7 @@ if ( ! defined( 'WCJ_SESSION_TYPE' ) ) {
97
  * @since 3.1.0
98
  * @todo (maybe) set default to `wc`
99
  */
100
- define( 'WCJ_SESSION_TYPE', ( 'yes' === get_option( 'wcj_general_enabled', 'no' ) ? get_option( 'wcj_general_advanced_session_type', 'standard' ) : 'standard' ) );
101
  }
102
 
103
  if ( ! defined( 'WCJ_VERSION_OPTION' ) ) {
16
  * @version 2.7.0
17
  * @since 2.7.0
18
  */
19
+ define( 'WCJ_WC_VERSION', wcj_get_option( 'woocommerce_version', null ) );
20
  }
21
 
22
  if ( ! defined( 'WCJ_IS_WC_VERSION_BELOW_3' ) ) {
97
  * @since 3.1.0
98
  * @todo (maybe) set default to `wc`
99
  */
100
+ define( 'WCJ_SESSION_TYPE', ( 'yes' === wcj_get_option( 'wcj_general_enabled', 'no' ) ? wcj_get_option( 'wcj_general_advanced_session_type', 'standard' ) : 'standard' ) );
101
  }
102
 
103
  if ( ! defined( 'WCJ_VERSION_OPTION' ) ) {
includes/core/wcj-loader.php CHANGED
@@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  }
13
 
14
  // Debug Mode
15
- if ( 'yes' === get_option( 'wcj_debug_tools_enabled', 'no' ) && 'yes' === get_option( 'wcj_debuging_enabled', 'no' ) ) {
16
  error_reporting( E_ALL );
17
  }
18
 
@@ -27,7 +27,7 @@ if ( ! defined( 'WCJ_PLUGIN_PATH' ) ) {
27
  }
28
 
29
  // Set up localisation
30
- if ( 'no' === get_option( 'wcj_load_modules_on_init', 'no' ) ) {
31
  load_plugin_textdomain( 'woocommerce-jetpack', false, dirname( plugin_basename( WCJ_PLUGIN_FILE ) ) . '/langs/' );
32
  } else {
33
  add_action( 'init', function () {
@@ -75,7 +75,7 @@ require_once( WCJ_PLUGIN_PATH . '/includes/widgets/class-wcj-widget-selector.php
75
  require_once( 'class-wcj-scripts.php' );
76
 
77
  // Modules and Submodules
78
- if ( 'no' === get_option( 'wcj_load_modules_on_init', 'no' ) ) {
79
  require_once( 'wcj-modules.php' );
80
 
81
  // Add and Manage options
12
  }
13
 
14
  // Debug Mode
15
+ if ( 'yes' === wcj_get_option( 'wcj_debug_tools_enabled', 'no' ) && 'yes' === wcj_get_option( 'wcj_debuging_enabled', 'no' ) ) {
16
  error_reporting( E_ALL );
17
  }
18
 
27
  }
28
 
29
  // Set up localisation
30
+ if ( 'no' === wcj_get_option( 'wcj_load_modules_on_init', 'no' ) ) {
31
  load_plugin_textdomain( 'woocommerce-jetpack', false, dirname( plugin_basename( WCJ_PLUGIN_FILE ) ) . '/langs/' );
32
  } else {
33
  add_action( 'init', function () {
75
  require_once( 'class-wcj-scripts.php' );
76
 
77
  // Modules and Submodules
78
+ if ( 'no' === wcj_get_option( 'wcj_load_modules_on_init', 'no' ) ) {
79
  require_once( 'wcj-modules.php' );
80
 
81
  // Add and Manage options
includes/core/wcj-options.php CHANGED
@@ -18,14 +18,14 @@ if ( is_admin() ) {
18
  $status_settings = $module->add_enable_module_setting( array() );
19
  $this->module_statuses[] = $status_settings[1];
20
  }
21
- if ( get_option( WCJ_VERSION_OPTION ) === $this->version ) {
22
  continue;
23
  }
24
  $values = $module->get_settings();
25
  // Adding options
26
  foreach ( $values as $value ) {
27
  if ( isset( $value['default'] ) && isset( $value['id'] ) ) {
28
- if ( 'yes' === get_option( 'wcj_autoload_options', 'yes' ) ) {
29
  $autoload = isset( $value['autoload'] ) ? (bool) $value['autoload'] : true;
30
  } else {
31
  $autoload = false;
@@ -34,7 +34,7 @@ if ( is_admin() ) {
34
  }
35
  }
36
  }
37
- if ( get_option( WCJ_VERSION_OPTION ) !== $this->version ) {
38
  // "Version updated" stuff...
39
  update_option( WCJ_VERSION_OPTION, $this->version );
40
  add_action( 'admin_notices', 'wcj_admin_notices_version_updated' );
18
  $status_settings = $module->add_enable_module_setting( array() );
19
  $this->module_statuses[] = $status_settings[1];
20
  }
21
+ if ( wcj_get_option( WCJ_VERSION_OPTION ) === $this->version ) {
22
  continue;
23
  }
24
  $values = $module->get_settings();
25
  // Adding options
26
  foreach ( $values as $value ) {
27
  if ( isset( $value['default'] ) && isset( $value['id'] ) ) {
28
+ if ( 'yes' === wcj_get_option( 'wcj_autoload_options', 'yes' ) ) {
29
  $autoload = isset( $value['autoload'] ) ? (bool) $value['autoload'] : true;
30
  } else {
31
  $autoload = false;
34
  }
35
  }
36
  }
37
+ if ( wcj_get_option( WCJ_VERSION_OPTION ) !== $this->version ) {
38
  // "Version updated" stuff...
39
  update_option( WCJ_VERSION_OPTION, $this->version );
40
  add_action( 'admin_notices', 'wcj_admin_notices_version_updated' );
includes/core/wcj-shortcodes.php CHANGED
@@ -9,7 +9,7 @@
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit;
11
 
12
- if ( ! wcj_is_module_enabled( 'general' ) || ( wcj_is_module_enabled( 'general' ) && 'no' === get_option( 'wcj_general_shortcodes_disable_booster_shortcodes', 'no' ) ) ) {
13
 
14
  include_once( WCJ_PLUGIN_PATH . '/includes/classes/class-wcj-shortcodes.php' );
15
 
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit;
11
 
12
+ if ( ! wcj_is_module_enabled( 'general' ) || ( wcj_is_module_enabled( 'general' ) && 'no' === wcj_get_option( 'wcj_general_shortcodes_disable_booster_shortcodes', 'no' ) ) ) {
13
 
14
  include_once( WCJ_PLUGIN_PATH . '/includes/classes/class-wcj-shortcodes.php' );
15
 
includes/emails/class-wc-email-wcj-custom.php CHANGED
@@ -21,14 +21,14 @@ class WC_Email_WCJ_Custom extends WC_Email {
21
  /**
22
  * Constructor
23
  *
24
- * @version 4.6.1
25
  */
26
  function __construct( $id = 1 ) {
27
 
28
  $this->id = 'wcj_custom' . '_' . $id;
29
  $this->customer_email = ( '%customer%' === $this->get_option( 'recipient' ) );
30
  $this->original_recipient = $this->get_option( 'recipient' );
31
- $this->title = get_option( 'wcj_emails_custom_emails_admin_title_' . $id, __( 'Custom', 'woocommerce-jetpack' ) . ' #' . $id );
32
  $this->description = __( 'Custom emails are sent to the recipient list when selected triggers are called.', 'woocommerce-jetpack' );
33
 
34
  $this->heading = __( 'Custom Heading', 'woocommerce' );
@@ -106,7 +106,7 @@ class WC_Email_WCJ_Custom extends WC_Email {
106
  /**
107
  * trigger.
108
  *
109
- * @version 4.6.1
110
  */
111
  function trigger( $object_id ) {
112
 
@@ -178,7 +178,7 @@ class WC_Email_WCJ_Custom extends WC_Email {
178
  /**
179
  * get_content_html.
180
  *
181
- * @version 3.1.0
182
  * @access public
183
  * @return string
184
  * @todo (maybe) use `wc_get_template` for custom templates (same for `get_content_plain()`)
@@ -194,7 +194,7 @@ class WC_Email_WCJ_Custom extends WC_Email {
194
  /**
195
  * get_content_plain.
196
  *
197
- * @version 2.4.8
198
  * @access public
199
  * @return string
200
  */
21
  /**
22
  * Constructor
23
  *
24
+ * @version 5.3.4
25
  */
26
  function __construct( $id = 1 ) {
27
 
28
  $this->id = 'wcj_custom' . '_' . $id;
29
  $this->customer_email = ( '%customer%' === $this->get_option( 'recipient' ) );
30
  $this->original_recipient = $this->get_option( 'recipient' );
31
+ $this->title = wcj_get_option( 'wcj_emails_custom_emails_admin_title_' . $id, __( 'Custom', 'woocommerce-jetpack' ) . ' #' . $id );
32
  $this->description = __( 'Custom emails are sent to the recipient list when selected triggers are called.', 'woocommerce-jetpack' );
33
 
34
  $this->heading = __( 'Custom Heading', 'woocommerce' );
106
  /**
107
  * trigger.
108
  *
109
+ * @version 5.3.4
110
  */
111
  function trigger( $object_id ) {
112
 
178
  /**
179
  * get_content_html.
180
  *
181
+ * @version 5.3.4
182
  * @access public
183
  * @return string
184
  * @todo (maybe) use `wc_get_template` for custom templates (same for `get_content_plain()`)
194
  /**
195
  * get_content_plain.
196
  *
197
+ * @version 5.3.4
198
  * @access public
199
  * @return string
200
  */
includes/exchange-rates/class-wcj-exchange-rates-crons.php CHANGED
@@ -37,7 +37,7 @@ class WCJ_Exchange_Rates_Crons {
37
  * @version 2.5.5
38
  */
39
  function schedule_the_events() {
40
- $selected_interval = get_option( 'wcj_currency_exchange_rates_auto', 'daily' );
41
  foreach ( $this->update_intervals as $interval => $desc ) {
42
  $event_hook = 'auto_update_exchange_rates_hook';
43
  $event_timestamp = wp_next_scheduled( $event_hook, array( $interval ) );
@@ -66,7 +66,7 @@ class WCJ_Exchange_Rates_Crons {
66
  }
67
  }
68
  $currency_pairs[] = array(
69
- 'currency_from' => get_option( 'woocommerce_currency' ),
70
  'currency_to' => $currency_to,
71
  'option_name' => array( $option_name, ),
72
  );
@@ -85,9 +85,9 @@ class WCJ_Exchange_Rates_Crons {
85
 
86
  if ( wcj_is_module_enabled( 'price_by_country' ) ) {
87
  // Currency Pairs - Preparation - Price by Country
88
- if ( 'manual' != apply_filters( 'booster_option', 'manual', get_option( 'wcj_price_by_country_auto_exchange_rates', 'manual' ) ) ) {
89
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i++ ) {
90
- $currency_to = get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $i );
91
  $currency_pairs = $this->get_currency_pair( $currency_pairs, $currency_to, 'wcj_price_by_country_exchange_rate_group_' . $i );
92
  }
93
  }
@@ -95,9 +95,9 @@ class WCJ_Exchange_Rates_Crons {
95
 
96
  if ( wcj_is_module_enabled( 'multicurrency' ) ) {
97
  // Currency Pairs - Preparation - Multicurrency
98
- if ( 'manual' != apply_filters( 'booster_option', 'manual', get_option( 'wcj_multicurrency_exchange_rate_update_auto', 'manual' ) ) ) {
99
- for ( $i = 1; $i <= apply_filters( 'booster_option', 2, get_option( 'wcj_multicurrency_total_number', 2 ) ); $i++ ) {
100
- $currency_to = get_option( 'wcj_multicurrency_currency_' . $i );
101
  $currency_pairs = $this->get_currency_pair( $currency_pairs, $currency_to, 'wcj_multicurrency_exchange_rate_' . $i );
102
  }
103
  }
@@ -105,9 +105,9 @@ class WCJ_Exchange_Rates_Crons {
105
 
106
  if ( wcj_is_module_enabled( 'multicurrency_base_price' ) ) {
107
  // Currency Pairs - Preparation - Multicurrency Product Base Price
108
- if ( 'manual' != apply_filters( 'booster_option', 'manual', get_option( 'wcj_multicurrency_base_price_exchange_rate_update', 'manual' ) ) ) {
109
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_multicurrency_base_price_total_number', 1 ) ); $i++ ) {
110
- $currency_to = get_option( 'wcj_multicurrency_base_price_currency_' . $i );
111
  $currency_pairs = $this->get_currency_pair( $currency_pairs, $currency_to, 'wcj_multicurrency_base_price_exchange_rate_' . $i );
112
  }
113
  }
@@ -115,9 +115,9 @@ class WCJ_Exchange_Rates_Crons {
115
 
116
  if ( wcj_is_module_enabled( 'currency_per_product' ) ) {
117
  // Currency Pairs - Preparation - Currency per Product
118
- if ( 'manual' != apply_filters( 'booster_option', 'manual', get_option( 'wcj_currency_per_product_exchange_rate_update', 'manual' ) ) ) {
119
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_currency_per_product_total_number', 1 ) ); $i++ ) {
120
- $currency_to = get_option( 'wcj_currency_per_product_currency_' . $i );
121
  $currency_pairs = $this->get_currency_pair( $currency_pairs, $currency_to, 'wcj_currency_per_product_exchange_rate_' . $i );
122
  }
123
  }
@@ -125,11 +125,11 @@ class WCJ_Exchange_Rates_Crons {
125
 
126
  if ( wcj_is_module_enabled( 'payment_gateways_currency' ) ) {
127
  // Currency Pairs - Preparation - Gateway Currency
128
- if ( 'manual' != apply_filters( 'booster_option', 'manual', get_option( 'wcj_gateways_currency_exchange_rate_update_auto', 'manual' ) ) ) {
129
  global $woocommerce;
130
  $available_gateways = $woocommerce->payment_gateways->payment_gateways();
131
  foreach ( $available_gateways as $key => $gateway ) {
132
- $currency_to = get_option( 'wcj_gateways_currency_' . $key );
133
  if ( 'no_changes' != $currency_to ) {
134
  $currency_pairs = $this->get_currency_pair( $currency_pairs, $currency_to, 'wcj_gateways_currency_exchange_rate_' . $key );
135
  }
@@ -144,17 +144,17 @@ class WCJ_Exchange_Rates_Crons {
144
  }
145
 
146
  // Additional currencies (via custom currencies section)
147
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_currency_exchange_custom_currencies_total_number', 1 ) );
148
  for ( $i = 1; $i <= $total_number; $i++ ) {
149
- if ( 'disabled' != ( $additional_currency = get_option( 'wcj_currency_exchange_custom_currencies_' . $i, 'disabled' ) ) ) {
150
  $currency_pairs = $this->get_currency_pair( $currency_pairs, $additional_currency, false );
151
  }
152
  }
153
 
154
  // Currency Pairs - Final
155
- $rate_offset_fixed = get_option( 'wcj_currency_exchange_rates_offset_fixed', 0 );
156
- if ( $rate_rounding_enabled = ( 'yes' === get_option( 'wcj_currency_exchange_rates_rounding_enabled', 'no' ) ) ) {
157
- $rate_rounding_precision = get_option( 'wcj_currency_exchange_rates_rounding_precision', 0 );
158
  }
159
  foreach ( $currency_pairs as $currency_pair ) {
160
  $currency_from = $currency_pair['currency_from'];
@@ -189,13 +189,13 @@ class WCJ_Exchange_Rates_Crons {
189
  } else {
190
  $result_message = __( 'Cron job: exchange rates update failed', 'woocommerce-jetpack' );
191
  }
192
- /* if ( 'yes' === get_option( 'wcj_currency_exchange_logging_enabled', 'no' ) ) {
193
  wcj_log( $result_message . ': ' . $currency_from . $currency_to . ': ' . $the_rate . ': ' . 'update_the_exchange_rates: ' . $interval );
194
  } */
195
  }
196
 
197
  if ( wcj_is_module_enabled( 'price_by_country' ) ) {
198
- if ( 'yes' === get_option( 'wcj_price_by_country_price_filter_widget_support_enabled', 'no' ) ) {
199
  wcj_update_products_price_by_country();
200
  }
201
  }
37
  * @version 2.5.5
38
  */
39
  function schedule_the_events() {
40
+ $selected_interval = wcj_get_option( 'wcj_currency_exchange_rates_auto', 'daily' );
41
  foreach ( $this->update_intervals as $interval => $desc ) {
42
  $event_hook = 'auto_update_exchange_rates_hook';
43
  $event_timestamp = wp_next_scheduled( $event_hook, array( $interval ) );
66
  }
67
  }
68
  $currency_pairs[] = array(
69
+ 'currency_from' => wcj_get_option( 'woocommerce_currency' ),
70
  'currency_to' => $currency_to,
71
  'option_name' => array( $option_name, ),
72
  );
85
 
86
  if ( wcj_is_module_enabled( 'price_by_country' ) ) {
87
  // Currency Pairs - Preparation - Price by Country
88
+ if ( 'manual' != apply_filters( 'booster_option', 'manual', wcj_get_option( 'wcj_price_by_country_auto_exchange_rates', 'manual' ) ) ) {
89
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i++ ) {
90
+ $currency_to = wcj_get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $i );
91
  $currency_pairs = $this->get_currency_pair( $currency_pairs, $currency_to, 'wcj_price_by_country_exchange_rate_group_' . $i );
92
  }
93
  }
95
 
96
  if ( wcj_is_module_enabled( 'multicurrency' ) ) {
97
  // Currency Pairs - Preparation - Multicurrency
98
+ if ( 'manual' != apply_filters( 'booster_option', 'manual', wcj_get_option( 'wcj_multicurrency_exchange_rate_update_auto', 'manual' ) ) ) {
99
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 2, wcj_get_option( 'wcj_multicurrency_total_number', 2 ) ); $i++ ) {
100
+ $currency_to = wcj_get_option( 'wcj_multicurrency_currency_' . $i );
101
  $currency_pairs = $this->get_currency_pair( $currency_pairs, $currency_to, 'wcj_multicurrency_exchange_rate_' . $i );
102
  }
103
  }
105
 
106
  if ( wcj_is_module_enabled( 'multicurrency_base_price' ) ) {
107
  // Currency Pairs - Preparation - Multicurrency Product Base Price
108
+ if ( 'manual' != apply_filters( 'booster_option', 'manual', wcj_get_option( 'wcj_multicurrency_base_price_exchange_rate_update', 'manual' ) ) ) {
109
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_multicurrency_base_price_total_number', 1 ) ); $i++ ) {
110
+ $currency_to = wcj_get_option( 'wcj_multicurrency_base_price_currency_' . $i );
111
  $currency_pairs = $this->get_currency_pair( $currency_pairs, $currency_to, 'wcj_multicurrency_base_price_exchange_rate_' . $i );
112
  }
113
  }
115
 
116
  if ( wcj_is_module_enabled( 'currency_per_product' ) ) {
117
  // Currency Pairs - Preparation - Currency per Product
118
+ if ( 'manual' != apply_filters( 'booster_option', 'manual', wcj_get_option( 'wcj_currency_per_product_exchange_rate_update', 'manual' ) ) ) {
119
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_currency_per_product_total_number', 1 ) ); $i++ ) {
120
+ $currency_to = wcj_get_option( 'wcj_currency_per_product_currency_' . $i );
121
  $currency_pairs = $this->get_currency_pair( $currency_pairs, $currency_to, 'wcj_currency_per_product_exchange_rate_' . $i );
122
  }
123
  }
125
 
126
  if ( wcj_is_module_enabled( 'payment_gateways_currency' ) ) {
127
  // Currency Pairs - Preparation - Gateway Currency
128
+ if ( 'manual' != apply_filters( 'booster_option', 'manual', wcj_get_option( 'wcj_gateways_currency_exchange_rate_update_auto', 'manual' ) ) ) {
129
  global $woocommerce;
130
  $available_gateways = $woocommerce->payment_gateways->payment_gateways();
131
  foreach ( $available_gateways as $key => $gateway ) {
132
+ $currency_to = wcj_get_option( 'wcj_gateways_currency_' . $key );
133
  if ( 'no_changes' != $currency_to ) {
134
  $currency_pairs = $this->get_currency_pair( $currency_pairs, $currency_to, 'wcj_gateways_currency_exchange_rate_' . $key );
135
  }
144
  }
145
 
146
  // Additional currencies (via custom currencies section)
147
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_currency_exchange_custom_currencies_total_number', 1 ) );
148
  for ( $i = 1; $i <= $total_number; $i++ ) {
149
+ if ( 'disabled' != ( $additional_currency = wcj_get_option( 'wcj_currency_exchange_custom_currencies_' . $i, 'disabled' ) ) ) {
150
  $currency_pairs = $this->get_currency_pair( $currency_pairs, $additional_currency, false );
151
  }
152
  }
153
 
154
  // Currency Pairs - Final
155
+ $rate_offset_fixed = wcj_get_option( 'wcj_currency_exchange_rates_offset_fixed', 0 );
156
+ if ( $rate_rounding_enabled = ( 'yes' === wcj_get_option( 'wcj_currency_exchange_rates_rounding_enabled', 'no' ) ) ) {
157
+ $rate_rounding_precision = wcj_get_option( 'wcj_currency_exchange_rates_rounding_precision', 0 );
158
  }
159
  foreach ( $currency_pairs as $currency_pair ) {
160
  $currency_from = $currency_pair['currency_from'];
189
  } else {
190
  $result_message = __( 'Cron job: exchange rates update failed', 'woocommerce-jetpack' );
191
  }
192
+ /* if ( 'yes' === wcj_get_option( 'wcj_currency_exchange_logging_enabled', 'no' ) ) {
193
  wcj_log( $result_message . ': ' . $currency_from . $currency_to . ': ' . $the_rate . ': ' . 'update_the_exchange_rates: ' . $interval );
194
  } */
195
  }
196
 
197
  if ( wcj_is_module_enabled( 'price_by_country' ) ) {
198
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_country_price_filter_widget_support_enabled', 'no' ) ) {
199
  wcj_update_products_price_by_country();
200
  }
201
  }
includes/export/class-wcj-exporter-customers.php CHANGED
@@ -33,7 +33,7 @@ class WCJ_Exporter_Customers {
33
 
34
  // Standard Fields
35
  $all_fields = $fields_helper->get_customer_export_fields();
36
- $fields_ids = get_option( 'wcj_export_customers_fields', $fields_helper->get_customer_export_default_fields_ids() );
37
  $titles = array();
38
  foreach( $fields_ids as $field_id ) {
39
  $titles[] = $all_fields[ $field_id ];
@@ -97,7 +97,7 @@ class WCJ_Exporter_Customers {
97
 
98
  // Standard Fields
99
  $all_fields = $fields_helper->get_customer_from_order_export_fields();
100
- $fields_ids = get_option( 'wcj_export_customers_from_orders_fields', $fields_helper->get_customer_from_order_export_default_fields_ids() );
101
  $titles = array();
102
  foreach( $fields_ids as $field_id ) {
103
  $titles[] = $all_fields[ $field_id ];
@@ -172,7 +172,7 @@ class WCJ_Exporter_Customers {
172
  $row[] = ( WCJ_IS_WC_VERSION_BELOW_3 ? $order->billing_phone : $order->get_billing_phone() );
173
  break;
174
  case 'customer-last-order-date':
175
- $row[] = get_the_date( get_option( 'date_format' ), $order_id );
176
  break;
177
  }
178
  }
33
 
34
  // Standard Fields
35
  $all_fields = $fields_helper->get_customer_export_fields();
36
+ $fields_ids = wcj_get_option( 'wcj_export_customers_fields', $fields_helper->get_customer_export_default_fields_ids() );
37
  $titles = array();
38
  foreach( $fields_ids as $field_id ) {
39
  $titles[] = $all_fields[ $field_id ];
97
 
98
  // Standard Fields
99
  $all_fields = $fields_helper->get_customer_from_order_export_fields();
100
+ $fields_ids = wcj_get_option( 'wcj_export_customers_from_orders_fields', $fields_helper->get_customer_from_order_export_default_fields_ids() );
101
  $titles = array();
102
  foreach( $fields_ids as $field_id ) {
103
  $titles[] = $all_fields[ $field_id ];
172
  $row[] = ( WCJ_IS_WC_VERSION_BELOW_3 ? $order->billing_phone : $order->get_billing_phone() );
173
  break;
174
  case 'customer-last-order-date':
175
+ $row[] = get_the_date( wcj_get_option( 'date_format' ), $order_id );
176
  break;
177
  }
178
  }
includes/export/class-wcj-exporter-orders.php CHANGED
@@ -89,10 +89,10 @@ class WCJ_Exporter_Orders {
89
  $row[] = $order->get_status();
90
  break;
91
  case 'order-date':
92
- $row[] = get_the_date( get_option( 'date_format' ), $order_id );
93
  break;
94
  case 'order-time':
95
- $row[] = get_the_time( get_option( 'time_format' ), $order_id );
96
  break;
97
  case 'order-item-count':
98
  $row[] = $order->get_item_count();
@@ -194,17 +194,17 @@ class WCJ_Exporter_Orders {
194
 
195
  // Standard Fields
196
  $all_fields = $fields_helper->get_order_export_fields();
197
- $fields_ids = get_option( 'wcj_export_orders_fields', $fields_helper->get_order_export_default_fields_ids() );
198
  $titles = array();
199
  foreach( $fields_ids as $field_id ) {
200
  $titles[] = $all_fields[ $field_id ];
201
  }
202
 
203
  // Additional Fields
204
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_export_orders_fields_additional_total_number', 1 ) );
205
  for ( $i = 1; $i <= $total_number; $i++ ) {
206
- if ( 'yes' === get_option( 'wcj_export_orders_fields_additional_enabled_' . $i, 'no' ) ) {
207
- $titles[] = get_option( 'wcj_export_orders_fields_additional_title_' . $i, '' );
208
  }
209
  }
210
 
@@ -275,11 +275,11 @@ class WCJ_Exporter_Orders {
275
  $row = $this->get_export_orders_row( $fields_ids, $order_id, $order, $items, $items_product_input_fields, null, null );
276
 
277
  // Additional Fields
278
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_export_orders_fields_additional_total_number', 1 ) );
279
  for ( $i = 1; $i <= $total_number; $i++ ) {
280
- if ( 'yes' === get_option( 'wcj_export_orders_fields_additional_enabled_' . $i, 'no' ) ) {
281
- if ( '' != ( $additional_field_value = get_option( 'wcj_export_orders_fields_additional_value_' . $i, '' ) ) ) {
282
- if ( 'meta' === get_option( 'wcj_export_orders_fields_additional_type_' . $i, 'meta' ) ) {
283
  $row[] = $this->safely_get_post_meta( $order_id, $additional_field_value );
284
  } else {
285
  global $post;
@@ -311,17 +311,17 @@ class WCJ_Exporter_Orders {
311
 
312
  // Standard Fields
313
  $all_fields = $fields_helper->get_order_items_export_fields();
314
- $fields_ids = apply_filters( 'wcj_export_orders_items_fields', get_option( 'wcj_export_orders_items_fields', $fields_helper->get_order_items_export_default_fields_ids() ) );
315
  $titles = array();
316
  foreach( $fields_ids as $field_id ) {
317
  $titles[] = $all_fields[ $field_id ];
318
  }
319
 
320
  // Additional Fields
321
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_export_orders_items_fields_additional_total_number', 1 ) );
322
  for ( $i = 1; $i <= $total_number; $i++ ) {
323
- if ( 'yes' === get_option( 'wcj_export_orders_items_fields_additional_enabled_' . $i, 'no' ) ) {
324
- $titles[] = get_option( 'wcj_export_orders_items_fields_additional_title_' . $i, '' );
325
  }
326
  }
327
 
@@ -364,11 +364,11 @@ class WCJ_Exporter_Orders {
364
  $row = $this->get_export_orders_row( $fields_ids, $order_id, $order, null, null, $item, $item_id );
365
 
366
  // Additional Fields
367
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_export_orders_items_fields_additional_total_number', 1 ) );
368
  for ( $i = 1; $i <= $total_number; $i++ ) {
369
- if ( 'yes' === get_option( 'wcj_export_orders_items_fields_additional_enabled_' . $i, 'no' ) ) {
370
- if ( '' != ( $additional_field_value = get_option( 'wcj_export_orders_items_fields_additional_value_' . $i, '' ) ) ) {
371
- $field_type = get_option( 'wcj_export_orders_items_fields_additional_type_' . $i, 'meta' );
372
  switch ( $field_type ) {
373
  case 'meta':
374
  $row[] = $this->safely_get_post_meta( $order_id, $additional_field_value );
89
  $row[] = $order->get_status();
90
  break;
91
  case 'order-date':
92
+ $row[] = get_the_date( wcj_get_option( 'date_format' ), $order_id );
93
  break;
94
  case 'order-time':
95
+ $row[] = get_the_time( wcj_get_option( 'time_format' ), $order_id );
96
  break;
97
  case 'order-item-count':
98
  $row[] = $order->get_item_count();
194
 
195
  // Standard Fields
196
  $all_fields = $fields_helper->get_order_export_fields();
197
+ $fields_ids = wcj_get_option( 'wcj_export_orders_fields', $fields_helper->get_order_export_default_fields_ids() );
198
  $titles = array();
199
  foreach( $fields_ids as $field_id ) {
200
  $titles[] = $all_fields[ $field_id ];
201
  }
202
 
203
  // Additional Fields
204
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_export_orders_fields_additional_total_number', 1 ) );
205
  for ( $i = 1; $i <= $total_number; $i++ ) {
206
+ if ( 'yes' === wcj_get_option( 'wcj_export_orders_fields_additional_enabled_' . $i, 'no' ) ) {
207
+ $titles[] = wcj_get_option( 'wcj_export_orders_fields_additional_title_' . $i, '' );
208
  }
209
  }
210
 
275
  $row = $this->get_export_orders_row( $fields_ids, $order_id, $order, $items, $items_product_input_fields, null, null );
276
 
277
  // Additional Fields
278
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_export_orders_fields_additional_total_number', 1 ) );
279
  for ( $i = 1; $i <= $total_number; $i++ ) {
280
+ if ( 'yes' === wcj_get_option( 'wcj_export_orders_fields_additional_enabled_' . $i, 'no' ) ) {
281
+ if ( '' != ( $additional_field_value = wcj_get_option( 'wcj_export_orders_fields_additional_value_' . $i, '' ) ) ) {
282
+ if ( 'meta' === wcj_get_option( 'wcj_export_orders_fields_additional_type_' . $i, 'meta' ) ) {
283
  $row[] = $this->safely_get_post_meta( $order_id, $additional_field_value );
284
  } else {
285
  global $post;
311
 
312
  // Standard Fields
313
  $all_fields = $fields_helper->get_order_items_export_fields();
314
+ $fields_ids = apply_filters( 'wcj_export_orders_items_fields', wcj_get_option( 'wcj_export_orders_items_fields', $fields_helper->get_order_items_export_default_fields_ids() ) );
315
  $titles = array();
316
  foreach( $fields_ids as $field_id ) {
317
  $titles[] = $all_fields[ $field_id ];
318
  }
319
 
320
  // Additional Fields
321
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_export_orders_items_fields_additional_total_number', 1 ) );
322
  for ( $i = 1; $i <= $total_number; $i++ ) {
323
+ if ( 'yes' === wcj_get_option( 'wcj_export_orders_items_fields_additional_enabled_' . $i, 'no' ) ) {
324
+ $titles[] = wcj_get_option( 'wcj_export_orders_items_fields_additional_title_' . $i, '' );
325
  }
326
  }
327
 
364
  $row = $this->get_export_orders_row( $fields_ids, $order_id, $order, null, null, $item, $item_id );
365
 
366
  // Additional Fields
367
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_export_orders_items_fields_additional_total_number', 1 ) );
368
  for ( $i = 1; $i <= $total_number; $i++ ) {
369
+ if ( 'yes' === wcj_get_option( 'wcj_export_orders_items_fields_additional_enabled_' . $i, 'no' ) ) {
370
+ if ( '' != ( $additional_field_value = wcj_get_option( 'wcj_export_orders_items_fields_additional_value_' . $i, '' ) ) ) {
371
+ $field_type = wcj_get_option( 'wcj_export_orders_items_fields_additional_type_' . $i, 'meta' );
372
  switch ( $field_type ) {
373
  case 'meta':
374
  $row[] = $this->safely_get_post_meta( $order_id, $additional_field_value );
includes/export/class-wcj-exporter-products.php CHANGED
@@ -65,17 +65,17 @@ class WCJ_Exporter_Products {
65
 
66
  // Standard Fields
67
  $all_fields = $fields_helper->get_product_export_fields();
68
- $fields_ids = get_option( 'wcj_export_products_fields', $fields_helper->get_product_export_default_fields_ids() );
69
  $titles = array();
70
  foreach( $fields_ids as $field_id ) {
71
  $titles[] = $all_fields[ $field_id ];
72
  }
73
 
74
  // Additional Fields
75
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_export_products_fields_additional_total_number', 1 ) );
76
  for ( $i = 1; $i <= $total_number; $i++ ) {
77
- if ( 'yes' === get_option( 'wcj_export_products_fields_additional_enabled_' . $i, 'no' ) ) {
78
- $titles[] = get_option( 'wcj_export_products_fields_additional_title_' . $i, '' );
79
  }
80
  }
81
 
@@ -104,7 +104,7 @@ class WCJ_Exporter_Products {
104
  $parent_product_id = '';
105
  if ( $_product->is_type( 'variable' ) ) {
106
  $parent_product_id = $product_id;
107
- $export_products_variable = get_option( 'wcj_export_products_variable', 'variable_only' );
108
  if ( 'variations_only' === $export_products_variable || 'variable_and_variations' === $export_products_variable ) {
109
  if ( 'variations_only' === $export_products_variable ) {
110
  $products = array();
@@ -261,11 +261,11 @@ class WCJ_Exporter_Products {
261
  }
262
 
263
  // Additional Fields
264
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_export_products_fields_additional_total_number', 1 ) );
265
  for ( $i = 1; $i <= $total_number; $i++ ) {
266
- if ( 'yes' === get_option( 'wcj_export_products_fields_additional_enabled_' . $i, 'no' ) ) {
267
- if ( '' != ( $additional_field_value = get_option( 'wcj_export_products_fields_additional_value_' . $i, '' ) ) ) {
268
- if ( 'meta' === get_option( 'wcj_export_products_fields_additional_type_' . $i, 'meta' ) ) {
269
  $row[] = get_post_meta( $product_id, $additional_field_value, true );
270
  } else {
271
  global $post;
65
 
66
  // Standard Fields
67
  $all_fields = $fields_helper->get_product_export_fields();
68
+ $fields_ids = wcj_get_option( 'wcj_export_products_fields', $fields_helper->get_product_export_default_fields_ids() );
69
  $titles = array();
70
  foreach( $fields_ids as $field_id ) {
71
  $titles[] = $all_fields[ $field_id ];
72
  }
73
 
74
  // Additional Fields
75
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_export_products_fields_additional_total_number', 1 ) );
76
  for ( $i = 1; $i <= $total_number; $i++ ) {
77
+ if ( 'yes' === wcj_get_option( 'wcj_export_products_fields_additional_enabled_' . $i, 'no' ) ) {
78
+ $titles[] = wcj_get_option( 'wcj_export_products_fields_additional_title_' . $i, '' );
79
  }
80
  }
81
 
104
  $parent_product_id = '';
105
  if ( $_product->is_type( 'variable' ) ) {
106
  $parent_product_id = $product_id;
107
+ $export_products_variable = wcj_get_option( 'wcj_export_products_variable', 'variable_only' );
108
  if ( 'variations_only' === $export_products_variable || 'variable_and_variations' === $export_products_variable ) {
109
  if ( 'variations_only' === $export_products_variable ) {
110
  $products = array();
261
  }
262
 
263
  // Additional Fields
264
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_export_products_fields_additional_total_number', 1 ) );
265
  for ( $i = 1; $i <= $total_number; $i++ ) {
266
+ if ( 'yes' === wcj_get_option( 'wcj_export_products_fields_additional_enabled_' . $i, 'no' ) ) {
267
+ if ( '' != ( $additional_field_value = wcj_get_option( 'wcj_export_products_fields_additional_value_' . $i, '' ) ) ) {
268
+ if ( 'meta' === wcj_get_option( 'wcj_export_products_fields_additional_type_' . $i, 'meta' ) ) {
269
  $row[] = get_post_meta( $product_id, $additional_field_value, true );
270
  } else {
271
  global $post;
includes/functions/wcj-functions-admin.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Functions - Admin
4
  *
5
- * @version 4.9.0
6
  * @since 2.9.0
7
  * @author Pluggabl LLC.
8
  */
@@ -109,7 +109,7 @@ if ( ! function_exists( 'wcj_admin_notices_version_updated' ) ) {
109
  * @since 2.8.0
110
  */
111
  function wcj_admin_notices_version_updated() {
112
- if ( get_option( WCJ_VERSION_OPTION ) === WCJ()->version ) {
113
  $class = 'notice notice-success is-dismissible';
114
  $message = sprintf( __( '<strong>Booster for WooCommerce</strong> plugin was successfully updated to version <strong>%s</strong>.', 'woocommerce-jetpack' ), WCJ()->version );
115
  echo sprintf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
@@ -121,7 +121,7 @@ if ( ! function_exists( 'wcj_get_ajax_settings' ) ) {
121
  /**
122
  * wcj_get_ajax_settings
123
  *
124
- * @version 4.9.0
125
  * @since 4.3.0
126
  *
127
  * @param $values
@@ -131,15 +131,18 @@ if ( ! function_exists( 'wcj_get_ajax_settings' ) ) {
131
  * @return array
132
  */
133
  function wcj_get_ajax_settings( $values, $allow_multiple_values = false, $search_type = 'woocommerce_json_search_products' ) {
134
- $options_raw = get_option( $values['id'], isset( $values['default'] ) ? $values['default'] : '' );
 
135
  $options = array();
136
  $class = '';
137
  if ( $search_type == 'woocommerce_json_search_products' || $search_type == 'woocommerce_json_search_products_and_variations' ) {
138
  $class = 'wc-product-search';
139
- foreach ( $options_raw as $product_id ) {
140
- $product = wc_get_product( $product_id );
141
- if ( is_a( $product, 'WC_Product' ) ) {
142
- $options[ $product_id ] = wp_kses_post( $product->get_formatted_name() );
 
 
143
  }
144
  }
145
  } elseif ( $search_type == 'woocommerce_json_search_categories' ) {
@@ -229,7 +232,7 @@ if ( ! function_exists( 'wcj_maybe_convert_and_update_option_value' ) ) {
229
  */
230
  function wcj_maybe_convert_and_update_option_value( $options, $is_multiselect ) {
231
  foreach ( $options as $option ) {
232
- $value = get_option( $option['id'], $option['default'] );
233
  if ( ! $is_multiselect ) {
234
  if ( is_array( $value ) ) {
235
  $value = implode( ',', $value );
2
  /**
3
  * Booster for WooCommerce - Functions - Admin
4
  *
5
+ * @version 5.3.3
6
  * @since 2.9.0
7
  * @author Pluggabl LLC.
8
  */
109
  * @since 2.8.0
110
  */
111
  function wcj_admin_notices_version_updated() {
112
+ if ( wcj_get_option( WCJ_VERSION_OPTION ) === WCJ()->version ) {
113
  $class = 'notice notice-success is-dismissible';
114
  $message = sprintf( __( '<strong>Booster for WooCommerce</strong> plugin was successfully updated to version <strong>%s</strong>.', 'woocommerce-jetpack' ), WCJ()->version );
115
  echo sprintf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
121
  /**
122
  * wcj_get_ajax_settings
123
  *
124
+ * @version 5.3.3
125
  * @since 4.3.0
126
  *
127
  * @param $values
131
  * @return array
132
  */
133
  function wcj_get_ajax_settings( $values, $allow_multiple_values = false, $search_type = 'woocommerce_json_search_products' ) {
134
+ $options_raw = wcj_get_option( $values['id'], isset( $values['default'] ) ? $values['default'] : '' );
135
+ $options_raw = empty( $options_raw ) ? array() : $options_raw;
136
  $options = array();
137
  $class = '';
138
  if ( $search_type == 'woocommerce_json_search_products' || $search_type == 'woocommerce_json_search_products_and_variations' ) {
139
  $class = 'wc-product-search';
140
+ if( $options_raw ) {
141
+ foreach ( $options_raw as $product_id ) {
142
+ $product = wc_get_product( $product_id );
143
+ if ( is_a( $product, 'WC_Product' ) ) {
144
+ $options[ $product_id ] = wp_kses_post( $product->get_formatted_name() );
145
+ }
146
  }
147
  }
148
  } elseif ( $search_type == 'woocommerce_json_search_categories' ) {
232
  */
233
  function wcj_maybe_convert_and_update_option_value( $options, $is_multiselect ) {
234
  foreach ( $options as $option ) {
235
+ $value = wcj_get_option( $option['id'], $option['default'] );
236
  if ( ! $is_multiselect ) {
237
  if ( is_array( $value ) ) {
238
  $value = implode( ',', $value );
includes/functions/wcj-functions-booster-core.php CHANGED
@@ -93,8 +93,8 @@ if ( ! function_exists( 'wcj_check_modules_by_user_roles' ) ) {
93
  $wcj_modules_by_user_roles_data['role'] = ( isset( $current_user->roles ) && is_array( $current_user->roles ) && ! empty( $current_user->roles ) ?
94
  reset( $current_user->roles ) : 'guest' );
95
  $wcj_modules_by_user_roles_data['role'] = ( '' != $wcj_modules_by_user_roles_data['role'] ? $wcj_modules_by_user_roles_data['role'] : 'guest' );
96
- $wcj_modules_by_user_roles_data['modules_incl'] = get_option( 'wcj_modules_by_user_roles_incl_' . $wcj_modules_by_user_roles_data['role'], '' );
97
- $wcj_modules_by_user_roles_data['modules_excl'] = get_option( 'wcj_modules_by_user_roles_excl_' . $wcj_modules_by_user_roles_data['role'], '' );
98
  }
99
  return (
100
  ( ! empty( $wcj_modules_by_user_roles_data['modules_incl'] ) && ! in_array( $module_id, $wcj_modules_by_user_roles_data['modules_incl'] ) ) ||
@@ -113,6 +113,6 @@ if ( ! function_exists( 'wcj_is_module_enabled' ) ) {
113
  */
114
  function wcj_is_module_enabled( $module_id ) {
115
  return ( 'modules_by_user_roles' != $module_id && wcj_is_module_enabled( 'modules_by_user_roles' ) && ! wcj_is_rest() && ! wcj_check_modules_by_user_roles( $module_id ) ?
116
- false : ( 'yes' === get_option( 'wcj_' . $module_id . '_enabled', 'no' ) ) );
117
  }
118
  }
93
  $wcj_modules_by_user_roles_data['role'] = ( isset( $current_user->roles ) && is_array( $current_user->roles ) && ! empty( $current_user->roles ) ?
94
  reset( $current_user->roles ) : 'guest' );
95
  $wcj_modules_by_user_roles_data['role'] = ( '' != $wcj_modules_by_user_roles_data['role'] ? $wcj_modules_by_user_roles_data['role'] : 'guest' );
96
+ $wcj_modules_by_user_roles_data['modules_incl'] = wcj_get_option( 'wcj_modules_by_user_roles_incl_' . $wcj_modules_by_user_roles_data['role'], '' );
97
+ $wcj_modules_by_user_roles_data['modules_excl'] = wcj_get_option( 'wcj_modules_by_user_roles_excl_' . $wcj_modules_by_user_roles_data['role'], '' );
98
  }
99
  return (
100
  ( ! empty( $wcj_modules_by_user_roles_data['modules_incl'] ) && ! in_array( $module_id, $wcj_modules_by_user_roles_data['modules_incl'] ) ) ||
113
  */
114
  function wcj_is_module_enabled( $module_id ) {
115
  return ( 'modules_by_user_roles' != $module_id && wcj_is_module_enabled( 'modules_by_user_roles' ) && ! wcj_is_rest() && ! wcj_check_modules_by_user_roles( $module_id ) ?
116
+ false : ( 'yes' === wcj_get_option( 'wcj_' . $module_id . '_enabled', 'no' ) ) );
117
  }
118
  }
includes/functions/wcj-functions-core.php CHANGED
@@ -77,3 +77,23 @@ if ( ! function_exists( 'wcj_is_plugin_activated' ) ) {
77
  }
78
  }
79
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  }
78
  }
79
  }
80
+
81
+ if ( ! function_exists( 'wcj_get_option' ) ) {
82
+ /**
83
+ * wcj_get_option.
84
+ *
85
+ * @version 5.3.3
86
+ * @since 5.3.3
87
+ *
88
+ * @param $option_name
89
+ * @param null $default
90
+ *
91
+ * @return bool
92
+ */
93
+ function wcj_get_option( $option_name, $default = null ) {
94
+ if ( ! isset( WCJ()->options[ $option_name ] ) ) {
95
+ WCJ()->options[ $option_name ] = get_option( $option_name, $default );
96
+ }
97
+ return apply_filters( $option_name, WCJ()->options[ $option_name ] );
98
+ }
99
+ }
includes/functions/wcj-functions-country.php CHANGED
@@ -34,7 +34,7 @@ if ( ! function_exists( 'wcj_get_country_by_ip' ) ) {
34
  $location = ( class_exists( 'WC_Geolocation' ) ? WC_Geolocation::geolocate_ip() : array( 'country' => '' ) );
35
  // Base fallback
36
  if ( empty( $location['country'] ) ) {
37
- $location = apply_filters( 'woocommerce_customer_default_location', get_option( 'woocommerce_default_country' ) );
38
  if ( function_exists( 'wc_format_country_state_string' ) ) {
39
  $location = wc_format_country_state_string( $location );
40
  }
34
  $location = ( class_exists( 'WC_Geolocation' ) ? WC_Geolocation::geolocate_ip() : array( 'country' => '' ) );
35
  // Base fallback
36
  if ( empty( $location['country'] ) ) {
37
+ $location = apply_filters( 'woocommerce_customer_default_location', wcj_get_option( 'woocommerce_default_country' ) );
38
  if ( function_exists( 'wc_format_country_state_string' ) ) {
39
  $location = wc_format_country_state_string( $location );
40
  }
includes/functions/wcj-functions-crons.php CHANGED
@@ -74,8 +74,8 @@ if ( ! function_exists( 'wcj_crons_get_next_event_time_message' ) ) {
74
  * @todo (maybe) move to "date-time" functions
75
  */
76
  function wcj_crons_get_next_event_time_message( $time_option_name ) {
77
- if ( '' != get_option( $time_option_name, '' ) ) {
78
- $scheduled_time_diff = get_option( $time_option_name, '' ) - time();
79
  if ( $scheduled_time_diff > 60 ) {
80
  return '<br><em>' . sprintf( __( '%s till next run.', 'woocommerce-jetpack' ), human_time_diff( 0, $scheduled_time_diff ) ) . '</em>';
81
  } elseif ( $scheduled_time_diff > 0 ) {
74
  * @todo (maybe) move to "date-time" functions
75
  */
76
  function wcj_crons_get_next_event_time_message( $time_option_name ) {
77
+ if ( '' != wcj_get_option( $time_option_name, '' ) ) {
78
+ $scheduled_time_diff = wcj_get_option( $time_option_name, '' ) - time();
79
  if ( $scheduled_time_diff > 60 ) {
80
  return '<br><em>' . sprintf( __( '%s till next run.', 'woocommerce-jetpack' ), human_time_diff( 0, $scheduled_time_diff ) ) . '</em>';
81
  } elseif ( $scheduled_time_diff > 0 ) {
includes/functions/wcj-functions-date-time.php CHANGED
@@ -249,9 +249,9 @@ if ( ! function_exists( 'wcj_timezone' ) ) {
249
  if ( version_compare( $wp_version, '5.3.0', '>=' ) ) {
250
  return wp_timezone();
251
  }
252
- $timezone = get_option( 'timezone_string' );
253
  if ( ! $timezone ) {
254
- $offset = (float) get_option( 'gmt_offset' );
255
  $hours = (int) $offset;
256
  $minutes = ( $offset - $hours );
257
  $sign = ( $offset < 0 ) ? '-' : '+';
@@ -286,7 +286,7 @@ if ( ! function_exists( 'wcj_pretty_utc_date' ) ) {
286
  ( new DateTime( $date_in_local_timezone, new DateTimeZone( 'UTC' ) ) )
287
  ->getTimestamp();
288
  if ( empty( $format ) ) {
289
- $format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
290
  }
291
  return date_i18n( $format, $seconds_since_local_1_jan_1970 );
292
  }
249
  if ( version_compare( $wp_version, '5.3.0', '>=' ) ) {
250
  return wp_timezone();
251
  }
252
+ $timezone = wcj_get_option( 'timezone_string' );
253
  if ( ! $timezone ) {
254
+ $offset = (float) wcj_get_option( 'gmt_offset' );
255
  $hours = (int) $offset;
256
  $minutes = ( $offset - $hours );
257
  $sign = ( $offset < 0 ) ? '-' : '+';
286
  ( new DateTime( $date_in_local_timezone, new DateTimeZone( 'UTC' ) ) )
287
  ->getTimestamp();
288
  if ( empty( $format ) ) {
289
+ $format = wcj_get_option( 'date_format' ) . ' ' . wcj_get_option( 'time_format' );
290
  }
291
  return date_i18n( $format, $seconds_since_local_1_jan_1970 );
292
  }
includes/functions/wcj-functions-debug.php CHANGED
@@ -15,7 +15,7 @@ if ( ! function_exists( 'wcj_log' ) ) {
15
  * @version 4.1.0
16
  */
17
  function wcj_log( $message = '', $do_var_dump = false ) {
18
- if ( ! wcj_is_module_enabled( 'debug_tools' ) || ( 'no' === get_option( 'wcj_logging_enabled', 'no' ) && 'no' === get_option( 'wcj_wc_logging_enabled', 'no' ) ) ) {
19
  return;
20
  }
21
  if ( $do_var_dump ) {
@@ -25,11 +25,11 @@ if ( ! function_exists( 'wcj_log' ) ) {
25
  } elseif ( is_array( $message ) || is_object( $message ) ) {
26
  $message = print_r( $message, true );
27
  }
28
- if ( 'yes' === get_option( 'wcj_logging_enabled', 'no' ) ) {
29
- update_option( 'wcj_log', '<span style="color:red;">' . date( 'Y-m-d H:i:s' ) . ' ' . esc_url( $_SERVER['REQUEST_URI'] ) . '</span> <span style="color:orange;">[</span>' . $message . '<span style="color:orange;">]</span>' . '<br>' . get_option( 'wcj_log', '' ) );
30
  }
31
  // WC log
32
- if ( 'yes' === get_option( 'wcj_wc_logging_enabled', 'no' ) && function_exists( 'wc_get_logger' ) ) {
33
  if ( $log = wc_get_logger() ) {
34
  $log->log( 'info', $message, array( 'source' => 'booster_for_woocommerce' ) );
35
  }
15
  * @version 4.1.0
16
  */
17
  function wcj_log( $message = '', $do_var_dump = false ) {
18
+ if ( ! wcj_is_module_enabled( 'debug_tools' ) || ( 'no' === wcj_get_option( 'wcj_logging_enabled', 'no' ) && 'no' === wcj_get_option( 'wcj_wc_logging_enabled', 'no' ) ) ) {
19
  return;
20
  }
21
  if ( $do_var_dump ) {
25
  } elseif ( is_array( $message ) || is_object( $message ) ) {
26
  $message = print_r( $message, true );
27
  }
28
+ if ( 'yes' === wcj_get_option( 'wcj_logging_enabled', 'no' ) ) {
29
+ update_option( 'wcj_log', '<span style="color:red;">' . date( 'Y-m-d H:i:s' ) . ' ' . esc_url( $_SERVER['REQUEST_URI'] ) . '</span> <span style="color:orange;">[</span>' . $message . '<span style="color:orange;">]</span>' . '<br>' . wcj_get_option( 'wcj_log', '' ) );
30
  }
31
  // WC log
32
+ if ( 'yes' === wcj_get_option( 'wcj_wc_logging_enabled', 'no' ) && function_exists( 'wc_get_logger' ) ) {
33
  if ( $log = wc_get_logger() ) {
34
  $log->log( 'info', $message, array( 'source' => 'booster_for_woocommerce' ) );
35
  }
includes/functions/wcj-functions-eu-vat.php CHANGED
@@ -111,7 +111,7 @@ if ( ! function_exists( 'wcj_validate_vat' ) ) {
111
  * @return mixed: bool on successful checking (can be true or false), null otherwise
112
  */
113
  function wcj_validate_vat( $country_code, $vat_number ) {
114
- if ( '' != ( $skip_countries = get_option( 'wcj_eu_vat_number_advanced_skip_countries', array() ) ) ) {
115
  $skip_countries = array_map( 'trim', explode( ',', $skip_countries ) );
116
  $skip_countries = array_map( 'strtoupper', $skip_countries );
117
  if ( in_array( strtoupper( $country_code ), $skip_countries ) ) {
@@ -119,7 +119,7 @@ if ( ! function_exists( 'wcj_validate_vat' ) ) {
119
  }
120
  }
121
  $methods = array();
122
- switch ( get_option( 'wcj_eu_vat_number_first_method', 'soap' ) ) {
123
  case 'curl':
124
  $methods = array( 'curl', 'file_get_contents', 'soap' );
125
  break;
111
  * @return mixed: bool on successful checking (can be true or false), null otherwise
112
  */
113
  function wcj_validate_vat( $country_code, $vat_number ) {
114
+ if ( '' != ( $skip_countries = wcj_get_option( 'wcj_eu_vat_number_advanced_skip_countries', array() ) ) ) {
115
  $skip_countries = array_map( 'trim', explode( ',', $skip_countries ) );
116
  $skip_countries = array_map( 'strtoupper', $skip_countries );
117
  if ( in_array( strtoupper( $country_code ), $skip_countries ) ) {
119
  }
120
  }
121
  $methods = array();
122
+ switch ( wcj_get_option( 'wcj_eu_vat_number_first_method', 'soap' ) ) {
123
  case 'curl':
124
  $methods = array( 'curl', 'file_get_contents', 'soap' );
125
  break;
includes/functions/wcj-functions-exchange-rates.php CHANGED
@@ -26,7 +26,7 @@ if ( ! function_exists( 'wcj_get_saved_exchange_rate' ) ) {
26
  $active_currencies_settings = WCJ()->modules['currency_exchange_rates']->get_all_currencies_exchange_rates_settings();
27
  $active_currencies = array();
28
  foreach ( $active_currencies_settings as $currency ) {
29
- $active_currencies[ str_replace( 'wcj_currency_exchange_rates_', '', $currency['id'] ) ] = get_option( $currency['id'] );
30
  }
31
  WCJ()->modules['currency_exchange_rates']->active_currencies = $active_currencies;
32
  } else {
@@ -46,7 +46,7 @@ if ( ! function_exists( 'wcj_get_saved_exchange_rate' ) ) {
46
  }
47
  // Getting exchange rate - shop base
48
  if ( 0 == $exchange_rate ) {
49
- $shop_currency = get_option( 'woocommerce_currency' );
50
  $exchange_rate_from = ( isset( $active_currencies[ sanitize_title( $shop_currency . $from ) ] ) ? $active_currencies[ sanitize_title( $shop_currency . $from ) ] : 0 );
51
  $exchange_rate_to = ( isset( $active_currencies[ sanitize_title( $shop_currency . $to ) ] ) ? $active_currencies[ sanitize_title( $shop_currency . $to ) ] : 0 );
52
  if ( 0 != $exchange_rate_from ) {
@@ -84,8 +84,8 @@ if ( ! function_exists( 'wcj_get_currency_exchange_rate_server' ) ) {
84
  * @since 3.2.4
85
  */
86
  function wcj_get_currency_exchange_rate_server( $currency_from, $currency_to ) {
87
- if ( 'default_server' === ( $server = get_option( 'wcj_currency_exchange_rates_server_' . sanitize_title( $currency_from . $currency_to ), 'default_server' ) ) ) {
88
- return get_option( 'wcj_currency_exchange_rates_server', 'ecb' );
89
  }
90
  return $server;
91
  }
@@ -100,10 +100,10 @@ if ( ! function_exists( 'wcj_get_currency_exchange_rate_offset_percent' ) ) {
100
  */
101
  function wcj_get_currency_exchange_rate_offset_percent( $currency_from, $currency_to ) {
102
  $field_id = 'wcj_currency_exchange_rates_offset_percent_' . sanitize_title( $currency_from . $currency_to );
103
- if ( 'default_offset' === get_option( $field_id, 'default_offset' ) ) {
104
- return get_option( 'wcj_currency_exchange_rates_offset_percent', 0 );
105
  }
106
- return get_option( $field_id . '_' . 'custom_offset', 0 );
107
  }
108
  }
109
 
@@ -133,7 +133,7 @@ if ( ! function_exists( 'wcj_get_exchange_rate' ) ) {
133
  return 1;
134
  }
135
  $exchange_rates_server = wcj_get_currency_exchange_rate_server( $currency_from, $currency_to );
136
- if ( 'yes' === ( $calculate_by_invert = get_option( 'wcj_currency_exchange_rates_calculate_by_invert', 'no' ) ) ) {
137
  $_currency_to = $currency_to;
138
  $currency_to = $currency_from;
139
  $currency_from = $_currency_to;
@@ -175,7 +175,7 @@ if ( ! function_exists( 'wcj_get_currency_exchange_rates_url_response' ) ) {
175
  */
176
  function wcj_get_currency_exchange_rates_url_response( $url, $do_json_decode = true ) {
177
  $response = '';
178
- if ( 'no' === get_option( 'wcj_currency_exchange_rates_always_curl', 'no' ) && ini_get( 'allow_url_fopen' ) ) {
179
  $response = file_get_contents( $url );
180
  } elseif ( function_exists( 'curl_version' ) ) {
181
  $curl = curl_init( $url );
@@ -198,7 +198,7 @@ if ( ! function_exists( 'wcj_currencyconverterapi_get_exchange_rate' ) ) {
198
  function wcj_currencyconverterapi_get_exchange_rate( $currency_from, $currency_to ) {
199
  $pair = $currency_from . '_' . $currency_to;
200
  $url = 'https://free.currencyconverterapi.com/api/v6/convert?q=' . $pair . '&compact=y';
201
- $api_key = get_option( 'wcj_currency_exchange_api_key_fccapi' );
202
  if ( ! empty( $api_key ) ) {
203
  $url = add_query_arg( array(
204
  'apiKey' => $api_key
@@ -513,7 +513,7 @@ if ( ! function_exists( 'wcj_currencyconverterapi_io_get_exchange_rate_average'
513
  $date_ranges = wcj_get_date_ranges( $start_date, $end_date, 8 );
514
  foreach ( $date_ranges as $range ) {
515
  $url = 'https://free.currencyconverterapi.com/api/v6/convert?q=' . $pair . '&compact=ultra&date=' . $range['start_date'] . '&endDate=' . $range['end_date'];
516
- $api_key = get_option( 'wcj_currency_exchange_api_key_fccapi' );
517
  if ( ! empty( $api_key ) ) {
518
  $url = add_query_arg( array(
519
  'apiKey' => $api_key
26
  $active_currencies_settings = WCJ()->modules['currency_exchange_rates']->get_all_currencies_exchange_rates_settings();
27
  $active_currencies = array();
28
  foreach ( $active_currencies_settings as $currency ) {
29
+ $active_currencies[ str_replace( 'wcj_currency_exchange_rates_', '', $currency['id'] ) ] = wcj_get_option( $currency['id'] );
30
  }
31
  WCJ()->modules['currency_exchange_rates']->active_currencies = $active_currencies;
32
  } else {
46
  }
47
  // Getting exchange rate - shop base
48
  if ( 0 == $exchange_rate ) {
49
+ $shop_currency = wcj_get_option( 'woocommerce_currency' );
50
  $exchange_rate_from = ( isset( $active_currencies[ sanitize_title( $shop_currency . $from ) ] ) ? $active_currencies[ sanitize_title( $shop_currency . $from ) ] : 0 );
51
  $exchange_rate_to = ( isset( $active_currencies[ sanitize_title( $shop_currency . $to ) ] ) ? $active_currencies[ sanitize_title( $shop_currency . $to ) ] : 0 );
52
  if ( 0 != $exchange_rate_from ) {
84
  * @since 3.2.4
85
  */
86
  function wcj_get_currency_exchange_rate_server( $currency_from, $currency_to ) {
87
+ if ( 'default_server' === ( $server = wcj_get_option( 'wcj_currency_exchange_rates_server_' . sanitize_title( $currency_from . $currency_to ), 'default_server' ) ) ) {
88
+ return wcj_get_option( 'wcj_currency_exchange_rates_server', 'ecb' );
89
  }
90
  return $server;
91
  }
100
  */
101
  function wcj_get_currency_exchange_rate_offset_percent( $currency_from, $currency_to ) {
102
  $field_id = 'wcj_currency_exchange_rates_offset_percent_' . sanitize_title( $currency_from . $currency_to );
103
+ if ( 'default_offset' === wcj_get_option( $field_id, 'default_offset' ) ) {
104
+ return wcj_get_option( 'wcj_currency_exchange_rates_offset_percent', 0 );
105
  }
106
+ return wcj_get_option( $field_id . '_' . 'custom_offset', 0 );
107
  }
108
  }
109
 
133
  return 1;
134
  }
135
  $exchange_rates_server = wcj_get_currency_exchange_rate_server( $currency_from, $currency_to );
136
+ if ( 'yes' === ( $calculate_by_invert = wcj_get_option( 'wcj_currency_exchange_rates_calculate_by_invert', 'no' ) ) ) {
137
  $_currency_to = $currency_to;
138
  $currency_to = $currency_from;
139
  $currency_from = $_currency_to;
175
  */
176
  function wcj_get_currency_exchange_rates_url_response( $url, $do_json_decode = true ) {
177
  $response = '';
178
+ if ( 'no' === wcj_get_option( 'wcj_currency_exchange_rates_always_curl', 'no' ) && ini_get( 'allow_url_fopen' ) ) {
179
  $response = file_get_contents( $url );
180
  } elseif ( function_exists( 'curl_version' ) ) {
181
  $curl = curl_init( $url );
198
  function wcj_currencyconverterapi_get_exchange_rate( $currency_from, $currency_to ) {
199
  $pair = $currency_from . '_' . $currency_to;
200
  $url = 'https://free.currencyconverterapi.com/api/v6/convert?q=' . $pair . '&compact=y';
201
+ $api_key = wcj_get_option( 'wcj_currency_exchange_api_key_fccapi' );
202
  if ( ! empty( $api_key ) ) {
203
  $url = add_query_arg( array(
204
  'apiKey' => $api_key
513
  $date_ranges = wcj_get_date_ranges( $start_date, $end_date, 8 );
514
  foreach ( $date_ranges as $range ) {
515
  $url = 'https://free.currencyconverterapi.com/api/v6/convert?q=' . $pair . '&compact=ultra&date=' . $range['start_date'] . '&endDate=' . $range['end_date'];
516
+ $api_key = wcj_get_option( 'wcj_currency_exchange_api_key_fccapi' );
517
  if ( ! empty( $api_key ) ) {
518
  $url = add_query_arg( array(
519
  'apiKey' => $api_key
includes/functions/wcj-functions-general.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Functions - General
4
  *
5
- * @version 4.8.0
6
  * @author Pluggabl LLC.
7
  * @todo add `wcj_add_actions()` and `wcj_add_filters()`
8
  */
@@ -320,7 +320,7 @@ if ( ! function_exists( 'wcj_session_maybe_start' ) ) {
320
  break;
321
  default:
322
  if ( session_status() == PHP_SESSION_NONE && ! headers_sent() ) {
323
- $read_and_close = ( 'yes' === get_option( 'wcj_general_advanced_session_read_and_close', 'no' ) ) && PHP_VERSION_ID > 70000 ? array( 'read_and_close' => true ) : array();
324
  session_start( $read_and_close );
325
  }
326
  break;
@@ -376,7 +376,7 @@ if ( ! function_exists( 'wcj_wrap_in_wc_email_template' ) ) {
376
  function wcj_wrap_in_wc_email_template( $content, $email_heading = '' ) {
377
  return wcj_get_wc_email_part( 'header', $email_heading ) .
378
  $content .
379
- str_replace( '{site_title}', wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), wcj_get_wc_email_part( 'footer' ) );
380
  }
381
  }
382
 
@@ -435,7 +435,7 @@ if ( ! function_exists( 'wcj_is_module_deprecated' ) ) {
435
  function wcj_is_module_deprecated( $module_id, $by_module_option = false, $check_for_disabled = false ) {
436
  if ( $check_for_disabled ) {
437
  $module_option = ( $by_module_option ? $module_id : 'wcj_' . $module_id . '_enabled' );
438
- if ( 'yes' === get_option( $module_option, 'no' ) ) {
439
  return false;
440
  }
441
  }
@@ -559,13 +559,13 @@ if ( ! function_exists( 'wcj_variation_radio_button' ) ) {
559
  $variation_label = wcj_replace_values_in_template( array(
560
  '%variation_title%' => implode( ', ', $variation_attributes_display_values ),
561
  '%variation_price%' => wc_price( $variation['display_price'] ),
562
- ), get_option( 'wcj_add_to_cart_variable_as_radio_variation_label_template', '%variation_title% (%variation_price%)' ) );
563
  // Variation ID and "is checked"
564
  $variation_id = $variation['variation_id'];
565
  $is_checked = checked( $is_checked, true, false );
566
  // Final HTML
567
  $html = '';
568
- $html .= '<td class="wcj_variable_as_radio_input_td" style="' . get_option( 'wcj_add_to_cart_variable_as_radio_input_td_style', 'width:10%;' ) . '">';
569
  $html .= '<input id="wcj_variation_' . $variation_id . '" name="wcj_variations" type="radio"' . $attributes_html . ' variation_id="' .
570
  $variation_id . '"' . $is_checked . '>';
571
  $html .= '</td>';
@@ -575,7 +575,7 @@ if ( ! function_exists( 'wcj_variation_radio_button' ) ) {
575
  if ( '' != ( $variation_description = get_post_meta( $variation_id, '_variation_description', true ) ) ) {
576
  $html .= wcj_replace_values_in_template( array(
577
  '%variation_description%' => $variation_description,
578
- ), get_option( 'wcj_add_to_cart_variable_as_radio_variation_desc_template', '<br><small>%variation_description%</small>' ) );
579
  }
580
  $html .= '</label>';
581
  $html .= '</td>';
@@ -802,7 +802,7 @@ if ( ! function_exists( 'wcj_get_the_ip' ) ) {
802
  function wcj_get_the_ip() {
803
  $ip = null;
804
  $ip_detection_methods = array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'REMOTE_ADDR' );
805
- $ip_detection_methods = 'yes' === get_option( 'wcj_general_enabled', 'no' ) ? explode( PHP_EOL, get_option( 'wcj_general_advanced_ip_detection', implode( PHP_EOL, array( 'REMOTE_ADDR', 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR' ) ) ) ) : $ip_detection_methods;
806
  foreach ( $ip_detection_methods as $method ) {
807
  if ( empty( $_SERVER[ sanitize_text_field( $method ) ] ) ) {
808
  continue;
2
  /**
3
  * Booster for WooCommerce - Functions - General
4
  *
5
+ * @version 5.3.3
6
  * @author Pluggabl LLC.
7
  * @todo add `wcj_add_actions()` and `wcj_add_filters()`
8
  */
320
  break;
321
  default:
322
  if ( session_status() == PHP_SESSION_NONE && ! headers_sent() ) {
323
+ $read_and_close = ( 'yes' === wcj_get_option( 'wcj_general_advanced_session_read_and_close', 'no' ) ) && PHP_VERSION_ID > 70000 ? array( 'read_and_close' => true ) : array();
324
  session_start( $read_and_close );
325
  }
326
  break;
376
  function wcj_wrap_in_wc_email_template( $content, $email_heading = '' ) {
377
  return wcj_get_wc_email_part( 'header', $email_heading ) .
378
  $content .
379
+ str_replace( '{site_title}', wp_specialchars_decode( wcj_get_option( 'blogname' ), ENT_QUOTES ), wcj_get_wc_email_part( 'footer' ) );
380
  }
381
  }
382
 
435
  function wcj_is_module_deprecated( $module_id, $by_module_option = false, $check_for_disabled = false ) {
436
  if ( $check_for_disabled ) {
437
  $module_option = ( $by_module_option ? $module_id : 'wcj_' . $module_id . '_enabled' );
438
+ if ( 'yes' === wcj_get_option( $module_option, 'no' ) ) {
439
  return false;
440
  }
441
  }
559
  $variation_label = wcj_replace_values_in_template( array(
560
  '%variation_title%' => implode( ', ', $variation_attributes_display_values ),
561
  '%variation_price%' => wc_price( $variation['display_price'] ),
562
+ ), wcj_get_option( 'wcj_add_to_cart_variable_as_radio_variation_label_template', '%variation_title% (%variation_price%)' ) );
563
  // Variation ID and "is checked"
564
  $variation_id = $variation['variation_id'];
565
  $is_checked = checked( $is_checked, true, false );
566
  // Final HTML
567
  $html = '';
568
+ $html .= '<td class="wcj_variable_as_radio_input_td" style="' . wcj_get_option( 'wcj_add_to_cart_variable_as_radio_input_td_style', 'width:10%;' ) . '">';
569
  $html .= '<input id="wcj_variation_' . $variation_id . '" name="wcj_variations" type="radio"' . $attributes_html . ' variation_id="' .
570
  $variation_id . '"' . $is_checked . '>';
571
  $html .= '</td>';
575
  if ( '' != ( $variation_description = get_post_meta( $variation_id, '_variation_description', true ) ) ) {
576
  $html .= wcj_replace_values_in_template( array(
577
  '%variation_description%' => $variation_description,
578
+ ), wcj_get_option( 'wcj_add_to_cart_variable_as_radio_variation_desc_template', '<br><small>%variation_description%</small>' ) );
579
  }
580
  $html .= '</label>';
581
  $html .= '</td>';
802
  function wcj_get_the_ip() {
803
  $ip = null;
804
  $ip_detection_methods = array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'REMOTE_ADDR' );
805
+ $ip_detection_methods = 'yes' === wcj_get_option( 'wcj_general_enabled', 'no' ) ? explode( PHP_EOL, wcj_get_option( 'wcj_general_advanced_ip_detection', implode( PHP_EOL, array( 'REMOTE_ADDR', 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR' ) ) ) ) : $ip_detection_methods;
806
  foreach ( $ip_detection_methods as $method ) {
807
  if ( empty( $_SERVER[ sanitize_text_field( $method ) ] ) ) {
808
  continue;
includes/functions/wcj-functions-html.php CHANGED
@@ -113,11 +113,11 @@ if ( ! function_exists( 'wcj_empty_cart_button_html' ) ) {
113
  * @todo optional function parameters instead of default `get_option()` calls
114
  */
115
  function wcj_empty_cart_button_html() {
116
- $confirmation_html = ( 'confirm_with_pop_up_box' == get_option( 'wcj_empty_cart_confirmation', 'no_confirmation' ) ) ?
117
- ' onclick="return confirm(\'' . get_option( 'wcj_empty_cart_confirmation_text', __( 'Are you sure?', 'woocommerce-jetpack' ) ) . '\')"' : '';
118
- return '<div style="' . get_option( 'wcj_empty_cart_div_style', 'float: right;' ) . '">' .
119
- '<form action="" method="post"><input type="submit" class="' . get_option( 'wcj_empty_cart_button_class', 'button' ) . '" name="wcj_empty_cart" value="' .
120
- apply_filters( 'booster_option', 'Empty Cart', get_option( 'wcj_empty_cart_text', 'Empty Cart' ) ) . '"' . $confirmation_html . '>' .
121
  '</form>' .
122
  '</div>';
123
  }
113
  * @todo optional function parameters instead of default `get_option()` calls
114
  */
115
  function wcj_empty_cart_button_html() {
116
+ $confirmation_html = ( 'confirm_with_pop_up_box' == wcj_get_option( 'wcj_empty_cart_confirmation', 'no_confirmation' ) ) ?
117
+ ' onclick="return confirm(\'' . wcj_get_option( 'wcj_empty_cart_confirmation_text', __( 'Are you sure?', 'woocommerce-jetpack' ) ) . '\')"' : '';
118
+ return '<div style="' . wcj_get_option( 'wcj_empty_cart_div_style', 'float: right;' ) . '">' .
119
+ '<form action="" method="post"><input type="submit" class="' . wcj_get_option( 'wcj_empty_cart_button_class', 'button' ) . '" name="wcj_empty_cart" value="' .
120
+ apply_filters( 'booster_option', 'Empty Cart', wcj_get_option( 'wcj_empty_cart_text', 'Empty Cart' ) ) . '"' . $confirmation_html . '>' .
121
  '</form>' .
122
  '</div>';
123
  }
includes/functions/wcj-functions-invoicing.php CHANGED
@@ -14,7 +14,7 @@ if ( ! function_exists( 'wcj_get_invoicing_temp_dir' ) ) {
14
  * @since 3.5.0
15
  */
16
  function wcj_get_invoicing_temp_dir() {
17
- return ( '' === ( $tmp_dir = get_option( 'wcj_invoicing_general_tmp_dir', '' ) ) ? sys_get_temp_dir() : $tmp_dir );
18
  }
19
  }
20
 
@@ -26,7 +26,7 @@ if ( ! function_exists( 'wcj_get_invoicing_current_image_path_desc' ) ) {
26
  * @since 3.4.3
27
  */
28
  function wcj_get_invoicing_current_image_path_desc( $option_name ) {
29
- if ( '' != ( $current_image = get_option( $option_name, '' ) ) ) {
30
  if ( false !== ( $default_images_directory = wcj_get_invoicing_default_images_directory() ) ) {
31
  $image_path = $default_images_directory . parse_url( $current_image, PHP_URL_PATH );
32
  $style = ( file_exists( $image_path ) ? ' style="color:green;"' : '' );
@@ -47,7 +47,7 @@ if ( ! function_exists( 'wcj_get_invoicing_default_images_directory' ) ) {
47
  * @since 3.4.2
48
  */
49
  function wcj_get_invoicing_default_images_directory() {
50
- switch ( get_option( 'wcj_invoicing_general_header_images_path', 'document_root' ) ) {
51
  case 'empty':
52
  return '';
53
  case 'document_root':
@@ -176,10 +176,10 @@ if ( ! function_exists( 'wcj_check_tcpdf_fonts_version' ) ) {
176
  * @since 2.9.0
177
  */
178
  function wcj_check_tcpdf_fonts_version( $force_file_check = false ) {
179
- if ( 'yes' === get_option( 'wcj_invoicing_fonts_manager_do_not_download', 'no' ) ) {
180
  return false;
181
  }
182
- $result = ( 0 == version_compare( get_option( 'wcj_invoicing_fonts_version', null ), wcj_get_tcpdf_fonts_version() ) );
183
  if ( $result && $force_file_check ) {
184
  $tcpdf_fonts_dir = wcj_get_wcj_uploads_dir( 'tcpdf_fonts' ) . '/';
185
  $tcpdf_fonts_dir_files = scandir( $tcpdf_fonts_dir );
@@ -204,14 +204,14 @@ if ( ! function_exists( 'wcj_check_and_maybe_download_tcpdf_fonts' ) ) {
204
  * @todo (maybe) use `download_url()` instead of `file_get_contents()` or `curl` (in all Booster files)
205
  */
206
  function wcj_check_and_maybe_download_tcpdf_fonts( $force_download = false ) {
207
- if ( 'yes' === get_option( 'wcj_invoicing_fonts_manager_do_not_download', 'no' ) ) {
208
  return false;
209
  }
210
  if ( ! $force_download ) {
211
  if ( wcj_check_tcpdf_fonts_version( true ) ) {
212
  return true;
213
  }
214
- if ( ( (int) current_time( 'timestamp' ) - get_option( 'wcj_invoicing_fonts_version_timestamp', null ) ) < 60 * 60 ) {
215
  return false;
216
  }
217
  }
@@ -263,34 +263,34 @@ if ( ! function_exists( 'wcj_get_invoice_types' ) ) {
263
  $invoice_types = array(
264
  array(
265
  'id' => 'invoice',
266
- 'title' => get_option( 'wcj_invoicing_' . 'invoice' . '_admin_title', __( 'Invoice', 'woocommerce-jetpack' ) ),
267
  'defaults' => array( 'init' => 'disabled' ),
268
  'color' => 'green',
269
  ),
270
  array(
271
  'id' => 'proforma_invoice',
272
- 'title' => get_option( 'wcj_invoicing_' . 'proforma_invoice' . '_admin_title', __( 'Proforma Invoice', 'woocommerce-jetpack' ) ),
273
  'defaults' => array( 'init' => 'disabled' ),
274
  'color' => 'orange',
275
  ),
276
  array(
277
  'id' => 'packing_slip',
278
- 'title' => get_option( 'wcj_invoicing_' . 'packing_slip' . '_admin_title', __( 'Packing Slip', 'woocommerce-jetpack' ) ),
279
  'defaults' => array( 'init' => 'disabled' ),
280
  'color' => 'blue',
281
  ),
282
  array(
283
  'id' => 'credit_note',
284
- 'title' => get_option( 'wcj_invoicing_' . 'credit_note' . '_admin_title', __( 'Credit Note', 'woocommerce-jetpack' ) ),
285
  'defaults' => array( 'init' => 'disabled' ),
286
  'color' => 'red',
287
  ),
288
  );
289
- $total_custom_docs = min( get_option( 'wcj_invoicing_custom_doc_total_number', 1 ), 100 );
290
  for ( $i = 1; $i <= $total_custom_docs; $i++ ) {
291
  $invoice_types[] = array(
292
  'id' => ( 1 == $i ? 'custom_doc' : 'custom_doc' . '_' . $i ),
293
- 'title' => get_option( 'wcj_invoicing_' . ( 1 == $i ? 'custom_doc' : 'custom_doc' . '_' . $i ) . '_admin_title',
294
  __( 'Custom Document', 'woocommerce-jetpack' ) . ' #' . $i ),
295
  'defaults' => array( 'init' => 'disabled' ),
296
  'color' => 'gray',
@@ -310,7 +310,7 @@ if ( ! function_exists( 'wcj_get_invoice_create_on' ) ) {
310
  * @since 3.2.0
311
  */
312
  function wcj_get_invoice_create_on( $invoice_type ) {
313
- $create_on = get_option( 'wcj_invoicing_' . $invoice_type . '_create_on', '' );
314
  if ( empty( $create_on ) ) {
315
  return array();
316
  }
14
  * @since 3.5.0
15
  */
16
  function wcj_get_invoicing_temp_dir() {
17
+ return ( '' === ( $tmp_dir = wcj_get_option( 'wcj_invoicing_general_tmp_dir', '' ) ) ? sys_get_temp_dir() : $tmp_dir );
18
  }
19
  }
20
 
26
  * @since 3.4.3
27
  */
28
  function wcj_get_invoicing_current_image_path_desc( $option_name ) {
29
+ if ( '' != ( $current_image = wcj_get_option( $option_name, '' ) ) ) {
30
  if ( false !== ( $default_images_directory = wcj_get_invoicing_default_images_directory() ) ) {
31
  $image_path = $default_images_directory . parse_url( $current_image, PHP_URL_PATH );
32
  $style = ( file_exists( $image_path ) ? ' style="color:green;"' : '' );
47
  * @since 3.4.2
48
  */
49
  function wcj_get_invoicing_default_images_directory() {
50
+ switch ( wcj_get_option( 'wcj_invoicing_general_header_images_path', 'document_root' ) ) {
51
  case 'empty':
52
  return '';
53
  case 'document_root':
176
  * @since 2.9.0
177
  */
178
  function wcj_check_tcpdf_fonts_version( $force_file_check = false ) {
179
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_fonts_manager_do_not_download', 'no' ) ) {
180
  return false;
181
  }
182
+ $result = ( 0 == version_compare( wcj_get_option( 'wcj_invoicing_fonts_version', null ), wcj_get_tcpdf_fonts_version() ) );
183
  if ( $result && $force_file_check ) {
184
  $tcpdf_fonts_dir = wcj_get_wcj_uploads_dir( 'tcpdf_fonts' ) . '/';
185
  $tcpdf_fonts_dir_files = scandir( $tcpdf_fonts_dir );
204
  * @todo (maybe) use `download_url()` instead of `file_get_contents()` or `curl` (in all Booster files)
205
  */
206
  function wcj_check_and_maybe_download_tcpdf_fonts( $force_download = false ) {
207
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_fonts_manager_do_not_download', 'no' ) ) {
208
  return false;
209
  }
210
  if ( ! $force_download ) {
211
  if ( wcj_check_tcpdf_fonts_version( true ) ) {
212
  return true;
213
  }
214
+ if ( ( (int) current_time( 'timestamp' ) - wcj_get_option( 'wcj_invoicing_fonts_version_timestamp', null ) ) < 60 * 60 ) {
215
  return false;
216
  }
217
  }
263
  $invoice_types = array(
264
  array(
265
  'id' => 'invoice',
266
+ 'title' => wcj_get_option( 'wcj_invoicing_' . 'invoice' . '_admin_title', __( 'Invoice', 'woocommerce-jetpack' ) ),
267
  'defaults' => array( 'init' => 'disabled' ),
268
  'color' => 'green',
269
  ),
270
  array(
271
  'id' => 'proforma_invoice',
272
+ 'title' => wcj_get_option( 'wcj_invoicing_' . 'proforma_invoice' . '_admin_title', __( 'Proforma Invoice', 'woocommerce-jetpack' ) ),
273
  'defaults' => array( 'init' => 'disabled' ),
274
  'color' => 'orange',
275
  ),
276
  array(
277
  'id' => 'packing_slip',
278
+ 'title' => wcj_get_option( 'wcj_invoicing_' . 'packing_slip' . '_admin_title', __( 'Packing Slip', 'woocommerce-jetpack' ) ),
279
  'defaults' => array( 'init' => 'disabled' ),
280
  'color' => 'blue',
281
  ),
282
  array(
283
  'id' => 'credit_note',
284
+ 'title' => wcj_get_option( 'wcj_invoicing_' . 'credit_note' . '_admin_title', __( 'Credit Note', 'woocommerce-jetpack' ) ),
285
  'defaults' => array( 'init' => 'disabled' ),
286
  'color' => 'red',
287
  ),
288
  );
289
+ $total_custom_docs = min( wcj_get_option( 'wcj_invoicing_custom_doc_total_number', 1 ), 100 );
290
  for ( $i = 1; $i <= $total_custom_docs; $i++ ) {
291
  $invoice_types[] = array(
292
  'id' => ( 1 == $i ? 'custom_doc' : 'custom_doc' . '_' . $i ),
293
+ 'title' => wcj_get_option( 'wcj_invoicing_' . ( 1 == $i ? 'custom_doc' : 'custom_doc' . '_' . $i ) . '_admin_title',
294
  __( 'Custom Document', 'woocommerce-jetpack' ) . ' #' . $i ),
295
  'defaults' => array( 'init' => 'disabled' ),
296
  'color' => 'gray',
310
  * @since 3.2.0
311
  */
312
  function wcj_get_invoice_create_on( $invoice_type ) {
313
+ $create_on = wcj_get_option( 'wcj_invoicing_' . $invoice_type . '_create_on', '' );
314
  if ( empty( $create_on ) ) {
315
  return array();
316
  }
includes/functions/wcj-functions-orders.php CHANGED
@@ -170,7 +170,7 @@ if ( ! function_exists( 'wcj_get_order_item_meta_info' ) ) {
170
  }
171
  $meta_info[] = wp_kses_post( rawurldecode( $_meta_key ) ) . ': ' . wp_kses_post( rawurldecode( $_meta_value ) );
172
  }
173
- $meta_info = implode( get_option( 'wcj_general_item_meta_separator', ', ' ), $meta_info );
174
  }
175
  return $meta_info;
176
  }
170
  }
171
  $meta_info[] = wp_kses_post( rawurldecode( $_meta_key ) ) . ': ' . wp_kses_post( rawurldecode( $_meta_value ) );
172
  }
173
+ $meta_info = implode( wcj_get_option( 'wcj_general_item_meta_separator', ', ' ), $meta_info );
174
  }
175
  return $meta_info;
176
  }
includes/functions/wcj-functions-price-currency.php CHANGED
@@ -18,7 +18,7 @@ if ( ! function_exists( 'wcj_get_wc_price_step' ) ) {
18
  * @todo use this where needed
19
  */
20
  function wcj_get_wc_price_step() {
21
- return ( 1 / pow( 10, absint( get_option( 'woocommerce_price_num_decimals', 2 ) ) ) );
22
  }
23
  }
24
 
@@ -41,7 +41,7 @@ if ( ! function_exists( 'wcj_get_module_price_hooks_priority' ) ) {
41
  'wholesale_price' => PHP_INT_MAX,
42
  'global_discount' => PHP_INT_MAX,
43
  );
44
- return ( 0 != ( $priority = get_option( 'wcj_' . $module_id . '_advanced_price_hooks_priority', 0 ) ) ? $priority : $modules_priorities[ $module_id ] );
45
  }
46
  }
47
 
@@ -151,10 +151,10 @@ if ( ! function_exists( 'wcj_get_currency_exchange_rate_product_base_currency' )
151
  * @since 2.5.6
152
  */
153
  function wcj_get_currency_exchange_rate_product_base_currency( $currency_code ) {
154
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_multicurrency_base_price_total_number', 1 ) );
155
  for ( $i = 1; $i <= $total_number; $i++ ) {
156
- if ( $currency_code === get_option( 'wcj_multicurrency_base_price_currency_' . $i ) ) {
157
- return get_option( 'wcj_multicurrency_base_price_exchange_rate_' . $i );
158
  }
159
  }
160
  return 1; // fallback
@@ -172,7 +172,7 @@ if ( ! function_exists( 'wcj_price_by_product_base_currency' ) ) {
172
  if ( '' == $price ) {
173
  return $price;
174
  }
175
- $do_save = ( 'yes' === get_option( 'wcj_multicurrency_base_price_save_prices', 'no' ) );
176
  if ( $do_save ) {
177
  $_current_filter = current_filter();
178
  if ( '' == $_current_filter ) {
@@ -186,8 +186,8 @@ if ( ! function_exists( 'wcj_price_by_product_base_currency' ) ) {
186
  if ( '' != $multicurrency_base_price_currency ) {
187
  if ( 1 != ( $currency_exchange_rate = wcj_get_currency_exchange_rate_product_base_currency( $multicurrency_base_price_currency ) ) && 0 != $currency_exchange_rate ) {
188
  $_price = $price / $currency_exchange_rate;
189
- if ( 'yes' === get_option( 'wcj_multicurrency_base_price_round_enabled', 'no' ) ) {
190
- $_price = round( $_price, get_option( 'wcj_multicurrency_base_price_round_precision', get_option( 'woocommerce_price_num_decimals' ) ) );
191
  }
192
  if ( $do_save ) {
193
  WCJ()->modules['multicurrency_base_price']->calculated_products_prices[ $product_id ][ $_current_filter ] = $_price;
@@ -210,7 +210,7 @@ if ( ! function_exists( 'wcj_price_by_country' ) ) {
210
 
211
  $is_price_modified = false;
212
 
213
- if ( 'yes' === get_option( 'wcj_price_by_country_local_enabled', 'yes' ) ) {
214
  // Per product
215
  $meta_box_id = 'price_by_country';
216
  $scope = 'local';
@@ -274,22 +274,22 @@ if ( ! function_exists( 'wcj_price_by_country' ) ) {
274
  }
275
 
276
  if ( ! $is_price_modified ) {
277
- if ( 'yes' === get_option( 'wcj_price_by_country_make_empty_price_group_' . $group_id, 1 ) || '' === $price ) {
278
  return '';
279
  }
280
  }
281
 
282
  if ( ! $is_price_modified ) {
283
  // Globally
284
- $precision = get_option( 'woocommerce_price_num_decimals', 2 );
285
- $rounding = get_option( 'wcj_price_by_country_rounding', 'none' );
286
- $country_exchange_rate = get_option( 'wcj_price_by_country_exchange_rate_group_' . $group_id, 1 );
287
  $modified_price = $price * $country_exchange_rate;
288
  $is_price_modified = true;
289
 
290
- if ( 'get_price' === get_option( 'wcj_price_by_country_price_format_method', 'get_price' ) ) {
291
  $modified_price = wcj_price_by_country_rounding( $modified_price, $precision, $rounding );
292
- if ( 'yes' === get_option( 'wcj_price_by_country_make_pretty', 'no' ) && $modified_price >= 0.5 && $precision > 0 ) {
293
  $modified_price = wcj_price_by_country_pretty_price( $modified_price, $precision );
294
  }
295
  }
@@ -313,8 +313,8 @@ if ( ! function_exists( 'wcj_price_by_country_pretty_price' ) ) {
313
  * @return float|int
314
  */
315
  function wcj_price_by_country_pretty_price( $price, $precision = - 1, $multiplier = - 1 ) {
316
- $precision = - 1 === $precision ? get_option( 'woocommerce_price_num_decimals', 2 ) : $precision;
317
- $multiplier = - 1 === $multiplier ? get_option( 'wcj_price_by_country_make_pretty_min_amount_multiplier', 1 ) : $multiplier;
318
  return round( $price ) - ( $multiplier / pow( 10, $precision ) );
319
  }
320
  }
@@ -333,8 +333,8 @@ if ( ! function_exists( 'wcj_price_by_country_rounding' ) ) {
333
  * @return float
334
  */
335
  function wcj_price_by_country_rounding( $price, $precision = - 1, $rounding = '' ) {
336
- $rounding = empty( $rounding ) ? get_option( 'wcj_price_by_country_rounding', 'none' ) : $rounding;
337
- $precision = - 1 === $precision ? get_option( 'woocommerce_price_num_decimals', 2 ) : $precision;
338
  switch ( $rounding ) {
339
  case 'round':
340
  $modified_price = round( $price );
@@ -365,7 +365,7 @@ if ( ! function_exists( 'wcj_update_products_price_by_country_for_single_product
365
  $_product = wc_get_product( $product_id );
366
  if ( $_product->is_type( 'variable' ) ) {
367
  $available_variations = $_product->get_available_variations();
368
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i++ ) {
369
  $min_variation_price = PHP_INT_MAX;
370
  $max_variation_price = 0;
371
  foreach ( $available_variations as $variation ) {
@@ -394,7 +394,7 @@ if ( ! function_exists( 'wcj_update_products_price_by_country_for_single_product
394
  if ( wcj_is_module_enabled( 'multicurrency_base_price' ) ) {
395
  $_old_price = wcj_price_by_product_base_currency( $_old_price, $product_id );
396
  }
397
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i++ ) {
398
  $price_by_country = wcj_price_by_country( $_old_price, $product_id, $i, WCJ_PRODUCT_GET_PRICE_FILTER );
399
  update_post_meta( $product_id, '_' . 'wcj_price_by_country_' . $i, $price_by_country );
400
  }
@@ -467,32 +467,32 @@ if ( ! function_exists( 'wcj_get_currency_by_country' ) ) {
467
  */
468
  function wcj_get_currency_by_country( $country_code ) {
469
  $currency_code = '';
470
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i++ ) {
471
- switch ( get_option( 'wcj_price_by_country_selection', 'comma_list' ) ) {
472
  case 'comma_list':
473
- $country_exchange_rate_group = get_option( 'wcj_price_by_country_exchange_rate_countries_group_' . $i );
474
  $country_exchange_rate_group = str_replace( ' ', '', $country_exchange_rate_group );
475
  $country_exchange_rate_group = explode( ',', $country_exchange_rate_group );
476
  break;
477
  case 'multiselect':
478
- $country_exchange_rate_group = get_option( 'wcj_price_by_country_countries_group_' . $i, '' );
479
  if ( '' === $country_exchange_rate_group ) {
480
  $country_exchange_rate_group = array();
481
  }
482
  break;
483
  case 'chosen_select':
484
- $country_exchange_rate_group = get_option( 'wcj_price_by_country_countries_group_chosen_select_' . $i, '' );
485
  if ( '' === $country_exchange_rate_group ) {
486
  $country_exchange_rate_group = array();
487
  }
488
  break;
489
  }
490
  if ( in_array( $country_code, $country_exchange_rate_group ) ) {
491
- $currency_code = get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $i );
492
  break;
493
  }
494
  }
495
- return ( '' == $currency_code ) ? get_option( 'woocommerce_currency' ) : $currency_code;
496
  }
497
  }
498
 
@@ -507,10 +507,10 @@ if ( ! function_exists( 'wcj_get_currency_exchange_rate' ) ) {
507
  $currency_exchange_rate = 1;
508
  if ( wcj_is_module_enabled( $module ) ) {
509
  if ( 'multicurrency' === $module ) {
510
- $total_number = apply_filters( 'booster_option', 2, get_option( 'wcj_multicurrency_total_number', 2 ) );
511
  for ( $i = 1; $i <= $total_number; $i++ ) {
512
- if ( $currency_code === get_option( 'wcj_multicurrency_currency_' . $i ) ) {
513
- $currency_exchange_rate = get_option( 'wcj_multicurrency_exchange_rate_' . $i );
514
  break;
515
  }
516
  }
@@ -578,23 +578,23 @@ if ( ! function_exists( 'wc_get_product_purchase_price' ) ) {
578
  return 0;
579
  }
580
  $purchase_price = 0;
581
- if ( 'yes' === get_option( 'wcj_purchase_price_enabled', 'yes' ) ) {
582
  $purchase_price += (float) get_post_meta( $product_id, '_' . 'wcj_purchase_price' , true );
583
  }
584
- if ( 'yes' === get_option( 'wcj_purchase_price_extra_enabled', 'yes' ) ) {
585
  $purchase_price += (float) get_post_meta( $product_id, '_' . 'wcj_purchase_price_extra', true );
586
  }
587
- if ( 'yes' === get_option( 'wcj_purchase_price_affiliate_commission_enabled', 'no' ) ) {
588
  $purchase_price += (float) get_post_meta( $product_id, '_' . 'wcj_purchase_price_affiliate_commission', true );
589
  }
590
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_purchase_data_custom_price_fields_total_number', 1 ) );
591
  for ( $i = 1; $i <= $total_number; $i++ ) {
592
- if ( '' == get_option( 'wcj_purchase_data_custom_price_field_name_' . $i, '' ) ) {
593
  continue;
594
  }
595
  $meta_value = (float) get_post_meta( $product_id, '_' . 'wcj_purchase_price_custom_field_' . $i, true );
596
  if ( 0 != $meta_value ) {
597
- $purchase_price += ( 'fixed' === get_option( 'wcj_purchase_data_custom_price_field_type_' . $i, 'fixed' ) ) ? $meta_value : $purchase_price * $meta_value / 100.0;
598
  }
599
  }
600
  if ( $product->is_type( 'variable' ) ) {
18
  * @todo use this where needed
19
  */
20
  function wcj_get_wc_price_step() {
21
+ return ( 1 / pow( 10, absint( wcj_get_option( 'woocommerce_price_num_decimals', 2 ) ) ) );
22
  }
23
  }
24
 
41
  'wholesale_price' => PHP_INT_MAX,
42
  'global_discount' => PHP_INT_MAX,
43
  );
44
+ return ( 0 != ( $priority = wcj_get_option( 'wcj_' . $module_id . '_advanced_price_hooks_priority', 0 ) ) ? $priority : $modules_priorities[ $module_id ] );
45
  }
46
  }
47
 
151
  * @since 2.5.6
152
  */
153
  function wcj_get_currency_exchange_rate_product_base_currency( $currency_code ) {
154
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_multicurrency_base_price_total_number', 1 ) );
155
  for ( $i = 1; $i <= $total_number; $i++ ) {
156
+ if ( $currency_code === wcj_get_option( 'wcj_multicurrency_base_price_currency_' . $i ) ) {
157
+ return wcj_get_option( 'wcj_multicurrency_base_price_exchange_rate_' . $i );
158
  }
159
  }
160
  return 1; // fallback
172
  if ( '' == $price ) {
173
  return $price;
174
  }
175
+ $do_save = ( 'yes' === wcj_get_option( 'wcj_multicurrency_base_price_save_prices', 'no' ) );
176
  if ( $do_save ) {
177
  $_current_filter = current_filter();
178
  if ( '' == $_current_filter ) {
186
  if ( '' != $multicurrency_base_price_currency ) {
187
  if ( 1 != ( $currency_exchange_rate = wcj_get_currency_exchange_rate_product_base_currency( $multicurrency_base_price_currency ) ) && 0 != $currency_exchange_rate ) {
188
  $_price = $price / $currency_exchange_rate;
189
+ if ( 'yes' === wcj_get_option( 'wcj_multicurrency_base_price_round_enabled', 'no' ) ) {
190
+ $_price = round( $_price, wcj_get_option( 'wcj_multicurrency_base_price_round_precision', wcj_get_option( 'woocommerce_price_num_decimals' ) ) );
191
  }
192
  if ( $do_save ) {
193
  WCJ()->modules['multicurrency_base_price']->calculated_products_prices[ $product_id ][ $_current_filter ] = $_price;
210
 
211
  $is_price_modified = false;
212
 
213
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_country_local_enabled', 'yes' ) ) {
214
  // Per product
215
  $meta_box_id = 'price_by_country';
216
  $scope = 'local';
274
  }
275
 
276
  if ( ! $is_price_modified ) {
277
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_country_make_empty_price_group_' . $group_id, 1 ) || '' === $price ) {
278
  return '';
279
  }
280
  }
281
 
282
  if ( ! $is_price_modified ) {
283
  // Globally
284
+ $precision = wcj_get_option( 'woocommerce_price_num_decimals', 2 );
285
+ $rounding = wcj_get_option( 'wcj_price_by_country_rounding', 'none' );
286
+ $country_exchange_rate = wcj_get_option( 'wcj_price_by_country_exchange_rate_group_' . $group_id, 1 );
287
  $modified_price = $price * $country_exchange_rate;
288
  $is_price_modified = true;
289
 
290
+ if ( 'get_price' === wcj_get_option( 'wcj_price_by_country_price_format_method', 'get_price' ) ) {
291
  $modified_price = wcj_price_by_country_rounding( $modified_price, $precision, $rounding );
292
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_country_make_pretty', 'no' ) && $modified_price >= 0.5 && $precision > 0 ) {
293
  $modified_price = wcj_price_by_country_pretty_price( $modified_price, $precision );
294
  }
295
  }
313
  * @return float|int
314
  */
315
  function wcj_price_by_country_pretty_price( $price, $precision = - 1, $multiplier = - 1 ) {
316
+ $precision = - 1 === $precision ? wcj_get_option( 'woocommerce_price_num_decimals', 2 ) : $precision;
317
+ $multiplier = - 1 === $multiplier ? wcj_get_option( 'wcj_price_by_country_make_pretty_min_amount_multiplier', 1 ) : $multiplier;
318
  return round( $price ) - ( $multiplier / pow( 10, $precision ) );
319
  }
320
  }
333
  * @return float
334
  */
335
  function wcj_price_by_country_rounding( $price, $precision = - 1, $rounding = '' ) {
336
+ $rounding = empty( $rounding ) ? wcj_get_option( 'wcj_price_by_country_rounding', 'none' ) : $rounding;
337
+ $precision = - 1 === $precision ? wcj_get_option( 'woocommerce_price_num_decimals', 2 ) : $precision;
338
  switch ( $rounding ) {
339
  case 'round':
340
  $modified_price = round( $price );
365
  $_product = wc_get_product( $product_id );
366
  if ( $_product->is_type( 'variable' ) ) {
367
  $available_variations = $_product->get_available_variations();
368
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i++ ) {
369
  $min_variation_price = PHP_INT_MAX;
370
  $max_variation_price = 0;
371
  foreach ( $available_variations as $variation ) {
394
  if ( wcj_is_module_enabled( 'multicurrency_base_price' ) ) {
395
  $_old_price = wcj_price_by_product_base_currency( $_old_price, $product_id );
396
  }
397
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i++ ) {
398
  $price_by_country = wcj_price_by_country( $_old_price, $product_id, $i, WCJ_PRODUCT_GET_PRICE_FILTER );
399
  update_post_meta( $product_id, '_' . 'wcj_price_by_country_' . $i, $price_by_country );
400
  }
467
  */
468
  function wcj_get_currency_by_country( $country_code ) {
469
  $currency_code = '';
470
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i++ ) {
471
+ switch ( wcj_get_option( 'wcj_price_by_country_selection', 'comma_list' ) ) {
472
  case 'comma_list':
473
+ $country_exchange_rate_group = wcj_get_option( 'wcj_price_by_country_exchange_rate_countries_group_' . $i );
474
  $country_exchange_rate_group = str_replace( ' ', '', $country_exchange_rate_group );
475
  $country_exchange_rate_group = explode( ',', $country_exchange_rate_group );
476
  break;
477
  case 'multiselect':
478
+ $country_exchange_rate_group = wcj_get_option( 'wcj_price_by_country_countries_group_' . $i, '' );
479
  if ( '' === $country_exchange_rate_group ) {
480
  $country_exchange_rate_group = array();
481
  }
482
  break;
483
  case 'chosen_select':
484
+ $country_exchange_rate_group = wcj_get_option( 'wcj_price_by_country_countries_group_chosen_select_' . $i, '' );
485
  if ( '' === $country_exchange_rate_group ) {
486
  $country_exchange_rate_group = array();
487
  }
488
  break;
489
  }
490
  if ( in_array( $country_code, $country_exchange_rate_group ) ) {
491
+ $currency_code = wcj_get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $i );
492
  break;
493
  }
494
  }
495
+ return ( '' == $currency_code ) ? wcj_get_option( 'woocommerce_currency' ) : $currency_code;
496
  }
497
  }
498
 
507
  $currency_exchange_rate = 1;
508
  if ( wcj_is_module_enabled( $module ) ) {
509
  if ( 'multicurrency' === $module ) {
510
+ $total_number = apply_filters( 'booster_option', 2, wcj_get_option( 'wcj_multicurrency_total_number', 2 ) );
511
  for ( $i = 1; $i <= $total_number; $i++ ) {
512
+ if ( $currency_code === wcj_get_option( 'wcj_multicurrency_currency_' . $i ) ) {
513
+ $currency_exchange_rate = wcj_get_option( 'wcj_multicurrency_exchange_rate_' . $i );
514
  break;
515
  }
516
  }
578
  return 0;
579
  }
580
  $purchase_price = 0;
581
+ if ( 'yes' === wcj_get_option( 'wcj_purchase_price_enabled', 'yes' ) ) {
582
  $purchase_price += (float) get_post_meta( $product_id, '_' . 'wcj_purchase_price' , true );
583
  }
584
+ if ( 'yes' === wcj_get_option( 'wcj_purchase_price_extra_enabled', 'yes' ) ) {
585
  $purchase_price += (float) get_post_meta( $product_id, '_' . 'wcj_purchase_price_extra', true );
586
  }
587
+ if ( 'yes' === wcj_get_option( 'wcj_purchase_price_affiliate_commission_enabled', 'no' ) ) {
588
  $purchase_price += (float) get_post_meta( $product_id, '_' . 'wcj_purchase_price_affiliate_commission', true );
589
  }
590
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_purchase_data_custom_price_fields_total_number', 1 ) );
591
  for ( $i = 1; $i <= $total_number; $i++ ) {
592
+ if ( '' == wcj_get_option( 'wcj_purchase_data_custom_price_field_name_' . $i, '' ) ) {
593
  continue;
594
  }
595
  $meta_value = (float) get_post_meta( $product_id, '_' . 'wcj_purchase_price_custom_field_' . $i, true );
596
  if ( 0 != $meta_value ) {
597
+ $purchase_price += ( 'fixed' === wcj_get_option( 'wcj_purchase_data_custom_price_field_type_' . $i, 'fixed' ) ) ? $meta_value : $purchase_price * $meta_value / 100.0;
598
  }
599
  }
600
  if ( $product->is_type( 'variable' ) ) {
includes/functions/wcj-functions-products.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Functions - Products
4
  *
5
- * @version 4.9.0
6
  * @since 2.9.0
7
  * @author Pluggabl LLC.
8
  */
@@ -17,7 +17,7 @@ if ( ! function_exists( 'wcj_maybe_get_product_id_wpml' ) ) {
17
  * @since 3.6.0
18
  */
19
  function wcj_maybe_get_product_id_wpml( $product_id ) {
20
- if ( function_exists( 'icl_object_id' ) && ( 'yes' === get_option( 'wcj_wpml_use_translation_product_id', 'yes' ) || ! wcj_is_module_enabled( 'wpml' ) ) ) {
21
  $product_id = icl_object_id( $product_id, 'product', true, wcj_get_wpml_default_language() );
22
  }
23
  return $product_id;
@@ -168,7 +168,7 @@ if ( ! function_exists( 'wcj_get_product_display_price' ) ) {
168
  $price *= -1;
169
  }
170
  if ( 'cart' === $scope ) {
171
- $display_price = ( 'incl' === get_option( 'woocommerce_tax_display_cart' ) ?
172
  wc_get_price_including_tax( $_product, array( 'price' => $price, 'qty' => $qty ) ) :
173
  wc_get_price_excluding_tax( $_product, array( 'price' => $price, 'qty' => $qty ) ) );
174
  } else { // 'shop'
@@ -229,7 +229,7 @@ if ( ! function_exists( 'wcj_get_product_input_field_value' ) ) {
229
  $product_id = $item['product_id'];
230
  $default = '';
231
  if ( 'global' === $scope ) {
232
- return get_option( $option_name, $default );
233
  } else { // local
234
  if ( '' != ( $options = get_post_meta( $product_id, '_' . 'wcj_product_input_fields', true ) ) ) {
235
  $option_name = str_replace( 'wcj_product_input_fields_', '', $option_name );
@@ -414,7 +414,7 @@ if ( ! function_exists( 'wcj_is_product_wholesale_enabled_per_product' ) ) {
414
  */
415
  function wcj_is_product_wholesale_enabled_per_product( $product_id ) {
416
  return (
417
- 'yes' === get_option( 'wcj_wholesale_price_per_product_enable', 'yes' ) &&
418
  'yes' === get_post_meta( $product_id, '_' . 'wcj_wholesale_price_per_product_enabled', true )
419
  );
420
  }
@@ -424,7 +424,7 @@ if ( ! function_exists( 'wcj_is_product_wholesale_enabled' ) ) {
424
  /**
425
  * wcj_is_product_wholesale_enabled.
426
  *
427
- * @version 4.9.0
428
  */
429
  function wcj_is_product_wholesale_enabled( $product_id ) {
430
  if ( wcj_is_module_enabled( 'wholesale_price' ) ) {
@@ -432,25 +432,25 @@ if ( ! function_exists( 'wcj_is_product_wholesale_enabled' ) ) {
432
  return true;
433
  } else {
434
  $products_to_include_passed = false;
435
- $products_to_include = get_option( 'wcj_wholesale_price_products_to_include', array() );
436
  if ( ! empty( $products_to_include ) && in_array( $product_id, $products_to_include ) ) {
437
  $products_to_include_passed = true;
438
  }
439
- $product_cats_to_include_passed = false;
440
- $product_cats_to_include = get_option( 'wcj_wholesale_price_product_cats_to_include', array() );
441
- if ( ! empty( $product_cats_to_include ) && wcj_is_product_term( $product_id, $product_cats_to_include, 'product_cat' ) ) {
442
- $product_cats_to_include_passed = true;
443
  }
444
  $products_to_exclude_passed = false;
445
  $product_cats_to_exclude_passed = false;
446
- if ( 'no' === get_option( 'wcj_wholesale_price_per_product_enable', 'yes' ) ) {
447
  $products_to_exclude_passed = true;
448
- $products_to_exclude = get_option( 'wcj_wholesale_price_products_to_exclude', array() );
449
  if ( ! empty( $products_to_exclude ) && in_array( $product_id, $products_to_exclude ) ) {
450
  $products_to_exclude_passed = false;
451
  }
452
  $product_cats_to_exclude_passed = true;
453
- $product_cats_to_exclude = get_option( 'wcj_wholesale_price_product_cats_to_exclude', array() );
454
  if ( ! empty( $product_cats_to_exclude ) && wcj_is_product_term( $product_id, $product_cats_to_exclude, 'product_cat' ) ) {
455
  $product_cats_to_exclude_passed = false;
456
  }
2
  /**
3
  * Booster for WooCommerce - Functions - Products
4
  *
5
+ * @version 5.3.3
6
  * @since 2.9.0
7
  * @author Pluggabl LLC.
8
  */
17
  * @since 3.6.0
18
  */
19
  function wcj_maybe_get_product_id_wpml( $product_id ) {
20
+ if ( function_exists( 'icl_object_id' ) && ( 'yes' === wcj_get_option( 'wcj_wpml_use_translation_product_id', 'yes' ) || ! wcj_is_module_enabled( 'wpml' ) ) ) {
21
  $product_id = icl_object_id( $product_id, 'product', true, wcj_get_wpml_default_language() );
22
  }
23
  return $product_id;
168
  $price *= -1;
169
  }
170
  if ( 'cart' === $scope ) {
171
+ $display_price = ( 'incl' === wcj_get_option( 'woocommerce_tax_display_cart' ) ?
172
  wc_get_price_including_tax( $_product, array( 'price' => $price, 'qty' => $qty ) ) :
173
  wc_get_price_excluding_tax( $_product, array( 'price' => $price, 'qty' => $qty ) ) );
174
  } else { // 'shop'
229
  $product_id = $item['product_id'];
230
  $default = '';
231
  if ( 'global' === $scope ) {
232
+ return wcj_get_option( $option_name, $default );
233
  } else { // local
234
  if ( '' != ( $options = get_post_meta( $product_id, '_' . 'wcj_product_input_fields', true ) ) ) {
235
  $option_name = str_replace( 'wcj_product_input_fields_', '', $option_name );
414
  */
415
  function wcj_is_product_wholesale_enabled_per_product( $product_id ) {
416
  return (
417
+ 'yes' === wcj_get_option( 'wcj_wholesale_price_per_product_enable', 'yes' ) &&
418
  'yes' === get_post_meta( $product_id, '_' . 'wcj_wholesale_price_per_product_enabled', true )
419
  );
420
  }
424
  /**
425
  * wcj_is_product_wholesale_enabled.
426
  *
427
+ * @version 5.3.3
428
  */
429
  function wcj_is_product_wholesale_enabled( $product_id ) {
430
  if ( wcj_is_module_enabled( 'wholesale_price' ) ) {
432
  return true;
433
  } else {
434
  $products_to_include_passed = false;
435
+ $products_to_include = wcj_get_option( 'wcj_wholesale_price_products_to_include', array() );
436
  if ( ! empty( $products_to_include ) && in_array( $product_id, $products_to_include ) ) {
437
  $products_to_include_passed = true;
438
  }
439
+ $product_cats_to_include_passed = true;
440
+ $product_cats_to_include = wcj_get_option( 'wcj_wholesale_price_product_cats_to_include', array() );
441
+ if ( ! empty( $product_cats_to_include ) && ! wcj_is_product_term( $product_id, $product_cats_to_include, 'product_cat' ) ) {
442
+ $product_cats_to_include_passed = false;
443
  }
444
  $products_to_exclude_passed = false;
445
  $product_cats_to_exclude_passed = false;
446
+ if ( 'no' === wcj_get_option( 'wcj_wholesale_price_per_product_enable', 'yes' ) ) {
447
  $products_to_exclude_passed = true;
448
+ $products_to_exclude = wcj_get_option( 'wcj_wholesale_price_products_to_exclude', array() );
449
  if ( ! empty( $products_to_exclude ) && in_array( $product_id, $products_to_exclude ) ) {
450
  $products_to_exclude_passed = false;
451
  }
452
  $product_cats_to_exclude_passed = true;
453
+ $product_cats_to_exclude = wcj_get_option( 'wcj_wholesale_price_product_cats_to_exclude', array() );
454
  if ( ! empty( $product_cats_to_exclude ) && wcj_is_product_term( $product_id, $product_cats_to_exclude, 'product_cat' ) ) {
455
  $product_cats_to_exclude_passed = false;
456
  }
includes/functions/wcj-functions-shipping.php CHANGED
@@ -33,7 +33,7 @@ if ( ! function_exists( 'wcj_get_shipping_time_table' ) ) {
33
  }
34
  $option_id_shipping_method = ( $do_use_shipping_instances ? 'instance_' . $method['shipping_method_instance_id'] : $method->id );
35
  $option_id = 'wcj_shipping_time_' . $option_id_shipping_method . $option_id_shipping_class;
36
- if ( '' !== ( $time = get_option( $option_id, '' ) ) ) {
37
  $method_title = ( $do_use_shipping_instances ? $method['zone_name'] . ': ' . $method['shipping_method_title']: $method->get_method_title() );
38
  $table_data[] = array( $method_title, sprintf( __( '%s day(s)' ), $time ) );
39
  }
@@ -191,7 +191,7 @@ if ( ! function_exists( 'wcj_get_woocommerce_package_rates_module_filter_priorit
191
  'shipping_by_user_role' => PHP_INT_MAX - 100,
192
  'shipping_by_cities' => PHP_INT_MAX - 100,
193
  );
194
- return ( 0 != ( $priority = get_option( 'wcj_' . $module_id . '_filter_priority', 0 ) ) ?
195
  $priority :
196
  ( isset( $modules_priorities[ $module_id ] ) ? $modules_priorities[ $module_id ] : PHP_INT_MAX )
197
  );
@@ -219,7 +219,7 @@ if ( ! function_exists( 'wcj_get_left_to_free_shipping' ) ) {
219
  foreach ( $available_shipping_methods as $available_shipping_method ) {
220
  $method_id = ( WCJ_IS_WC_VERSION_BELOW_3_2_0 ? $available_shipping_method->method_id : $available_shipping_method->get_method_id() );
221
  if ( 'free_shipping' === $method_id ) {
222
- return do_shortcode( get_option( 'wcj_shipping_left_to_free_info_content_reached', __( 'You have Free delivery', 'woocommerce-jetpack' ) ) );
223
  }
224
  }
225
  }
@@ -276,7 +276,7 @@ if ( ! function_exists( 'wcj_get_left_to_free_shipping' ) ) {
276
  }
277
  // Final message
278
  if ( $total >= $min_free_shipping_amount ) {
279
- return do_shortcode( get_option( 'wcj_shipping_left_to_free_info_content_reached', __( 'You have Free delivery', 'woocommerce-jetpack' ) ) );
280
  } else {
281
  return wcj_handle_replacements( array(
282
  '%left_to_free%' => wc_price( ( $min_free_shipping_amount - $total ) * $multiply_by ),
33
  }
34
  $option_id_shipping_method = ( $do_use_shipping_instances ? 'instance_' . $method['shipping_method_instance_id'] : $method->id );
35
  $option_id = 'wcj_shipping_time_' . $option_id_shipping_method . $option_id_shipping_class;
36
+ if ( '' !== ( $time = wcj_get_option( $option_id, '' ) ) ) {
37
  $method_title = ( $do_use_shipping_instances ? $method['zone_name'] . ': ' . $method['shipping_method_title']: $method->get_method_title() );
38
  $table_data[] = array( $method_title, sprintf( __( '%s day(s)' ), $time ) );
39
  }
191
  'shipping_by_user_role' => PHP_INT_MAX - 100,
192
  'shipping_by_cities' => PHP_INT_MAX - 100,
193
  );
194
+ return ( 0 != ( $priority = wcj_get_option( 'wcj_' . $module_id . '_filter_priority', 0 ) ) ?
195
  $priority :
196
  ( isset( $modules_priorities[ $module_id ] ) ? $modules_priorities[ $module_id ] : PHP_INT_MAX )
197
  );
219
  foreach ( $available_shipping_methods as $available_shipping_method ) {
220
  $method_id = ( WCJ_IS_WC_VERSION_BELOW_3_2_0 ? $available_shipping_method->method_id : $available_shipping_method->get_method_id() );
221
  if ( 'free_shipping' === $method_id ) {
222
+ return do_shortcode( wcj_get_option( 'wcj_shipping_left_to_free_info_content_reached', __( 'You have Free delivery', 'woocommerce-jetpack' ) ) );
223
  }
224
  }
225
  }
276
  }
277
  // Final message
278
  if ( $total >= $min_free_shipping_amount ) {
279
+ return do_shortcode( wcj_get_option( 'wcj_shipping_left_to_free_info_content_reached', __( 'You have Free delivery', 'woocommerce-jetpack' ) ) );
280
  } else {
281
  return wcj_handle_replacements( array(
282
  '%left_to_free%' => wc_price( ( $min_free_shipping_amount - $total ) * $multiply_by ),
includes/functions/wcj-functions-users.php CHANGED
@@ -108,9 +108,9 @@ if ( ! function_exists( 'wcj_is_booster_role_changer_enabled' ) ) {
108
  */
109
  function wcj_is_booster_role_changer_enabled() {
110
  return (
111
- 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_general_user_role_changer_enabled', 'no' ) ) &&
112
  wcj_is_user_logged_in() &&
113
- wcj_is_user_role( get_option( 'wcj_general_user_role_changer_enabled_for', array( 'administrator', 'shop_manager' ) ) )
114
  );
115
  }
116
  }
108
  */
109
  function wcj_is_booster_role_changer_enabled() {
110
  return (
111
+ 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_general_user_role_changer_enabled', 'no' ) ) &&
112
  wcj_is_user_logged_in() &&
113
+ wcj_is_user_role( wcj_get_option( 'wcj_general_user_role_changer_enabled_for', array( 'administrator', 'shop_manager' ) ) )
114
  );
115
  }
116
  }
includes/gateways/class-wc-gateway-wcj-custom.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Custom Payment Gateway
4
  *
5
- * @version 5.3.0
6
  * @author Pluggabl LLC.
7
  */
8
 
@@ -15,7 +15,7 @@ if ( ! function_exists( 'init_wc_gateway_wcj_custom_class' ) ) {
15
  /**
16
  * WC_Gateway_WCJ_Custom_Template class.
17
  *
18
- * @version 3.9.0
19
  */
20
  class WC_Gateway_WCJ_Custom_Template extends WC_Payment_Gateway {
21
 
@@ -61,7 +61,7 @@ if ( ! function_exists( 'init_wc_gateway_wcj_custom_class' ) ) {
61
  'title' => __( 'Description', 'woocommerce' ),
62
  'type' => 'textarea',
63
  'description' => __( 'Payment method description that the customer will see on your checkout.', 'woocommerce' ) . ' ' .
64
- __( 'You can add input fields with [wcj_input_field] shortcode.', 'woocommerce' ),
65
  'default' => __( 'Custom Payment Description.', 'woocommerce' ),
66
  'desc_tip' => true,
67
  ),
@@ -339,7 +339,7 @@ if ( ! function_exists( 'init_wc_gateway_wcj_custom_class' ) ) {
339
  /**
340
  * init.
341
  *
342
- * @version 4.7.0
343
  */
344
  function init( $id_count ) {
345
  $this->id = ( 1 === $id_count ) ? 'jetpack_custom_gateway' : 'jetpack_custom_gateway_' . $id_count;
@@ -385,7 +385,7 @@ if ( ! function_exists( 'init_wc_gateway_wcj_custom_class' ) ) {
385
  * @version 2.5.6
386
  */
387
  function add_wc_gateway_wcj_custom_classes( $methods ) {
388
- $the_number = apply_filters( 'booster_option', 1, get_option( 'wcj_custom_payment_gateways_number', 1 ) );
389
  for ( $i = 1; $i <= $the_number; $i++ ) {
390
  $the_method = new WC_Gateway_WCJ_Custom_Template();
391
  $the_method->init( $i );
@@ -398,7 +398,7 @@ if ( ! function_exists( 'init_wc_gateway_wcj_custom_class' ) ) {
398
  }
399
  }
400
 
401
- if ( 'no' === get_option( 'wcj_load_modules_on_init', 'no' ) ) {
402
  add_action( 'plugins_loaded', 'init_wc_gateway_wcj_custom_class' );
403
  } else {
404
  init_wc_gateway_wcj_custom_class();
2
  /**
3
  * Booster for WooCommerce - Custom Payment Gateway
4
  *
5
+ * @version 5.3.4
6
  * @author Pluggabl LLC.
7
  */
8
 
15
  /**
16
  * WC_Gateway_WCJ_Custom_Template class.
17
  *
18
+ * @version 5.3.4
19
  */
20
  class WC_Gateway_WCJ_Custom_Template extends WC_Payment_Gateway {
21
 
61
  'title' => __( 'Description', 'woocommerce' ),
62
  'type' => 'textarea',
63
  'description' => __( 'Payment method description that the customer will see on your checkout.', 'woocommerce' ) . ' ' .
64
+ __( 'You can add input fields with [wcj_input_field] shortcode.', 'woocommerce' ),
65
  'default' => __( 'Custom Payment Description.', 'woocommerce' ),
66
  'desc_tip' => true,
67
  ),
339
  /**
340
  * init.
341
  *
342
+ * @version 5.3.4
343
  */
344
  function init( $id_count ) {
345
  $this->id = ( 1 === $id_count ) ? 'jetpack_custom_gateway' : 'jetpack_custom_gateway_' . $id_count;
385
  * @version 2.5.6
386
  */
387
  function add_wc_gateway_wcj_custom_classes( $methods ) {
388
+ $the_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_custom_payment_gateways_number', 1 ) );
389
  for ( $i = 1; $i <= $the_number; $i++ ) {
390
  $the_method = new WC_Gateway_WCJ_Custom_Template();
391
  $the_method->init( $i );
398
  }
399
  }
400
 
401
+ if ( 'no' === wcj_get_option( 'wcj_load_modules_on_init', 'no' ) ) {
402
  add_action( 'plugins_loaded', 'init_wc_gateway_wcj_custom_class' );
403
  } else {
404
  init_wc_gateway_wcj_custom_class();
includes/input-fields/class-wcj-product-input-fields-core.php CHANGED
@@ -26,11 +26,11 @@ class WCJ_Product_Input_Fields_Core {
26
  */
27
  function __construct( $scope ) {
28
  $this->scope = $scope;
29
- if ( 'yes' === get_option( 'wcj_product_input_fields_' . $this->scope . '_enabled', 'no' ) ) {
30
 
31
  // Show fields at frontend
32
- add_action( get_option( 'wcj_product_input_fields_position', 'woocommerce_before_add_to_cart_button' ),
33
- array( $this, 'add_product_input_fields_to_frontend' ), get_option( 'wcj_product_input_fields_position_priority', 100 ) );
34
 
35
  // Process from $_POST to cart item data
36
  add_filter( 'woocommerce_add_to_cart_validation', array( $this, 'validate_product_input_fields_on_add_to_cart' ), 100, 2 );
@@ -39,7 +39,7 @@ class WCJ_Product_Input_Fields_Core {
39
  add_filter( 'woocommerce_get_cart_item_from_session', array( $this, 'get_cart_item_product_input_fields_from_session' ), 100, 3 );
40
 
41
  // Show details at cart, order details, emails
42
- if ( 'data' === get_option( 'wcj_product_input_fields_display_options', 'name' ) ) {
43
  add_filter( 'woocommerce_get_item_data', array( $this, 'add_product_input_fields_to_cart_item_display_data' ), PHP_INT_MAX, 2 );
44
  } else {
45
  add_filter( 'woocommerce_cart_item_name', array( $this, 'add_product_input_fields_to_cart_item_name' ), 100, 3 );
@@ -60,7 +60,7 @@ class WCJ_Product_Input_Fields_Core {
60
 
61
  // Make nicer name for product input fields in order at backend (shop manager)
62
  add_action( 'woocommerce_after_order_itemmeta', array( $this, 'output_custom_input_fields_in_admin_order' ), 100, 3 );
63
- if ( 'yes' === get_option( 'wcj_product_input_fields_make_nicer_name_enabled', 'yes' ) ) {
64
  add_filter( 'woocommerce_hidden_order_itemmeta', array( $this, 'hide_custom_input_fields_default_output_in_admin_order' ), 100 );
65
  }
66
 
@@ -137,7 +137,7 @@ class WCJ_Product_Input_Fields_Core {
137
  return;
138
  }
139
  // Save values
140
- $default_total_input_fields = apply_filters( 'booster_option', 1, get_option( 'wcj_product_input_fields_local_total_number_default', 1 ) );
141
  $total_input_fields_before_saving = apply_filters( 'booster_option', 1, $this->get_value( 'wcj_product_input_fields_local_total_number', $post_id, 1 ) );
142
  $total_input_fields_before_saving = ( '' != $total_input_fields_before_saving ) ? $total_input_fields_before_saving : $default_total_input_fields;
143
  $options = $this->get_options();
@@ -192,7 +192,7 @@ class WCJ_Product_Input_Fields_Core {
192
  $option_name = 'wcj_' . $meta_box_id . '_local_total_number';
193
  // If none total number set - check for the default
194
  if ( ! ( $total_number = apply_filters( 'booster_option', 1, $this->get_value( 'wcj_product_input_fields_local_total_number', $current_post_id, 1 ) ) ) ) {
195
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_' . $meta_box_id . '_local_total_number_default', 1 ) );
196
  }
197
 
198
  // Start html
@@ -285,12 +285,12 @@ class WCJ_Product_Input_Fields_Core {
285
  */
286
  function is_enabled_for_product_global( $field_nr, $product_id ) {
287
  return wcj_is_enabled_for_product( $product_id, array(
288
- 'include_products' => get_option( 'wcj_product_input_fields_in_products_' . 'global' . '_' . $field_nr, '' ),
289
- 'exclude_products' => get_option( 'wcj_product_input_fields_ex_products_' . 'global' . '_' . $field_nr, '' ),
290
- 'include_categories' => get_option( 'wcj_product_input_fields_in_cats_' . 'global' . '_' . $field_nr, '' ),
291
- 'exclude_categories' => get_option( 'wcj_product_input_fields_ex_cats_' . 'global' . '_' . $field_nr, '' ),
292
- 'include_tags' => get_option( 'wcj_product_input_fields_in_tags_' . 'global' . '_' . $field_nr, '' ),
293
- 'exclude_tags' => get_option( 'wcj_product_input_fields_ex_tags_' . 'global' . '_' . $field_nr, '' ),
294
  ) );
295
  }
296
 
@@ -317,8 +317,8 @@ class WCJ_Product_Input_Fields_Core {
317
  }
318
 
319
  if (
320
- ( 'new_order' === $status && 'yes' === get_option( 'wcj_product_input_fields_attach_to_admin_new_order', 'yes' ) ) ||
321
- ( 'customer_processing_order' === $status && 'yes' === get_option( 'wcj_product_input_fields_attach_to_customer_processing_order', 'yes' ) )
322
  ) {
323
  foreach ( $order->get_items() as $item_key => $item ) {
324
  $product_id = $item['product_id'];
@@ -389,7 +389,7 @@ class WCJ_Product_Input_Fields_Core {
389
  }
390
  }
391
  } else {
392
- if ( 'no' === get_option( 'wcj_product_input_fields_make_nicer_name_enabled', 'yes' ) ) {
393
  continue;
394
  }
395
  }
@@ -411,7 +411,7 @@ class WCJ_Product_Input_Fields_Core {
411
  */
412
  function get_value( $option_name, $product_id, $default ) {
413
  if ( 'global' === $this->scope ) {
414
- return get_option( $option_name, $default );
415
  } else { // local
416
  if ( '' != ( $options = get_post_meta( $product_id, '_' . 'wcj_product_input_fields', true ) ) ) {
417
  $option_name = str_replace( 'wcj_product_input_fields_', '', $option_name );
@@ -524,7 +524,7 @@ class WCJ_Product_Input_Fields_Core {
524
  * @since 3.9.1
525
  */
526
  function maybe_stripslashes( $str ) {
527
- return ( 'yes' === get_option( 'wcj_product_input_fields_stripslashes', 'no' ) ? stripslashes( $str ) : $str );
528
  }
529
 
530
  /**
@@ -536,7 +536,7 @@ class WCJ_Product_Input_Fields_Core {
536
  * @todo add `required` attributes
537
  */
538
  function add_product_input_fields_to_frontend() {
539
- if ( isset( $this->are_product_input_fields_displayed ) && 'yes' === get_option( 'wcj_product_input_fields_check_for_outputted_data', 'yes' ) ) {
540
  return;
541
  }
542
  global $product;
@@ -556,7 +556,7 @@ class WCJ_Product_Input_Fields_Core {
556
 
557
  $datepicker_format = $this->get_value( 'wcj_product_input_fields_type_datepicker_format_' . $this->scope . '_' . $i, $_product_id, '' );
558
  if ( '' == $datepicker_format ) {
559
- $datepicker_format = get_option( 'date_format' );
560
  }
561
  $datepicker_format = wcj_date_format_php_to_js( $datepicker_format );
562
  $datepicker_mindate = $this->get_value( 'wcj_product_input_fields_type_datepicker_mindate_' . $this->scope . '_' . $i, $_product_id, -365 );
@@ -586,7 +586,7 @@ class WCJ_Product_Input_Fields_Core {
586
  $field_name = 'wcj_product_input_fields_' . $this->scope . '_' . $i;
587
 
588
  if ( 'on' === $is_required || 'yes' === $is_required ) {
589
- $title .= get_option( 'wcj_product_input_fields_frontend_view_required_html', '&nbsp;<abbr class="required" title="required">*</abbr>' );
590
  }
591
 
592
  if ( $this->is_enabled( $i, $_product_id ) ) {
@@ -680,7 +680,7 @@ class WCJ_Product_Input_Fields_Core {
680
  if ( ! empty( $select_options ) ) {
681
  reset( $select_options );
682
  $value = ( '' != $set_value ? $set_value : key( $select_options ) );
683
- $template = get_option( 'wcj_product_input_fields_field_template_radio',
684
  '%radio_field_html%<label for="%radio_field_id%" class="radio">%radio_field_title%</label><br>' );
685
  foreach ( $select_options as $option_key => $option_text ) {
686
  $replaced_values = array(
@@ -729,7 +729,7 @@ class WCJ_Product_Input_Fields_Core {
729
  }
730
  ksort( $fields );
731
  if ( ! empty ( $fields ) ) {
732
- echo get_option( 'wcj_product_input_fields_start_template', '' ) . implode( $fields ) . get_option( 'wcj_product_input_fields_end_template', '' );
733
  $this->are_product_input_fields_displayed = true;
734
  }
735
  }
@@ -789,10 +789,10 @@ class WCJ_Product_Input_Fields_Core {
789
  return $name;
790
  }
791
  if ( $is_cart ) {
792
- $name .= get_option( 'wcj_product_input_fields_cart_start_template', '<dl style="font-size:smaller;">' );
793
- $item_template = get_option( 'wcj_product_input_fields_cart_field_template', '<dt>%title%</dt><dd>%value%</dd>' );
794
  } else {
795
- $item_template = get_option( 'wcj_product_input_fields_frontend_view_order_table_format', '&nbsp;| %title% %value%' );
796
  }
797
  for ( $i = 1; $i <= $total_number; $i++ ) {
798
  if ( ! $this->is_enabled( $i, $item['product_id'] ) ) {
@@ -827,7 +827,7 @@ class WCJ_Product_Input_Fields_Core {
827
  }
828
  }
829
  if ( $is_cart ) {
830
- $name .= get_option( 'wcj_product_input_fields_cart_end_template', '</dl>' );
831
  }
832
  return $name;
833
  }
26
  */
27
  function __construct( $scope ) {
28
  $this->scope = $scope;
29
+ if ( 'yes' === wcj_get_option( 'wcj_product_input_fields_' . $this->scope . '_enabled', 'no' ) ) {
30
 
31
  // Show fields at frontend
32
+ add_action( wcj_get_option( 'wcj_product_input_fields_position', 'woocommerce_before_add_to_cart_button' ),
33
+ array( $this, 'add_product_input_fields_to_frontend' ), wcj_get_option( 'wcj_product_input_fields_position_priority', 100 ) );
34
 
35
  // Process from $_POST to cart item data
36
  add_filter( 'woocommerce_add_to_cart_validation', array( $this, 'validate_product_input_fields_on_add_to_cart' ), 100, 2 );
39
  add_filter( 'woocommerce_get_cart_item_from_session', array( $this, 'get_cart_item_product_input_fields_from_session' ), 100, 3 );
40
 
41
  // Show details at cart, order details, emails
42
+ if ( 'data' === wcj_get_option( 'wcj_product_input_fields_display_options', 'name' ) ) {
43
  add_filter( 'woocommerce_get_item_data', array( $this, 'add_product_input_fields_to_cart_item_display_data' ), PHP_INT_MAX, 2 );
44
  } else {
45
  add_filter( 'woocommerce_cart_item_name', array( $this, 'add_product_input_fields_to_cart_item_name' ), 100, 3 );
60
 
61
  // Make nicer name for product input fields in order at backend (shop manager)
62
  add_action( 'woocommerce_after_order_itemmeta', array( $this, 'output_custom_input_fields_in_admin_order' ), 100, 3 );
63
+ if ( 'yes' === wcj_get_option( 'wcj_product_input_fields_make_nicer_name_enabled', 'yes' ) ) {
64
  add_filter( 'woocommerce_hidden_order_itemmeta', array( $this, 'hide_custom_input_fields_default_output_in_admin_order' ), 100 );
65
  }
66
 
137
  return;
138
  }
139
  // Save values
140
+ $default_total_input_fields = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_product_input_fields_local_total_number_default', 1 ) );
141
  $total_input_fields_before_saving = apply_filters( 'booster_option', 1, $this->get_value( 'wcj_product_input_fields_local_total_number', $post_id, 1 ) );
142
  $total_input_fields_before_saving = ( '' != $total_input_fields_before_saving ) ? $total_input_fields_before_saving : $default_total_input_fields;
143
  $options = $this->get_options();
192
  $option_name = 'wcj_' . $meta_box_id . '_local_total_number';
193
  // If none total number set - check for the default
194
  if ( ! ( $total_number = apply_filters( 'booster_option', 1, $this->get_value( 'wcj_product_input_fields_local_total_number', $current_post_id, 1 ) ) ) ) {
195
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_' . $meta_box_id . '_local_total_number_default', 1 ) );
196
  }
197
 
198
  // Start html
285
  */
286
  function is_enabled_for_product_global( $field_nr, $product_id ) {
287
  return wcj_is_enabled_for_product( $product_id, array(
288
+ 'include_products' => wcj_get_option( 'wcj_product_input_fields_in_products_' . 'global' . '_' . $field_nr, '' ),
289
+ 'exclude_products' => wcj_get_option( 'wcj_product_input_fields_ex_products_' . 'global' . '_' . $field_nr, '' ),
290
+ 'include_categories' => wcj_get_option( 'wcj_product_input_fields_in_cats_' . 'global' . '_' . $field_nr, '' ),
291
+ 'exclude_categories' => wcj_get_option( 'wcj_product_input_fields_ex_cats_' . 'global' . '_' . $field_nr, '' ),
292
+ 'include_tags' => wcj_get_option( 'wcj_product_input_fields_in_tags_' . 'global' . '_' . $field_nr, '' ),
293
+ 'exclude_tags' => wcj_get_option( 'wcj_product_input_fields_ex_tags_' . 'global' . '_' . $field_nr, '' ),
294
  ) );
295
  }
296
 
317
  }
318
 
319
  if (
320
+ ( 'new_order' === $status && 'yes' === wcj_get_option( 'wcj_product_input_fields_attach_to_admin_new_order', 'yes' ) ) ||
321
+ ( 'customer_processing_order' === $status && 'yes' === wcj_get_option( 'wcj_product_input_fields_attach_to_customer_processing_order', 'yes' ) )
322
  ) {
323
  foreach ( $order->get_items() as $item_key => $item ) {
324
  $product_id = $item['product_id'];
389
  }
390
  }
391
  } else {
392
+ if ( 'no' === wcj_get_option( 'wcj_product_input_fields_make_nicer_name_enabled', 'yes' ) ) {
393
  continue;
394
  }
395
  }
411
  */
412
  function get_value( $option_name, $product_id, $default ) {
413
  if ( 'global' === $this->scope ) {
414
+ return wcj_get_option( $option_name, $default );
415
  } else { // local
416
  if ( '' != ( $options = get_post_meta( $product_id, '_' . 'wcj_product_input_fields', true ) ) ) {
417
  $option_name = str_replace( 'wcj_product_input_fields_', '', $option_name );
524
  * @since 3.9.1
525
  */
526
  function maybe_stripslashes( $str ) {
527
+ return ( 'yes' === wcj_get_option( 'wcj_product_input_fields_stripslashes', 'no' ) ? stripslashes( $str ) : $str );
528
  }
529
 
530
  /**
536
  * @todo add `required` attributes
537
  */
538
  function add_product_input_fields_to_frontend() {
539
+ if ( isset( $this->are_product_input_fields_displayed ) && 'yes' === wcj_get_option( 'wcj_product_input_fields_check_for_outputted_data', 'yes' ) ) {
540
  return;
541
  }
542
  global $product;
556
 
557
  $datepicker_format = $this->get_value( 'wcj_product_input_fields_type_datepicker_format_' . $this->scope . '_' . $i, $_product_id, '' );
558
  if ( '' == $datepicker_format ) {
559
+ $datepicker_format = wcj_get_option( 'date_format' );
560
  }
561
  $datepicker_format = wcj_date_format_php_to_js( $datepicker_format );
562
  $datepicker_mindate = $this->get_value( 'wcj_product_input_fields_type_datepicker_mindate_' . $this->scope . '_' . $i, $_product_id, -365 );
586
  $field_name = 'wcj_product_input_fields_' . $this->scope . '_' . $i;
587
 
588
  if ( 'on' === $is_required || 'yes' === $is_required ) {
589
+ $title .= wcj_get_option( 'wcj_product_input_fields_frontend_view_required_html', '&nbsp;<abbr class="required" title="required">*</abbr>' );
590
  }
591
 
592
  if ( $this->is_enabled( $i, $_product_id ) ) {
680
  if ( ! empty( $select_options ) ) {
681
  reset( $select_options );
682
  $value = ( '' != $set_value ? $set_value : key( $select_options ) );
683
+ $template = wcj_get_option( 'wcj_product_input_fields_field_template_radio',
684
  '%radio_field_html%<label for="%radio_field_id%" class="radio">%radio_field_title%</label><br>' );
685
  foreach ( $select_options as $option_key => $option_text ) {
686
  $replaced_values = array(
729
  }
730
  ksort( $fields );
731
  if ( ! empty ( $fields ) ) {
732
+ echo wcj_get_option( 'wcj_product_input_fields_start_template', '' ) . implode( $fields ) . wcj_get_option( 'wcj_product_input_fields_end_template', '' );
733
  $this->are_product_input_fields_displayed = true;
734
  }
735
  }
789
  return $name;
790
  }
791
  if ( $is_cart ) {
792
+ $name .= wcj_get_option( 'wcj_product_input_fields_cart_start_template', '<dl style="font-size:smaller;">' );
793
+ $item_template = wcj_get_option( 'wcj_product_input_fields_cart_field_template', '<dt>%title%</dt><dd>%value%</dd>' );
794
  } else {
795
+ $item_template = wcj_get_option( 'wcj_product_input_fields_frontend_view_order_table_format', '&nbsp;| %title% %value%' );
796
  }
797
  for ( $i = 1; $i <= $total_number; $i++ ) {
798
  if ( ! $this->is_enabled( $i, $item['product_id'] ) ) {
827
  }
828
  }
829
  if ( $is_cart ) {
830
+ $name .= wcj_get_option( 'wcj_product_input_fields_cart_end_template', '</dl>' );
831
  }
832
  return $name;
833
  }
includes/input-fields/wcj-product-input-fields-options.php CHANGED
@@ -129,7 +129,7 @@ return array(
129
  array(
130
  'id' => 'wcj_product_input_fields_type_datepicker_format_' . $this->scope . '_',
131
  'title' => __( 'If datepicker/weekpicker is selected, set date format here. Visit <a href="https://codex.wordpress.org/Formatting_Date_and_Time" target="_blank">documentation on date and time formatting</a> for valid date formats', 'woocommerce-jetpack' ),
132
- 'desc_tip' => __( 'Leave blank to use your current WordPress format', 'woocommerce-jetpack' ) . ': ' . get_option( 'date_format' ),
133
  'short_title' => __( 'Datepicker/Weekpicker: Date format', 'woocommerce-jetpack' ),
134
  'type' => 'text',
135
  'default' => '',
129
  array(
130
  'id' => 'wcj_product_input_fields_type_datepicker_format_' . $this->scope . '_',
131
  'title' => __( 'If datepicker/weekpicker is selected, set date format here. Visit <a href="https://codex.wordpress.org/Formatting_Date_and_Time" target="_blank">documentation on date and time formatting</a> for valid date formats', 'woocommerce-jetpack' ),
132
+ 'desc_tip' => __( 'Leave blank to use your current WordPress format', 'woocommerce-jetpack' ) . ': ' . wcj_get_option( 'date_format' ),
133
  'short_title' => __( 'Datepicker/Weekpicker: Date format', 'woocommerce-jetpack' ),
134
  'type' => 'text',
135
  'default' => '',
includes/pdf-invoices/class-wcj-pdf-invoicing-report-tool.php CHANGED
@@ -49,7 +49,7 @@ class WCJ_PDF_Invoicing_Report_Tool {
49
  * @todo this function is similar to `WCJ_PDF_Invoicing::check_user_roles()` - maybe it should be just one function for both classes..
50
  */
51
  function check_user_roles( $invoice_type_id ) {
52
- $allowed_user_roles = get_option( 'wcj_invoicing_' . $invoice_type_id . '_roles', array( 'administrator', 'shop_manager' ) );
53
  if ( empty( $allowed_user_roles ) ) {
54
  $allowed_user_roles = array( 'administrator' );
55
  }
@@ -64,7 +64,7 @@ class WCJ_PDF_Invoicing_Report_Tool {
64
  */
65
  function generate_report_zip() {
66
  if ( isset( $_POST['get_invoices_report_zip'] ) ) {
67
- if ( 'yes' === get_option( 'wcj_general_advanced_disable_save_sys_temp_dir', 'no' ) ) {
68
  $this->notice = '<div class="error"><p><strong>' . sprintf(
69
  __( 'This option is disabled with "Disable Saving PDFs in PHP directory for temporary files" checkbox in <a href="%s" target="_blank">WooCommerce > Settings > Booster > PDF Invoicing & Packing Slips > Advanced</a>.', 'woocommerce-jetpack' ),
70
  admin_url( 'admin.php?page=wc-settings&tab=jetpack&wcj-cat=pdf_invoicing&section=pdf_invoicing_advanced' ) ) .
@@ -274,15 +274,15 @@ class WCJ_PDF_Invoicing_Report_Tool {
274
  return false;
275
  }
276
  $csv = '';
277
- $sep = get_option( 'wcj_pdf_invoicing_report_tool_csv_separator', ';' );
278
- $replace_periods_with_commas = ( 'yes' === get_option( 'wcj_pdf_invoicing_report_tool_csv_replace_periods_w_commas', 'yes' ) );
279
  foreach ( $data as $row ) {
280
  if ( $replace_periods_with_commas ) {
281
  $row = str_replace( '.', ',', $row );
282
  }
283
  $csv .= implode( $sep, $row ) . PHP_EOL;
284
  }
285
- if ( 'yes' === get_option( 'wcj_pdf_invoicing_report_tool_csv_add_utf_8_bom', 'yes' ) ) {
286
  $csv = "\xEF\xBB\xBF" . $csv; // UTF-8 BOM
287
  }
288
  $filename = $this->get_report_file_name( $_year, $_month, $_invoice_type, 'csv' );
@@ -315,7 +315,7 @@ class WCJ_PDF_Invoicing_Report_Tool {
315
  */
316
  function get_invoices_report_data( $year, $month, $invoice_type_id ) {
317
 
318
- $columns = get_option( 'wcj_pdf_invoicing_report_tool_columns', '' );
319
  if ( empty( $columns ) ) {
320
  $columns = array_keys( WCJ()->modules['pdf_invoicing_advanced']->get_report_columns() );
321
  }
@@ -327,7 +327,7 @@ class WCJ_PDF_Invoicing_Report_Tool {
327
  $first_minute = mktime( 0, 0, 0, $month, 1, $year );
328
  $last_minute = mktime( 23, 59, 59, $month, date( 't', $first_minute ), $year );
329
 
330
- $tax_percent_format = '%.' . get_option( 'wcj_pdf_invoicing_report_tool_tax_percent_precision', 0 ) . 'f %%';
331
 
332
  $data = array();
333
  $offset = 0;
@@ -395,7 +395,7 @@ class WCJ_PDF_Invoicing_Report_Tool {
395
  $row[] = wcj_get_invoice_number( $order_id, $invoice_type_id );
396
  break;
397
  case 'document_date':
398
- $row[] = wcj_get_invoice_date( $order_id, $invoice_type_id, 0, get_option( 'date_format' ) );
399
  break;
400
  case 'order_id':
401
  $row[] = $order_id;
49
  * @todo this function is similar to `WCJ_PDF_Invoicing::check_user_roles()` - maybe it should be just one function for both classes..
50
  */
51
  function check_user_roles( $invoice_type_id ) {
52
+ $allowed_user_roles = wcj_get_option( 'wcj_invoicing_' . $invoice_type_id . '_roles', array( 'administrator', 'shop_manager' ) );
53
  if ( empty( $allowed_user_roles ) ) {
54
  $allowed_user_roles = array( 'administrator' );
55
  }
64
  */
65
  function generate_report_zip() {
66
  if ( isset( $_POST['get_invoices_report_zip'] ) ) {
67
+ if ( 'yes' === wcj_get_option( 'wcj_general_advanced_disable_save_sys_temp_dir', 'no' ) ) {
68
  $this->notice = '<div class="error"><p><strong>' . sprintf(
69
  __( 'This option is disabled with "Disable Saving PDFs in PHP directory for temporary files" checkbox in <a href="%s" target="_blank">WooCommerce > Settings > Booster > PDF Invoicing & Packing Slips > Advanced</a>.', 'woocommerce-jetpack' ),
70
  admin_url( 'admin.php?page=wc-settings&tab=jetpack&wcj-cat=pdf_invoicing&section=pdf_invoicing_advanced' ) ) .
274
  return false;
275
  }
276
  $csv = '';
277
+ $sep = wcj_get_option( 'wcj_pdf_invoicing_report_tool_csv_separator', ';' );
278
+ $replace_periods_with_commas = ( 'yes' === wcj_get_option( 'wcj_pdf_invoicing_report_tool_csv_replace_periods_w_commas', 'yes' ) );
279
  foreach ( $data as $row ) {
280
  if ( $replace_periods_with_commas ) {
281
  $row = str_replace( '.', ',', $row );
282
  }
283
  $csv .= implode( $sep, $row ) . PHP_EOL;
284
  }
285
+ if ( 'yes' === wcj_get_option( 'wcj_pdf_invoicing_report_tool_csv_add_utf_8_bom', 'yes' ) ) {
286
  $csv = "\xEF\xBB\xBF" . $csv; // UTF-8 BOM
287
  }
288
  $filename = $this->get_report_file_name( $_year, $_month, $_invoice_type, 'csv' );
315
  */
316
  function get_invoices_report_data( $year, $month, $invoice_type_id ) {
317
 
318
+ $columns = wcj_get_option( 'wcj_pdf_invoicing_report_tool_columns', '' );
319
  if ( empty( $columns ) ) {
320
  $columns = array_keys( WCJ()->modules['pdf_invoicing_advanced']->get_report_columns() );
321
  }
327
  $first_minute = mktime( 0, 0, 0, $month, 1, $year );
328
  $last_minute = mktime( 23, 59, 59, $month, date( 't', $first_minute ), $year );
329
 
330
+ $tax_percent_format = '%.' . wcj_get_option( 'wcj_pdf_invoicing_report_tool_tax_percent_precision', 0 ) . 'f %%';
331
 
332
  $data = array();
333
  $offset = 0;
395
  $row[] = wcj_get_invoice_number( $order_id, $invoice_type_id );
396
  break;
397
  case 'document_date':
398
+ $row[] = wcj_get_invoice_date( $order_id, $invoice_type_id, 0, wcj_get_option( 'date_format' ) );
399
  break;
400
  case 'order_id':
401
  $row[] = $order_id;
includes/pdf-invoices/submodules/class-wcj-pdf-invoicing-display.php CHANGED
@@ -121,10 +121,10 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
121
  $invoice_types = wcj_get_enabled_invoice_types();
122
  foreach ( $invoice_types as $invoice_type ) {
123
  if ( wcj_is_invoice_created( wcj_get_order_id( $the_order ), $invoice_type['id'] ) ) {
124
- if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_view_btn', 'no' ) ) {
125
  // Document (View) button
126
  $query_args = array( 'order_id' => wcj_get_order_id( $the_order ), 'invoice_type_id' => $invoice_type['id'], 'get_invoice' => '1', );
127
- if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_save_as_enabled', 'no' ) ) {
128
  $query_args['save_pdf_invoice'] = '1';
129
  }
130
  $the_url = add_query_arg( $query_args, remove_query_arg( array ( 'create_invoice_for_order_id', 'delete_invoice_for_order_id' ) ) );
@@ -133,22 +133,22 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
133
  $the_action_id = $invoice_type['id'];
134
  $actions[ $the_action_id ] = array( 'url' => $the_url, 'name' => $the_name, 'action' => $the_action );
135
  }
136
- if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_delete_btn', 'yes' ) ) {
137
  // Delete button
138
  $query_args = array( 'delete_invoice_for_order_id' => wcj_get_order_id( $the_order ), 'invoice_type_id' => $invoice_type['id'] );
139
  $the_url = add_query_arg( $query_args, remove_query_arg( 'create_invoice_for_order_id' ) );
140
  $the_name = __( 'Delete', 'woocommerce-jetpack' ) . ' ' . $invoice_type['title'];
141
- $the_action = 'view ' . $invoice_type['id'] . '_' . 'delete' . ( ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_delete_btn_confirm', 'yes' ) ) ? ' wcj_need_confirmation' : '' );
142
  $the_action_id = $invoice_type['id'] . '_' . 'delete';
143
  $actions[ $the_action_id ] = array( 'url' => $the_url, 'name' => $the_name, 'action' => $the_action );
144
  }
145
  } else {
146
- if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_create_btn', 'yes' ) ) {
147
  // Create button
148
  $query_args = array( 'create_invoice_for_order_id' => wcj_get_order_id( $the_order ), 'invoice_type_id' => $invoice_type['id'] );
149
  $the_url = add_query_arg( $query_args, remove_query_arg( 'delete_invoice_for_order_id' ) );
150
  $the_name = __( 'Create', 'woocommerce-jetpack' ) . ' ' . $invoice_type['title'];
151
- $the_action = 'view ' . $invoice_type['id'] . '_' . 'create' . ( ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_create_btn_confirm', 'yes' ) ) ? ' wcj_need_confirmation' : '' );
152
  $the_action_id = $invoice_type['id'] . '_' . 'create';
153
  $actions[ $the_action_id ] = array( 'url' => $the_url, 'name' => $the_name, 'action' => $the_action );
154
  }
@@ -165,8 +165,8 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
165
  function add_order_column( $columns ) {
166
  $invoice_types = wcj_get_enabled_invoice_types();
167
  foreach ( $invoice_types as $invoice_type ) {
168
- if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_page_column', 'yes' ) ) {
169
- $columns[ $invoice_type['id'] ] = get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_page_column_text', $invoice_type['title'] );
170
  }
171
  }
172
  return $columns;
@@ -192,7 +192,7 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
192
 
193
  // Document Link
194
  $query_args = array( 'order_id' => $order_id, 'invoice_type_id' => $invoice_type_id, 'get_invoice' => '1', );
195
- if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type_id . '_save_as_enabled', 'no' ) ) {
196
  $query_args['save_pdf_invoice'] = '1';
197
  }
198
  $html .= '<a href="' . add_query_arg( $query_args, remove_query_arg( array( 'create_invoice_for_order_id', 'delete_invoice_for_order_id' ) ) ) . '">' .
@@ -214,12 +214,12 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
214
  if ( ! wcj_is_invoice_created( $order_id, $invoice_type['id'] ) ) {
215
  continue;
216
  }
217
- if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_enabled_on_thankyou_page', 'no' ) ) {
218
  $query_args = array( 'order_id' => $order_id, 'invoice_type_id' => $invoice_type['id'], 'get_invoice' => '1', );
219
- if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_save_as_enabled', 'no' ) ) {
220
  $query_args['save_pdf_invoice'] = '1';
221
  }
222
- if ( '' == ( $title = get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_thankyou_page_link_text', $invoice_type['title'] ) ) ) {
223
  $title = $invoice_type['title'];
224
  }
225
  echo str_replace( '%link%', '<a target="_blank" href="' . add_query_arg( $query_args ) . '">' . $title . '</a>',
@@ -241,14 +241,14 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
241
  continue;
242
  }
243
  $my_account_option_name = 'wcj_invoicing_' . $invoice_type['id'] . '_enabled_for_customers';
244
- if ( 'yes' === get_option( $my_account_option_name, 'no' ) ) {
245
  $the_action_id = $invoice_type['id'];
246
  $query_args = array( 'order_id' => wcj_get_order_id( $the_order ), 'invoice_type_id' => $invoice_type['id'], 'get_invoice' => '1', );
247
- if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_save_as_enabled', 'no' ) ) {
248
  $query_args['save_pdf_invoice'] = '1';
249
  }
250
  $the_url = add_query_arg( $query_args );
251
- $the_name = get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_link_text' );
252
  if ( '' == $the_name ) {
253
  $the_name = $invoice_type['title'];
254
  }
@@ -266,7 +266,7 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
266
  * @since 2.8.0
267
  */
268
  function add_invoices_meta_box() {
269
- if ( 'yes' === get_option( 'wcj_invoicing_add_order_meta_box', 'yes' ) ) {
270
  add_meta_box(
271
  'wc-booster-pdf-invoicing',
272
  '<span class="dashicons dashicons-media-default" style="color:#23282d;"></span>' . ' ' . __( 'Booster: PDF Invoices', 'woocommerce-jetpack' ),
@@ -298,8 +298,8 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
298
  if ( wcj_is_invoice_created( $order_id, $invoice_type['id'] ) ) {
299
  // "Document (View)" link
300
  $query_args = array( 'order_id' => $order_id, 'invoice_type_id' => $invoice_type['id'], 'get_invoice' => '1', );
301
- $target = ( 'yes' === get_option( 'wcj_invoicing_order_meta_box_open_in_new_window', 'yes' ) ? ' target="_blank"' : '' );
302
- if ( 'yes' === get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_save_as_enabled', 'no' ) ) {
303
  $query_args['save_pdf_invoice'] = '1';
304
  $target = '';
305
  }
@@ -316,7 +316,7 @@ class WCJ_PDF_Invoicing_Display extends WCJ_Module {
316
  $delete_link = '<a class="wcj_need_confirmation" href="' . $the_url . '">' . $the_name . '</a>';
317
  // Numbering & date
318
  $number_input = '';
319
- if ( 'yes' === get_option( 'wcj_invoicing_add_order_meta_box_numbering', 'yes' ) ) {
320
  $number_option = 'wcj_invoicing_' . $invoice_type['id'] . '_number_id';
321
  $date_option = 'wcj_invoicing_' . $invoice_type['id'] . '_date';
322
  $number_input = '<br>' .
121
  $invoice_types = wcj_get_enabled_invoice_types();
122
  foreach ( $invoice_types as $invoice_type ) {
123
  if ( wcj_is_invoice_created( wcj_get_order_id( $the_order ), $invoice_type['id'] ) ) {
124
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_view_btn', 'no' ) ) {
125
  // Document (View) button
126
  $query_args = array( 'order_id' => wcj_get_order_id( $the_order ), 'invoice_type_id' => $invoice_type['id'], 'get_invoice' => '1', );
127
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_save_as_enabled', 'no' ) ) {
128
  $query_args['save_pdf_invoice'] = '1';
129
  }
130
  $the_url = add_query_arg( $query_args, remove_query_arg( array ( 'create_invoice_for_order_id', 'delete_invoice_for_order_id' ) ) );
133
  $the_action_id = $invoice_type['id'];
134
  $actions[ $the_action_id ] = array( 'url' => $the_url, 'name' => $the_name, 'action' => $the_action );
135
  }
136
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_delete_btn', 'yes' ) ) {
137
  // Delete button
138
  $query_args = array( 'delete_invoice_for_order_id' => wcj_get_order_id( $the_order ), 'invoice_type_id' => $invoice_type['id'] );
139
  $the_url = add_query_arg( $query_args, remove_query_arg( 'create_invoice_for_order_id' ) );
140
  $the_name = __( 'Delete', 'woocommerce-jetpack' ) . ' ' . $invoice_type['title'];
141
+ $the_action = 'view ' . $invoice_type['id'] . '_' . 'delete' . ( ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_delete_btn_confirm', 'yes' ) ) ? ' wcj_need_confirmation' : '' );
142
  $the_action_id = $invoice_type['id'] . '_' . 'delete';
143
  $actions[ $the_action_id ] = array( 'url' => $the_url, 'name' => $the_name, 'action' => $the_action );
144
  }
145
  } else {
146
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_create_btn', 'yes' ) ) {
147
  // Create button
148
  $query_args = array( 'create_invoice_for_order_id' => wcj_get_order_id( $the_order ), 'invoice_type_id' => $invoice_type['id'] );
149
  $the_url = add_query_arg( $query_args, remove_query_arg( 'delete_invoice_for_order_id' ) );
150
  $the_name = __( 'Create', 'woocommerce-jetpack' ) . ' ' . $invoice_type['title'];
151
+ $the_action = 'view ' . $invoice_type['id'] . '_' . 'create' . ( ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_create_btn_confirm', 'yes' ) ) ? ' wcj_need_confirmation' : '' );
152
  $the_action_id = $invoice_type['id'] . '_' . 'create';
153
  $actions[ $the_action_id ] = array( 'url' => $the_url, 'name' => $the_name, 'action' => $the_action );
154
  }
165
  function add_order_column( $columns ) {
166
  $invoice_types = wcj_get_enabled_invoice_types();
167
  foreach ( $invoice_types as $invoice_type ) {
168
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_orders_page_column', 'yes' ) ) {
169
+ $columns[ $invoice_type['id'] ] = wcj_get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_admin_page_column_text', $invoice_type['title'] );
170
  }
171
  }
172
  return $columns;
192
 
193
  // Document Link
194
  $query_args = array( 'order_id' => $order_id, 'invoice_type_id' => $invoice_type_id, 'get_invoice' => '1', );
195
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type_id . '_save_as_enabled', 'no' ) ) {
196
  $query_args['save_pdf_invoice'] = '1';
197
  }
198
  $html .= '<a href="' . add_query_arg( $query_args, remove_query_arg( array( 'create_invoice_for_order_id', 'delete_invoice_for_order_id' ) ) ) . '">' .
214
  if ( ! wcj_is_invoice_created( $order_id, $invoice_type['id'] ) ) {
215
  continue;
216
  }
217
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_enabled_on_thankyou_page', 'no' ) ) {
218
  $query_args = array( 'order_id' => $order_id, 'invoice_type_id' => $invoice_type['id'], 'get_invoice' => '1', );
219
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_save_as_enabled', 'no' ) ) {
220
  $query_args['save_pdf_invoice'] = '1';
221
  }
222
+ if ( '' == ( $title = wcj_get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_thankyou_page_link_text', $invoice_type['title'] ) ) ) {
223
  $title = $invoice_type['title'];
224
  }
225
  echo str_replace( '%link%', '<a target="_blank" href="' . add_query_arg( $query_args ) . '">' . $title . '</a>',
241
  continue;
242
  }
243
  $my_account_option_name = 'wcj_invoicing_' . $invoice_type['id'] . '_enabled_for_customers';
244
+ if ( 'yes' === wcj_get_option( $my_account_option_name, 'no' ) ) {
245
  $the_action_id = $invoice_type['id'];
246
  $query_args = array( 'order_id' => wcj_get_order_id( $the_order ), 'invoice_type_id' => $invoice_type['id'], 'get_invoice' => '1', );
247
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_save_as_enabled', 'no' ) ) {
248
  $query_args['save_pdf_invoice'] = '1';
249
  }
250
  $the_url = add_query_arg( $query_args );
251
+ $the_name = wcj_get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_link_text' );
252
  if ( '' == $the_name ) {
253
  $the_name = $invoice_type['title'];
254
  }
266
  * @since 2.8.0
267
  */
268
  function add_invoices_meta_box() {
269
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_add_order_meta_box', 'yes' ) ) {
270
  add_meta_box(
271
  'wc-booster-pdf-invoicing',
272
  '<span class="dashicons dashicons-media-default" style="color:#23282d;"></span>' . ' ' . __( 'Booster: PDF Invoices', 'woocommerce-jetpack' ),
298
  if ( wcj_is_invoice_created( $order_id, $invoice_type['id'] ) ) {
299
  // "Document (View)" link
300
  $query_args = array( 'order_id' => $order_id, 'invoice_type_id' => $invoice_type['id'], 'get_invoice' => '1', );
301
+ $target = ( 'yes' === wcj_get_option( 'wcj_invoicing_order_meta_box_open_in_new_window', 'yes' ) ? ' target="_blank"' : '' );
302
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_' . $invoice_type['id'] . '_save_as_enabled', 'no' ) ) {
303
  $query_args['save_pdf_invoice'] = '1';
304
  $target = '';
305
  }
316
  $delete_link = '<a class="wcj_need_confirmation" href="' . $the_url . '">' . $the_name . '</a>';
317
  // Numbering & date
318
  $number_input = '';
319
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_add_order_meta_box_numbering', 'yes' ) ) {
320
  $number_option = 'wcj_invoicing_' . $invoice_type['id'] . '_number_id';
321
  $date_option = 'wcj_invoicing_' . $invoice_type['id'] . '_date';
322
  $number_input = '<br>' .
includes/pdf-invoices/submodules/class-wcj-pdf-invoicing-emails.php CHANGED
@@ -26,7 +26,7 @@ class WCJ_PDF_Invoicing_Emails extends WCJ_Module {
26
  parent::__construct( 'submodule' );
27
 
28
  if ( $this->is_enabled() ) {
29
- if ( 'no' === get_option( 'wcj_general_advanced_disable_save_sys_temp_dir', 'no' ) ) {
30
  add_filter( 'woocommerce_email_attachments', array( $this, 'add_pdf_invoice_email_attachment' ), PHP_INT_MAX, 3 );
31
  }
32
  }
@@ -38,7 +38,7 @@ class WCJ_PDF_Invoicing_Emails extends WCJ_Module {
38
  * @version 2.8.0
39
  */
40
  function do_attach_for_payment_method( $invoice_type_id, $payment_method ) {
41
- $included_gateways = get_option( 'wcj_invoicing_' . $invoice_type_id . '_payment_gateways', array() );
42
  if ( empty ( $included_gateways ) ) {
43
  return true; // include all
44
  }
@@ -69,7 +69,7 @@ class WCJ_PDF_Invoicing_Emails extends WCJ_Module {
69
  if ( ! wcj_is_invoice_created( $order_id, $invoice_type_id ) ) {
70
  continue;
71
  }
72
- $send_on_statuses = get_option( 'wcj_invoicing_' . $invoice_type_id . '_attach_to_emails', array() );
73
  if ( '' == $send_on_statuses ) {
74
  $send_on_statuses = array();
75
  }
26
  parent::__construct( 'submodule' );
27
 
28
  if ( $this->is_enabled() ) {
29
+ if ( 'no' === wcj_get_option( 'wcj_general_advanced_disable_save_sys_temp_dir', 'no' ) ) {
30
  add_filter( 'woocommerce_email_attachments', array( $this, 'add_pdf_invoice_email_attachment' ), PHP_INT_MAX, 3 );
31
  }
32
  }
38
  * @version 2.8.0
39
  */
40
  function do_attach_for_payment_method( $invoice_type_id, $payment_method ) {
41
+ $included_gateways = wcj_get_option( 'wcj_invoicing_' . $invoice_type_id . '_payment_gateways', array() );
42
  if ( empty ( $included_gateways ) ) {
43
  return true; // include all
44
  }
69
  if ( ! wcj_is_invoice_created( $order_id, $invoice_type_id ) ) {
70
  continue;
71
  }
72
+ $send_on_statuses = wcj_get_option( 'wcj_invoicing_' . $invoice_type_id . '_attach_to_emails', array() );
73
  if ( '' == $send_on_statuses ) {
74
  $send_on_statuses = array();
75
  }
includes/pdf-invoices/submodules/class-wcj-pdf-invoicing-numbering.php CHANGED
@@ -23,7 +23,7 @@ class WCJ_PDF_Invoicing_Numbering extends WCJ_Module {
23
  $this->short_desc = __( 'Numbering', 'woocommerce-jetpack' );
24
  parent::__construct( 'submodule' );
25
 
26
- if ( 'yes' === get_option( 'wcj_invoicing_admin_search_by_invoice', 'no' ) ) {
27
  add_action( 'pre_get_posts', array( $this, 'search_orders_by_invoice_number' ) );
28
  }
29
  }
23
  $this->short_desc = __( 'Numbering', 'woocommerce-jetpack' );
24
  parent::__construct( 'submodule' );
25
 
26
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_admin_search_by_invoice', 'no' ) ) {
27
  add_action( 'pre_get_posts', array( $this, 'search_orders_by_invoice_number' ) );
28
  }
29
  }
includes/price-by-country/class-wcj-price-by-country-core.php CHANGED
@@ -20,8 +20,8 @@ class WCJ_Price_by_Country_Core {
20
  */
21
  function __construct() {
22
  $this->customer_country_group_id = null;
23
- if ( ( 'no' === get_option( 'wcj_price_by_country_for_bots_disabled', 'no' ) || ! wcj_is_bot() ) && ! wcj_is_admin_product_edit_page() ) {
24
- if ( in_array( get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ), array( 'by_user_selection', 'by_ip_then_by_user_selection' ) ) ) {
25
  if ( 'wc' === WCJ_SESSION_TYPE ) {
26
  // `init()` executed on `init` hook because we need to use `WC()->session`
27
  add_action( 'init', array( $this, 'init' ) );
@@ -62,7 +62,7 @@ class WCJ_Price_by_Country_Core {
62
  */
63
  function get_currency_by_country( $country ) {
64
  $group_id = $this->get_country_group_id( $country );
65
- $country_currency_code = get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $group_id );
66
  return ( '' != $country_currency_code ? $country_currency_code : false );
67
  }
68
 
@@ -88,7 +88,7 @@ class WCJ_Price_by_Country_Core {
88
  * @since 2.9.0
89
  */
90
  function maybe_init_customer_country_by_ip() {
91
- if ( 'by_ip_then_by_user_selection' === get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
92
  if ( null === wcj_session_get( 'wcj-country' ) ) {
93
  if ( null != ( $country = $this->get_customer_country_by_ip() ) ) {
94
  wcj_session_set( 'wcj-country', $country );
@@ -106,7 +106,7 @@ class WCJ_Price_by_Country_Core {
106
  function add_hooks() {
107
 
108
  // Select with flags
109
- if ( 'yes' === get_option( 'wcj_price_by_country_jquery_wselect_enabled', 'no' ) ) {
110
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_wselect_scripts' ) );
111
  }
112
 
@@ -119,7 +119,7 @@ class WCJ_Price_by_Country_Core {
119
  add_filter( 'woocommerce_currency', array( $this, 'change_currency_code' ), $this->price_hooks_priority, 1 );
120
 
121
  // Price Filter Widget
122
- if ( 'yes' === get_option( 'wcj_price_by_country_price_filter_widget_support_enabled', 'no' ) ) {
123
  add_filter( 'woocommerce_product_query_meta_query', array( $this, 'price_filter_meta_query' ), PHP_INT_MAX, 2 );
124
  add_filter( 'woocommerce_price_filter_sql', array( $this, 'woocommerce_price_filter_sql' ), 10, 3 );
125
  add_action( 'wp_footer', array( $this, 'add_compatibility_with_price_filter_widget' ) );
@@ -127,7 +127,7 @@ class WCJ_Price_by_Country_Core {
127
  add_filter( 'posts_clauses', array( $this, 'price_filter_post_clauses_sort' ), 10, 2 );
128
  add_action( 'woocommerce_product_query', function ( $query ) {
129
  $group_id = $this->get_customer_country_group_id();
130
- $country_exchange_rate = get_option( 'wcj_price_by_country_exchange_rate_group_' . $group_id, 1 );
131
  if ( 1 == (float) $country_exchange_rate ) {
132
  return;
133
  }
@@ -143,7 +143,7 @@ class WCJ_Price_by_Country_Core {
143
 
144
  // Price Format
145
  if ( wcj_is_frontend() ) {
146
- if ( 'wc_get_price_to_display' === get_option( 'wcj_price_by_country_price_format_method', 'get_price' ) ) {
147
  add_filter( 'woocommerce_get_price_including_tax', array( $this, 'format_price_after_including_excluding_tax' ), PHP_INT_MAX, 3 );
148
  add_filter( 'woocommerce_get_price_excluding_tax', array( $this, 'format_price_after_including_excluding_tax' ), PHP_INT_MAX, 3 );
149
  }
@@ -173,7 +173,7 @@ class WCJ_Price_by_Country_Core {
173
  */
174
  function set_default_checkout_country( $default_country ) {
175
  if (
176
- 'yes' != get_option( 'wcj_price_by_country_set_dft_checkout_billing_country', 'no' ) ||
177
  empty( $country = null !== ( $country = wcj_session_get( 'wcj-country' ) ) ? $country : ( $country = $this->get_customer_country_by_ip() ) )
178
  ) {
179
  return $default_country;
@@ -194,7 +194,7 @@ class WCJ_Price_by_Country_Core {
194
  */
195
  function handle_wc_points_rewards_settings( $value ) {
196
  if (
197
- 'yes' !== get_option( 'wcj_price_by_country_comp_woo_points_rewards', 'no' )
198
  || empty( $value )
199
  || false === strpos( $value, ':' )
200
  ) {
@@ -223,7 +223,7 @@ class WCJ_Price_by_Country_Core {
223
  */
224
  function convert_free_shipping_min_amount( $option, $key, $method ) {
225
  if (
226
- 'no' === get_option( 'wcj_price_by_country_compatibility_free_shipping', 'no' )
227
  || 'min_amount' !== $key
228
  || ! is_numeric( $option )
229
  || 0 === (float) $option
@@ -285,7 +285,7 @@ class WCJ_Price_by_Country_Core {
285
  ! $wp_query->is_main_query() ||
286
  'price' !== $wp_query->get( 'orderby' ) ||
287
  empty( $group_id = $this->get_customer_country_group_id() ) ||
288
- 1 == (float) ( $country_exchange_rate = get_option( 'wcj_price_by_country_exchange_rate_group_' . $group_id, 1 ) )
289
  ) {
290
  return $args;
291
  }
@@ -321,13 +321,13 @@ class WCJ_Price_by_Country_Core {
321
  ! $wp_query->is_main_query() ||
322
  ( ! isset( $_GET['max_price'] ) && ! isset( $_GET['min_price'] ) ) ||
323
  empty( $group_id = $this->get_customer_country_group_id() ) ||
324
- 1 == (float) ( $country_exchange_rate = get_option( 'wcj_price_by_country_exchange_rate_group_' . $group_id, 1 ) )
325
  ) {
326
  return $args;
327
  }
328
  $current_min_price = isset( $_GET['min_price'] ) ? floatval( wp_unslash( $_GET['min_price'] ) ) : 0;
329
  $current_max_price = isset( $_GET['max_price'] ) ? floatval( wp_unslash( $_GET['max_price'] ) ) : PHP_INT_MAX;
330
- if ( wc_tax_enabled() && 'incl' === get_option( 'woocommerce_tax_display_shop' ) && ! wc_prices_include_tax() ) {
331
  $tax_class = apply_filters( 'woocommerce_price_filter_widget_tax_class', '' );
332
  $tax_rates = WC_Tax::get_rates( $tax_class );
333
  if ( $tax_rates ) {
@@ -354,14 +354,14 @@ class WCJ_Price_by_Country_Core {
354
  function add_compatibility_with_price_filter_widget() {
355
  if (
356
  ! is_active_widget( false, false, 'woocommerce_price_filter' )
357
- || 'no' === get_option( 'wcj_price_by_country_price_filter_widget_support_enabled', 'no' )
358
  ) {
359
  return;
360
  }
361
  ?>
362
  <?php
363
  $group_id = $this->get_customer_country_group_id();
364
- $exchange_rate = get_option( 'wcj_price_by_country_exchange_rate_group_' . $group_id, 1 );
365
  if ( $exchange_rate == 1 ) {
366
  return;
367
  }
@@ -469,9 +469,9 @@ class WCJ_Price_by_Country_Core {
469
  function woocommerce_price_filter_sql( $sql, $meta_query_sql, $tax_query_sql){
470
  if (
471
  is_admin()
472
- || 'no' === get_option( 'wcj_price_by_country_price_filter_widget_support_enabled', 'no' )
473
  || empty( $group_id = $this->get_customer_country_group_id() )
474
- || 1 == (float) ( $country_exchange_rate = get_option( 'wcj_price_by_country_exchange_rate_group_' . $group_id, 1 ) )
475
  ) {
476
  return $sql;
477
  }
@@ -525,9 +525,9 @@ class WCJ_Price_by_Country_Core {
525
  * @return float|int
526
  */
527
  function format_price_after_including_excluding_tax( $return_price, $qty, $product ) {
528
- $precision = get_option( 'woocommerce_price_num_decimals', 2 );
529
  $return_price = wcj_price_by_country_rounding( $return_price, $precision );
530
- if ( 'yes' === get_option( 'wcj_price_by_country_make_pretty', 'no' ) && $return_price >= 0.5 && $precision > 0 ) {
531
  $return_price = wcj_price_by_country_pretty_price( $return_price, $precision );
532
  }
533
  return $return_price;
@@ -570,7 +570,7 @@ class WCJ_Price_by_Country_Core {
570
  */
571
  function change_price_grouped( $price, $qty, $_product ) {
572
  if ( $_product->is_type( 'grouped' ) ) {
573
- if ( 'yes' === get_option( 'wcj_price_by_country_local_enabled', 'yes' ) ) {
574
  foreach ( $_product->get_children() as $child_id ) {
575
  $the_price = get_post_meta( $child_id, '_price', true );
576
  $the_product = wc_get_product( $child_id );
@@ -598,10 +598,10 @@ class WCJ_Price_by_Country_Core {
598
  }
599
  if ( class_exists( 'WC_Geolocation' ) ) {
600
  // Get the country by IP
601
- $location = WC_Geolocation::geolocate_ip( ( 'wc' === get_option( 'wcj_price_by_country_ip_detection_method', 'wc' ) ? '' : wcj_get_the_ip() ) );
602
  // Base fallback
603
  if ( empty( $location['country'] ) ) {
604
- $location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', get_option( 'woocommerce_default_country' ) ) );
605
  }
606
  if ( ! empty( $location['country'] ) ) {
607
  $this->customer_country_by_ip = $location['country'];
@@ -619,7 +619,7 @@ class WCJ_Price_by_Country_Core {
619
  */
620
  function change_price_shipping( $package_rates, $package ) {
621
  if ( null != ( $group_id = $this->get_customer_country_group_id() ) ) {
622
- $country_exchange_rate = get_option( 'wcj_price_by_country_exchange_rate_group_' . $group_id, 1 );
623
  return wcj_change_price_shipping_package_rates( $package_rates, $country_exchange_rate );
624
  } else {
625
  return $package_rates;
@@ -630,18 +630,18 @@ class WCJ_Price_by_Country_Core {
630
  * get_customer_country_group_id.
631
  *
632
  * @version 5.2.0
633
- * @todo [feature] (maybe) `( 'cart_and_checkout' === get_option( 'wcj_price_by_country_override_scope', 'all' ) && ( is_cart() || is_checkout() ) ) ||`
634
  */
635
  function get_customer_country_group_id() {
636
 
637
- if ( 'yes' === get_option( 'wcj_price_by_country_revert', 'no' ) && is_checkout() ) {
638
  $this->customer_country_group_id = -1;
639
  return null;
640
  }
641
 
642
  // We already know the group - nothing to calculate - return group
643
  if (
644
- 'yes' === get_option( 'wcj_price_by_country_save_country_group_id', 'yes' )
645
  && isset( $this->customer_country_group_id ) && null != $this->customer_country_group_id && $this->customer_country_group_id > 0
646
  ) {
647
  return $this->customer_country_group_id;
@@ -650,23 +650,23 @@ class WCJ_Price_by_Country_Core {
650
  // Get the country
651
  if ( isset( $_GET['country'] ) && '' != $_GET['country'] && wcj_is_user_role( 'administrator' ) ) {
652
  $country = $_GET['country'];
653
- } elseif ( 'no' != ( $override_option = get_option( 'wcj_price_by_country_override_on_checkout_with_billing_country', 'no' ) )
654
  && (
655
- ( 'all' === get_option( 'wcj_price_by_country_override_scope', 'all' ) ) ||
656
- ( 'checkout' === get_option( 'wcj_price_by_country_override_scope', 'all' ) && is_checkout() )
657
  )
658
  && isset( WC()->customer )
659
  && ( ( 'yes' === $override_option && '' != wcj_customer_get_country() ) || ( 'shipping_country' === $override_option && '' != WC()->customer->get_shipping_country() ) )
660
  ) {
661
  $country = ( 'yes' === $override_option ) ? wcj_customer_get_country() : WC()->customer->get_shipping_country();
662
  } else {
663
- if ( 'by_ip' === get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
664
  $country = $this->get_customer_country_by_ip();
665
- } elseif ( 'by_ip_then_by_user_selection' === get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
666
  $country = ( null !== ( $session_value = wcj_session_get( 'wcj-country' ) ) ? $session_value : $this->get_customer_country_by_ip() );
667
- } elseif ( 'by_user_selection' === get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
668
  $country = wcj_session_get( 'wcj-country' );
669
- } elseif ( 'by_wpml' === get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
670
  $country = ( defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : null );
671
  }
672
  }
@@ -697,18 +697,18 @@ class WCJ_Price_by_Country_Core {
697
  */
698
  function get_country_group_id( $country ) {
699
  // Get the country group id - go through all the groups, first found group is returned
700
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i ++ ) {
701
- switch ( get_option( 'wcj_price_by_country_selection', 'comma_list' ) ) {
702
  case 'comma_list':
703
- $country_exchange_rate_group = get_option( 'wcj_price_by_country_exchange_rate_countries_group_' . $i );
704
  $country_exchange_rate_group = str_replace( ' ', '', $country_exchange_rate_group );
705
  $country_exchange_rate_group = explode( ',', $country_exchange_rate_group );
706
  break;
707
  case 'multiselect':
708
- $country_exchange_rate_group = get_option( 'wcj_price_by_country_countries_group_' . $i, '' );
709
  break;
710
  case 'chosen_select':
711
- $country_exchange_rate_group = get_option( 'wcj_price_by_country_countries_group_chosen_select_' . $i, '' );
712
  break;
713
  }
714
  if ( is_array( $country_exchange_rate_group ) && in_array( $country, $country_exchange_rate_group ) ) {
@@ -723,7 +723,7 @@ class WCJ_Price_by_Country_Core {
723
  */
724
  function change_currency_code( $currency ) {
725
  if ( null != ( $group_id = $this->get_customer_country_group_id() ) ) {
726
- $country_currency_code = get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $group_id );
727
  if ( '' != $country_currency_code ) {
728
  return $country_currency_code;
729
  }
@@ -733,11 +733,11 @@ class WCJ_Price_by_Country_Core {
733
  /*function change_currency_code( $currency ) {
734
  if (
735
  null == ( $group_id = $this->get_customer_country_group_id() )
736
- || ( 'no' === get_option( 'wcj_price_by_country_curr_code_admin', 'no' ) && is_admin() )
737
  ) {
738
  return $currency;
739
  }
740
- $country_currency_code = get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $group_id );
741
  if ( '' != $country_currency_code ) {
742
  return $country_currency_code;
743
  }
@@ -773,7 +773,7 @@ class WCJ_Price_by_Country_Core {
773
  */
774
  function change_price( $price, $product ) {
775
  if ( null != ( $group_id = $this->get_customer_country_group_id() ) ) {
776
- if ( 'yes' === get_option( 'wcj_price_by_country_compatibility_woo_discount_rules', 'no' ) ) {
777
  global $flycart_woo_discount_rules;
778
  if (
779
  ! empty( $flycart_woo_discount_rules ) &&
20
  */
21
  function __construct() {
22
  $this->customer_country_group_id = null;
23
+ if ( ( 'no' === wcj_get_option( 'wcj_price_by_country_for_bots_disabled', 'no' ) || ! wcj_is_bot() ) && ! wcj_is_admin_product_edit_page() ) {
24
+ if ( in_array( wcj_get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ), array( 'by_user_selection', 'by_ip_then_by_user_selection' ) ) ) {
25
  if ( 'wc' === WCJ_SESSION_TYPE ) {
26
  // `init()` executed on `init` hook because we need to use `WC()->session`
27
  add_action( 'init', array( $this, 'init' ) );
62
  */
63
  function get_currency_by_country( $country ) {
64
  $group_id = $this->get_country_group_id( $country );
65
+ $country_currency_code = wcj_get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $group_id );
66
  return ( '' != $country_currency_code ? $country_currency_code : false );
67
  }
68
 
88
  * @since 2.9.0
89
  */
90
  function maybe_init_customer_country_by_ip() {
91
+ if ( 'by_ip_then_by_user_selection' === wcj_get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
92
  if ( null === wcj_session_get( 'wcj-country' ) ) {
93
  if ( null != ( $country = $this->get_customer_country_by_ip() ) ) {
94
  wcj_session_set( 'wcj-country', $country );
106
  function add_hooks() {
107
 
108
  // Select with flags
109
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_country_jquery_wselect_enabled', 'no' ) ) {
110
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_wselect_scripts' ) );
111
  }
112
 
119
  add_filter( 'woocommerce_currency', array( $this, 'change_currency_code' ), $this->price_hooks_priority, 1 );
120
 
121
  // Price Filter Widget
122
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_country_price_filter_widget_support_enabled', 'no' ) ) {
123
  add_filter( 'woocommerce_product_query_meta_query', array( $this, 'price_filter_meta_query' ), PHP_INT_MAX, 2 );
124
  add_filter( 'woocommerce_price_filter_sql', array( $this, 'woocommerce_price_filter_sql' ), 10, 3 );
125
  add_action( 'wp_footer', array( $this, 'add_compatibility_with_price_filter_widget' ) );
127
  add_filter( 'posts_clauses', array( $this, 'price_filter_post_clauses_sort' ), 10, 2 );
128
  add_action( 'woocommerce_product_query', function ( $query ) {
129
  $group_id = $this->get_customer_country_group_id();
130
+ $country_exchange_rate = wcj_get_option( 'wcj_price_by_country_exchange_rate_group_' . $group_id, 1 );
131
  if ( 1 == (float) $country_exchange_rate ) {
132
  return;
133
  }
143
 
144
  // Price Format
145
  if ( wcj_is_frontend() ) {
146
+ if ( 'wc_get_price_to_display' === wcj_get_option( 'wcj_price_by_country_price_format_method', 'get_price' ) ) {
147
  add_filter( 'woocommerce_get_price_including_tax', array( $this, 'format_price_after_including_excluding_tax' ), PHP_INT_MAX, 3 );
148
  add_filter( 'woocommerce_get_price_excluding_tax', array( $this, 'format_price_after_including_excluding_tax' ), PHP_INT_MAX, 3 );
149
  }
173
  */
174
  function set_default_checkout_country( $default_country ) {
175
  if (
176
+ 'yes' != wcj_get_option( 'wcj_price_by_country_set_dft_checkout_billing_country', 'no' ) ||
177
  empty( $country = null !== ( $country = wcj_session_get( 'wcj-country' ) ) ? $country : ( $country = $this->get_customer_country_by_ip() ) )
178
  ) {
179
  return $default_country;
194
  */
195
  function handle_wc_points_rewards_settings( $value ) {
196
  if (
197
+ 'yes' !== wcj_get_option( 'wcj_price_by_country_comp_woo_points_rewards', 'no' )
198
  || empty( $value )
199
  || false === strpos( $value, ':' )
200
  ) {
223
  */
224
  function convert_free_shipping_min_amount( $option, $key, $method ) {
225
  if (
226
+ 'no' === wcj_get_option( 'wcj_price_by_country_compatibility_free_shipping', 'no' )
227
  || 'min_amount' !== $key
228
  || ! is_numeric( $option )
229
  || 0 === (float) $option
285
  ! $wp_query->is_main_query() ||
286
  'price' !== $wp_query->get( 'orderby' ) ||
287
  empty( $group_id = $this->get_customer_country_group_id() ) ||
288
+ 1 == (float) ( $country_exchange_rate = wcj_get_option( 'wcj_price_by_country_exchange_rate_group_' . $group_id, 1 ) )
289
  ) {
290
  return $args;
291
  }
321
  ! $wp_query->is_main_query() ||
322
  ( ! isset( $_GET['max_price'] ) && ! isset( $_GET['min_price'] ) ) ||
323
  empty( $group_id = $this->get_customer_country_group_id() ) ||
324
+ 1 == (float) ( $country_exchange_rate = wcj_get_option( 'wcj_price_by_country_exchange_rate_group_' . $group_id, 1 ) )
325
  ) {
326
  return $args;
327
  }
328
  $current_min_price = isset( $_GET['min_price'] ) ? floatval( wp_unslash( $_GET['min_price'] ) ) : 0;
329
  $current_max_price = isset( $_GET['max_price'] ) ? floatval( wp_unslash( $_GET['max_price'] ) ) : PHP_INT_MAX;
330
+ if ( wc_tax_enabled() && 'incl' === wcj_get_option( 'woocommerce_tax_display_shop' ) && ! wc_prices_include_tax() ) {
331
  $tax_class = apply_filters( 'woocommerce_price_filter_widget_tax_class', '' );
332
  $tax_rates = WC_Tax::get_rates( $tax_class );
333
  if ( $tax_rates ) {
354
  function add_compatibility_with_price_filter_widget() {
355
  if (
356
  ! is_active_widget( false, false, 'woocommerce_price_filter' )
357
+ || 'no' === wcj_get_option( 'wcj_price_by_country_price_filter_widget_support_enabled', 'no' )
358
  ) {
359
  return;
360
  }
361
  ?>
362
  <?php
363
  $group_id = $this->get_customer_country_group_id();
364
+ $exchange_rate = wcj_get_option( 'wcj_price_by_country_exchange_rate_group_' . $group_id, 1 );
365
  if ( $exchange_rate == 1 ) {
366
  return;
367
  }
469
  function woocommerce_price_filter_sql( $sql, $meta_query_sql, $tax_query_sql){
470
  if (
471
  is_admin()
472
+ || 'no' === wcj_get_option( 'wcj_price_by_country_price_filter_widget_support_enabled', 'no' )
473
  || empty( $group_id = $this->get_customer_country_group_id() )
474
+ || 1 == (float) ( $country_exchange_rate = wcj_get_option( 'wcj_price_by_country_exchange_rate_group_' . $group_id, 1 ) )
475
  ) {
476
  return $sql;
477
  }
525
  * @return float|int
526
  */
527
  function format_price_after_including_excluding_tax( $return_price, $qty, $product ) {
528
+ $precision = wcj_get_option( 'woocommerce_price_num_decimals', 2 );
529
  $return_price = wcj_price_by_country_rounding( $return_price, $precision );
530
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_country_make_pretty', 'no' ) && $return_price >= 0.5 && $precision > 0 ) {
531
  $return_price = wcj_price_by_country_pretty_price( $return_price, $precision );
532
  }
533
  return $return_price;
570
  */
571
  function change_price_grouped( $price, $qty, $_product ) {
572
  if ( $_product->is_type( 'grouped' ) ) {
573
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_country_local_enabled', 'yes' ) ) {
574
  foreach ( $_product->get_children() as $child_id ) {
575
  $the_price = get_post_meta( $child_id, '_price', true );
576
  $the_product = wc_get_product( $child_id );
598
  }
599
  if ( class_exists( 'WC_Geolocation' ) ) {
600
  // Get the country by IP
601
+ $location = WC_Geolocation::geolocate_ip( ( 'wc' === wcj_get_option( 'wcj_price_by_country_ip_detection_method', 'wc' ) ? '' : wcj_get_the_ip() ) );
602
  // Base fallback
603
  if ( empty( $location['country'] ) ) {
604
+ $location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', wcj_get_option( 'woocommerce_default_country' ) ) );
605
  }
606
  if ( ! empty( $location['country'] ) ) {
607
  $this->customer_country_by_ip = $location['country'];
619
  */
620
  function change_price_shipping( $package_rates, $package ) {
621
  if ( null != ( $group_id = $this->get_customer_country_group_id() ) ) {
622
+ $country_exchange_rate = wcj_get_option( 'wcj_price_by_country_exchange_rate_group_' . $group_id, 1 );
623
  return wcj_change_price_shipping_package_rates( $package_rates, $country_exchange_rate );
624
  } else {
625
  return $package_rates;
630
  * get_customer_country_group_id.
631
  *
632
  * @version 5.2.0
633
+ * @todo [feature] (maybe) `( 'cart_and_checkout' === wcj_get_option( 'wcj_price_by_country_override_scope', 'all' ) && ( is_cart() || is_checkout() ) ) ||`
634
  */
635
  function get_customer_country_group_id() {
636
 
637
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_country_revert', 'no' ) && is_checkout() ) {
638
  $this->customer_country_group_id = -1;
639
  return null;
640
  }
641
 
642
  // We already know the group - nothing to calculate - return group
643
  if (
644
+ 'yes' === wcj_get_option( 'wcj_price_by_country_save_country_group_id', 'yes' )
645
  && isset( $this->customer_country_group_id ) && null != $this->customer_country_group_id && $this->customer_country_group_id > 0
646
  ) {
647
  return $this->customer_country_group_id;
650
  // Get the country
651
  if ( isset( $_GET['country'] ) && '' != $_GET['country'] && wcj_is_user_role( 'administrator' ) ) {
652
  $country = $_GET['country'];
653
+ } elseif ( 'no' != ( $override_option = wcj_get_option( 'wcj_price_by_country_override_on_checkout_with_billing_country', 'no' ) )
654
  && (
655
+ ( 'all' === wcj_get_option( 'wcj_price_by_country_override_scope', 'all' ) ) ||
656
+ ( 'checkout' === wcj_get_option( 'wcj_price_by_country_override_scope', 'all' ) && is_checkout() )
657
  )
658
  && isset( WC()->customer )
659
  && ( ( 'yes' === $override_option && '' != wcj_customer_get_country() ) || ( 'shipping_country' === $override_option && '' != WC()->customer->get_shipping_country() ) )
660
  ) {
661
  $country = ( 'yes' === $override_option ) ? wcj_customer_get_country() : WC()->customer->get_shipping_country();
662
  } else {
663
+ if ( 'by_ip' === wcj_get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
664
  $country = $this->get_customer_country_by_ip();
665
+ } elseif ( 'by_ip_then_by_user_selection' === wcj_get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
666
  $country = ( null !== ( $session_value = wcj_session_get( 'wcj-country' ) ) ? $session_value : $this->get_customer_country_by_ip() );
667
+ } elseif ( 'by_user_selection' === wcj_get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
668
  $country = wcj_session_get( 'wcj-country' );
669
+ } elseif ( 'by_wpml' === wcj_get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
670
  $country = ( defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : null );
671
  }
672
  }
697
  */
698
  function get_country_group_id( $country ) {
699
  // Get the country group id - go through all the groups, first found group is returned
700
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i ++ ) {
701
+ switch ( wcj_get_option( 'wcj_price_by_country_selection', 'comma_list' ) ) {
702
  case 'comma_list':
703
+ $country_exchange_rate_group = wcj_get_option( 'wcj_price_by_country_exchange_rate_countries_group_' . $i );
704
  $country_exchange_rate_group = str_replace( ' ', '', $country_exchange_rate_group );
705
  $country_exchange_rate_group = explode( ',', $country_exchange_rate_group );
706
  break;
707
  case 'multiselect':
708
+ $country_exchange_rate_group = wcj_get_option( 'wcj_price_by_country_countries_group_' . $i, '' );
709
  break;
710
  case 'chosen_select':
711
+ $country_exchange_rate_group = wcj_get_option( 'wcj_price_by_country_countries_group_chosen_select_' . $i, '' );
712
  break;
713
  }
714
  if ( is_array( $country_exchange_rate_group ) && in_array( $country, $country_exchange_rate_group ) ) {
723
  */
724
  function change_currency_code( $currency ) {
725
  if ( null != ( $group_id = $this->get_customer_country_group_id() ) ) {
726
+ $country_currency_code = wcj_get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $group_id );
727
  if ( '' != $country_currency_code ) {
728
  return $country_currency_code;
729
  }
733
  /*function change_currency_code( $currency ) {
734
  if (
735
  null == ( $group_id = $this->get_customer_country_group_id() )
736
+ || ( 'no' === wcj_get_option( 'wcj_price_by_country_curr_code_admin', 'no' ) && is_admin() )
737
  ) {
738
  return $currency;
739
  }
740
+ $country_currency_code = wcj_get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $group_id );
741
  if ( '' != $country_currency_code ) {
742
  return $country_currency_code;
743
  }
773
  */
774
  function change_price( $price, $product ) {
775
  if ( null != ( $group_id = $this->get_customer_country_group_id() ) ) {
776
+ if ( 'yes' === wcj_get_option( 'wcj_price_by_country_compatibility_woo_discount_rules', 'no' ) ) {
777
  global $flycart_woo_discount_rules;
778
  if (
779
  ! empty( $flycart_woo_discount_rules ) &&
includes/price-by-country/class-wcj-price-by-country-group-generator.php CHANGED
@@ -86,7 +86,7 @@ class WCJ_Price_By_Country_Group_Generator {
86
  $i = 0;
87
  foreach ( $currencies as $group_currency => $countries ) {
88
  $i++;
89
- switch ( get_option( 'wcj_price_by_country_selection', 'comma_list' ) ) {
90
  case 'comma_list':
91
  update_option( 'wcj_price_by_country_exchange_rate_countries_group_' . $i, implode( ',', $countries ) );
92
  break;
86
  $i = 0;
87
  foreach ( $currencies as $group_currency => $countries ) {
88
  $i++;
89
+ switch ( wcj_get_option( 'wcj_price_by_country_selection', 'comma_list' ) ) {
90
  case 'comma_list':
91
  update_option( 'wcj_price_by_country_exchange_rate_countries_group_' . $i, implode( ',', $countries ) );
92
  break;
includes/price-by-country/class-wcj-price-by-country-local.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @version 4.0.0
6
  * @author Pluggabl LLC.
7
- * @todo (maybe) remove this and leave only standard meta box option (i.e. only `'meta_box' === get_option( 'wcj_price_by_country_local_options_style', 'inline' )`)
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit;
@@ -79,7 +79,7 @@ class WCJ_Price_by_Country_Local {
79
  * get_total_country_groups_number.
80
  */
81
  function get_total_country_groups_number() {
82
- return apply_filters( 'booster_option', 1, get_option( 'wcj_price_by_country_total_groups_number', 1 ) );
83
  }
84
 
85
  /**
@@ -201,18 +201,18 @@ class WCJ_Price_by_Country_Local {
201
  }
202
 
203
  $countries = '';
204
- switch ( get_option( 'wcj_price_by_country_selection', 'comma_list' ) ) {
205
  case 'comma_list':
206
- $countries .= get_option( 'wcj_price_by_country_exchange_rate_countries_group_' . $i, '' );
207
  break;
208
  case 'multiselect':
209
- $countries .= ( '' != ( $group = get_option( 'wcj_price_by_country_countries_group_' . $i, '' ) ) ? implode( ',', $group ) : '' );
210
  break;
211
  case 'chosen_select':
212
- $countries .= ( '' != ( $group = get_option( 'wcj_price_by_country_countries_group_chosen_select_' . $i, '' ) ) ? implode( ',', $group ) : '' );
213
  break;
214
  }
215
- $admin_title = get_option( 'wcj_price_by_country_countries_group_admin_title_' . $i, __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i );
216
  $html .= '<details style="float: left; border-top: 1px dashed #cccccc; width: 100%; padding-top: 10px;">' .
217
  '<summary style="font-weight:bold;">' . $admin_title . '</summary><p>' . $countries . '</p>' .
218
  '</details>';
@@ -228,7 +228,7 @@ class WCJ_Price_by_Country_Local {
228
  }
229
  $html .= '<p class="form-row form-row-' . $column_position . '">';
230
  }
231
- $group_currency_code = get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $i );
232
  $currency_code_html = ( 'checkbox' != $option['type'] ) ? ' (' . get_woocommerce_currency_symbol( $group_currency_code ) . ')' : '';
233
  $html .= '<label for="' . $option_id . $variation_id_addon . '">' . $option['title'] . $currency_code_html . '</label>';
234
  $html .= $this->get_option_field_html( $current_post_id, $option_id, $option, $variation_id_addon );
4
  *
5
  * @version 4.0.0
6
  * @author Pluggabl LLC.
7
+ * @todo (maybe) remove this and leave only standard meta box option (i.e. only `'meta_box' === wcj_get_option( 'wcj_price_by_country_local_options_style', 'inline' )`)
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit;
79
  * get_total_country_groups_number.
80
  */
81
  function get_total_country_groups_number() {
82
+ return apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_price_by_country_total_groups_number', 1 ) );
83
  }
84
 
85
  /**
201
  }
202
 
203
  $countries = '';
204
+ switch ( wcj_get_option( 'wcj_price_by_country_selection', 'comma_list' ) ) {
205
  case 'comma_list':
206
+ $countries .= wcj_get_option( 'wcj_price_by_country_exchange_rate_countries_group_' . $i, '' );
207
  break;
208
  case 'multiselect':
209
+ $countries .= ( '' != ( $group = wcj_get_option( 'wcj_price_by_country_countries_group_' . $i, '' ) ) ? implode( ',', $group ) : '' );
210
  break;
211
  case 'chosen_select':
212
+ $countries .= ( '' != ( $group = wcj_get_option( 'wcj_price_by_country_countries_group_chosen_select_' . $i, '' ) ) ? implode( ',', $group ) : '' );
213
  break;
214
  }
215
+ $admin_title = wcj_get_option( 'wcj_price_by_country_countries_group_admin_title_' . $i, __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i );
216
  $html .= '<details style="float: left; border-top: 1px dashed #cccccc; width: 100%; padding-top: 10px;">' .
217
  '<summary style="font-weight:bold;">' . $admin_title . '</summary><p>' . $countries . '</p>' .
218
  '</details>';
228
  }
229
  $html .= '<p class="form-row form-row-' . $column_position . '">';
230
  }
231
+ $group_currency_code = wcj_get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $i );
232
  $currency_code_html = ( 'checkbox' != $option['type'] ) ? ' (' . get_woocommerce_currency_symbol( $group_currency_code ) . ')' : '';
233
  $html .= '<label for="' . $option_id . $variation_id_addon . '">' . $option['title'] . $currency_code_html . '</label>';
234
  $html .= $this->get_option_field_html( $current_post_id, $option_id, $option, $variation_id_addon );
includes/reports/class-wcj-currency-reports.php CHANGED
@@ -45,14 +45,14 @@ class WCJ_Currency_Reports {
45
  $currency_symbols[ $the_current_code ] = $the_current_code;
46
  $currency_symbols[ get_woocommerce_currency() ] = get_woocommerce_currency();
47
  if ( wcj_is_module_enabled( 'price_by_country' ) ) {
48
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i++ ) {
49
- $the_code = get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $i );
50
  $currency_symbols[ $the_code ] = $the_code;
51
  }
52
  }
53
  if ( wcj_is_module_enabled( 'multicurrency' ) ) {
54
- for ( $i = 1; $i <= apply_filters( 'booster_option', 2, get_option( 'wcj_multicurrency_total_number', 2 ) ); $i++ ) {
55
- $the_code = get_option( 'wcj_multicurrency_currency_' . $i );
56
  $currency_symbols[ $the_code ] = $the_code;
57
  }
58
  }
@@ -60,7 +60,7 @@ class WCJ_Currency_Reports {
60
  global $woocommerce;
61
  $available_gateways = $woocommerce->payment_gateways->payment_gateways();
62
  foreach ( $available_gateways as $key => $gateway ) {
63
- $the_code = get_option( 'wcj_gateways_currency_' . $key );
64
  if ( 'no_changes' != $the_code ) {
65
  $currency_symbols[ $the_code ] = $the_code;
66
  }
45
  $currency_symbols[ $the_current_code ] = $the_current_code;
46
  $currency_symbols[ get_woocommerce_currency() ] = get_woocommerce_currency();
47
  if ( wcj_is_module_enabled( 'price_by_country' ) ) {
48
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i++ ) {
49
+ $the_code = wcj_get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $i );
50
  $currency_symbols[ $the_code ] = $the_code;
51
  }
52
  }
53
  if ( wcj_is_module_enabled( 'multicurrency' ) ) {
54
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 2, wcj_get_option( 'wcj_multicurrency_total_number', 2 ) ); $i++ ) {
55
+ $the_code = wcj_get_option( 'wcj_multicurrency_currency_' . $i );
56
  $currency_symbols[ $the_code ] = $the_code;
57
  }
58
  }
60
  global $woocommerce;
61
  $available_gateways = $woocommerce->payment_gateways->payment_gateways();
62
  foreach ( $available_gateways as $key => $gateway ) {
63
+ $the_code = wcj_get_option( 'wcj_gateways_currency_' . $key );
64
  if ( 'no_changes' != $the_code ) {
65
  $currency_symbols[ $the_code ] = $the_code;
66
  }
includes/reports/wcj-class-reports-monthly-sales.php CHANGED
@@ -33,7 +33,7 @@ class WCJ_Reports_Monthly_Sales {
33
  $html = '';
34
  if ( isset( $_POST['wcj_save_currency_rates'] ) && isset( $_POST['wcj_save_currency_rates_array'] ) && is_array( $_POST['wcj_save_currency_rates_array'] ) ) {
35
  // Save rates
36
- update_option( 'wcj_reports_currency_rates', array_replace_recursive( get_option( 'wcj_reports_currency_rates', array() ), $_POST['wcj_save_currency_rates_array'] ) );
37
  $html .= '<div class="notice notice-success is-dismissible"><p><strong>' . __( 'Currency rates saved.', 'woocommerce-jetpack' ) . '</strong></p></div>';
38
  } elseif ( isset( $_POST['wcj_reset_currency_rates'] ) ) {
39
  // Delete rates
@@ -58,7 +58,7 @@ class WCJ_Reports_Monthly_Sales {
58
  return 1.0;
59
  }
60
  // Saved values
61
- $saved_rates = get_option( 'wcj_reports_currency_rates', array() );
62
  if ( ! empty( $saved_rates ) ) {
63
  if ( isset( $saved_rates[ $currency_from ][ $currency_to ][ $start_date ][ $end_date ] ) ) {
64
  return $saved_rates[ $currency_from ][ $currency_to ][ $start_date ][ $end_date ];
@@ -101,8 +101,8 @@ class WCJ_Reports_Monthly_Sales {
101
  $report_currency = ( isset( $_GET['currency'] ) && 'merge' != $_GET['currency'] ) ? $_GET['currency'] : get_woocommerce_currency();
102
  $block_size = 256;
103
  $table_data = array();
104
- $do_forecast = ( 'yes' === get_option( 'wcj_reports_orders_monthly_sales_forecast', 'no' ) );
105
- $do_include_today = ( 'yes' === get_option( 'wcj_reports_orders_monthly_sales_include_today', 'no' ) );
106
  for ( $i = 1; $i <= 12; $i++ ) {
107
  $current_months_averages = array();
108
  $total_orders = 0;
33
  $html = '';
34
  if ( isset( $_POST['wcj_save_currency_rates'] ) && isset( $_POST['wcj_save_currency_rates_array'] ) && is_array( $_POST['wcj_save_currency_rates_array'] ) ) {
35
  // Save rates
36
+ update_option( 'wcj_reports_currency_rates', array_replace_recursive( wcj_get_option( 'wcj_reports_currency_rates', array() ), $_POST['wcj_save_currency_rates_array'] ) );
37
  $html .= '<div class="notice notice-success is-dismissible"><p><strong>' . __( 'Currency rates saved.', 'woocommerce-jetpack' ) . '</strong></p></div>';
38
  } elseif ( isset( $_POST['wcj_reset_currency_rates'] ) ) {
39
  // Delete rates
58
  return 1.0;
59
  }
60
  // Saved values
61
+ $saved_rates = wcj_get_option( 'wcj_reports_currency_rates', array() );
62
  if ( ! empty( $saved_rates ) ) {
63
  if ( isset( $saved_rates[ $currency_from ][ $currency_to ][ $start_date ][ $end_date ] ) ) {
64
  return $saved_rates[ $currency_from ][ $currency_to ][ $start_date ][ $end_date ];
101
  $report_currency = ( isset( $_GET['currency'] ) && 'merge' != $_GET['currency'] ) ? $_GET['currency'] : get_woocommerce_currency();
102
  $block_size = 256;
103
  $table_data = array();
104
+ $do_forecast = ( 'yes' === wcj_get_option( 'wcj_reports_orders_monthly_sales_forecast', 'no' ) );
105
+ $do_include_today = ( 'yes' === wcj_get_option( 'wcj_reports_orders_monthly_sales_include_today', 'no' ) );
106
  for ( $i = 1; $i <= 12; $i++ ) {
107
  $current_months_averages = array();
108
  $total_orders = 0;
includes/reports/wcj-class-reports-sales-daily.php CHANGED
@@ -57,9 +57,9 @@ class WCJ_Reports_Product_Sales_Daily {
57
  * @todo recheck if `wc_get_product_purchase_price()` working correctly for variations
58
  */
59
  function get_report_data() {
60
- $include_taxes = ( 'yes' === get_option( 'wcj_reports_products_sales_daily_include_taxes', 'no' ) );
61
- $count_variations = ( 'yes' === get_option( 'wcj_reports_products_sales_daily_count_variations', 'no' ) );
62
- $order_statuses = get_option( 'wcj_reports_products_sales_daily_order_statuses', '' );
63
  if ( empty( $order_statuses ) ) {
64
  $order_statuses = 'any';
65
  } elseif ( 1 == count( $order_statuses ) ) {
@@ -202,7 +202,7 @@ class WCJ_Reports_Product_Sales_Daily {
202
  $table_data = array();
203
  $table_header = array();
204
  $all_columns = wcj_get_product_sales_daily_report_columns();
205
- $report_columns = get_option( 'wcj_reports_products_sales_daily_columns', '' );
206
  if ( empty( $report_columns ) ) {
207
  $report_columns = array_keys( $all_columns );
208
  }
57
  * @todo recheck if `wc_get_product_purchase_price()` working correctly for variations
58
  */
59
  function get_report_data() {
60
+ $include_taxes = ( 'yes' === wcj_get_option( 'wcj_reports_products_sales_daily_include_taxes', 'no' ) );
61
+ $count_variations = ( 'yes' === wcj_get_option( 'wcj_reports_products_sales_daily_count_variations', 'no' ) );
62
+ $order_statuses = wcj_get_option( 'wcj_reports_products_sales_daily_order_statuses', '' );
63
  if ( empty( $order_statuses ) ) {
64
  $order_statuses = 'any';
65
  } elseif ( 1 == count( $order_statuses ) ) {
202
  $table_data = array();
203
  $table_header = array();
204
  $all_columns = wcj_get_product_sales_daily_report_columns();
205
+ $report_columns = wcj_get_option( 'wcj_reports_products_sales_daily_columns', '' );
206
  if ( empty( $report_columns ) ) {
207
  $report_columns = array_keys( $all_columns );
208
  }
includes/reports/wcj-class-reports-sales.php CHANGED
@@ -111,7 +111,7 @@ class WCJ_Reports_Sales {
111
  continue;
112
  }
113
  $product_ids = array( $item['product_id'] );
114
- if ( 0 != $item['variation_id'] && 'yes' === get_option( 'wcj_reports_products_sales_count_variations', 'no' ) ) {
115
  $product_ids[] = $item['variation_id'];
116
  }
117
  foreach ( $product_ids as $product_id ) {
@@ -147,7 +147,7 @@ class WCJ_Reports_Sales {
147
  if ( ! isset( $products_data[ $product_id ][ 'total_sum' ] ) ) {
148
  $products_data[ $product_id ][ 'total_sum' ] = 0;
149
  }
150
- $products_data[ $product_id ][ 'total_sum' ] += ( $item['line_total'] + ( 'yes' === get_option( 'wcj_reports_products_sales_include_taxes', 'no' ) ?
151
  $item['line_tax'] : 0 ) );
152
  // Sales by Month
153
  $month = date( 'n', get_the_time( 'U', $order_id ) );
@@ -162,7 +162,7 @@ class WCJ_Reports_Sales {
162
  $products_data[ $product_id ][ 'sales_by_month_sum' ][ $year ][ $month ] = 0;
163
  }
164
  $products_data[ $product_id ][ 'sales_by_month_sum' ][ $year ][ $month ] += $item['line_total'] +
165
- ( 'yes' === get_option( 'wcj_reports_products_sales_include_taxes', 'no' ) ? $item['line_tax'] : 0 );
166
  // Sales by Month (Totals)
167
  if ( ! isset( $totals_data[ 'sales_by_month' ][ $year ][ $month ] ) ) {
168
  $totals_data[ 'sales_by_month' ][ $year ][ $month ] = 0;
@@ -173,7 +173,7 @@ class WCJ_Reports_Sales {
173
  $totals_data[ 'sales_by_month_sum' ][ $year ][ $month ] = 0;
174
  }
175
  $totals_data[ 'sales_by_month_sum' ][ $year ][ $month ] += $item['line_total'] +
176
- ( 'yes' === get_option( 'wcj_reports_products_sales_include_taxes', 'no' ) ? $item['line_tax'] : 0 );
177
  // Last Sale Time
178
  if ( ! isset( $products_data[ $product_id ][ 'last_sale' ] ) ) {
179
  $products_data[ $product_id ][ 'last_sale' ] = date( 'Y-m-d H:i:s', get_the_time( 'U', $order_id ) );
@@ -274,13 +274,13 @@ class WCJ_Reports_Sales {
274
  }
275
  }
276
  }
277
- if ( 'yes' === get_option( 'wcj_reports_products_sales_display_sales', 'yes' ) ) {
278
  $table_data[] = $the_row;
279
  }
280
- if ( 'yes' === get_option( 'wcj_reports_products_sales_display_sales_sum', 'yes' ) ) {
281
  $table_data[] = $the_row2;
282
  }
283
- if ( 'yes' === get_option( 'wcj_reports_products_sales_display_profit', 'no' ) ) {
284
  $table_data[] = $the_row3;
285
  }
286
  }
@@ -307,15 +307,15 @@ class WCJ_Reports_Sales {
307
  }
308
  }
309
  }
310
- if ( 'yes' === get_option( 'wcj_reports_products_sales_display_sales', 'yes' ) ) {
311
  $table_data[] = array_merge( array( '', '', '<strong>' . __( 'Total Items', 'woocommerce-jetpack' ) . '</strong>',
312
  '<strong>' . $totals_sales_by_month . '</strong>' ), $totals_row );
313
  }
314
- if ( 'yes' === get_option( 'wcj_reports_products_sales_display_sales_sum', 'yes' ) ) {
315
  $table_data[] = array_merge( array( '', '', '<strong>' . __( 'Total Sum', 'woocommerce-jetpack' ) . '</strong>',
316
  '<strong>' . wc_price( $totals_sales_by_month_sum . '</strong>' ) ), $totals_row2 );
317
  }
318
- if ( 'yes' === get_option( 'wcj_reports_products_sales_display_profit', 'no' ) ) {
319
  $table_data[] = array_merge( array( '', '', '<strong>' . __( 'Total Profit', 'woocommerce-jetpack' ) .
320
  '</strong>', '<strong>' . wc_price( $total_profit . '</strong>' ) ), $totals_row3 );
321
  }
111
  continue;
112
  }
113
  $product_ids = array( $item['product_id'] );
114
+ if ( 0 != $item['variation_id'] && 'yes' === wcj_get_option( 'wcj_reports_products_sales_count_variations', 'no' ) ) {
115
  $product_ids[] = $item['variation_id'];
116
  }
117
  foreach ( $product_ids as $product_id ) {
147
  if ( ! isset( $products_data[ $product_id ][ 'total_sum' ] ) ) {
148
  $products_data[ $product_id ][ 'total_sum' ] = 0;
149
  }
150
+ $products_data[ $product_id ][ 'total_sum' ] += ( $item['line_total'] + ( 'yes' === wcj_get_option( 'wcj_reports_products_sales_include_taxes', 'no' ) ?
151
  $item['line_tax'] : 0 ) );
152
  // Sales by Month
153
  $month = date( 'n', get_the_time( 'U', $order_id ) );
162
  $products_data[ $product_id ][ 'sales_by_month_sum' ][ $year ][ $month ] = 0;
163
  }
164
  $products_data[ $product_id ][ 'sales_by_month_sum' ][ $year ][ $month ] += $item['line_total'] +
165
+ ( 'yes' === wcj_get_option( 'wcj_reports_products_sales_include_taxes', 'no' ) ? $item['line_tax'] : 0 );
166
  // Sales by Month (Totals)
167
  if ( ! isset( $totals_data[ 'sales_by_month' ][ $year ][ $month ] ) ) {
168
  $totals_data[ 'sales_by_month' ][ $year ][ $month ] = 0;
173
  $totals_data[ 'sales_by_month_sum' ][ $year ][ $month ] = 0;
174
  }
175
  $totals_data[ 'sales_by_month_sum' ][ $year ][ $month ] += $item['line_total'] +
176
+ ( 'yes' === wcj_get_option( 'wcj_reports_products_sales_include_taxes', 'no' ) ? $item['line_tax'] : 0 );
177
  // Last Sale Time
178
  if ( ! isset( $products_data[ $product_id ][ 'last_sale' ] ) ) {
179
  $products_data[ $product_id ][ 'last_sale' ] = date( 'Y-m-d H:i:s', get_the_time( 'U', $order_id ) );
274
  }
275
  }
276
  }
277
+ if ( 'yes' === wcj_get_option( 'wcj_reports_products_sales_display_sales', 'yes' ) ) {
278
  $table_data[] = $the_row;
279
  }
280
+ if ( 'yes' === wcj_get_option( 'wcj_reports_products_sales_display_sales_sum', 'yes' ) ) {
281
  $table_data[] = $the_row2;
282
  }
283
+ if ( 'yes' === wcj_get_option( 'wcj_reports_products_sales_display_profit', 'no' ) ) {
284
  $table_data[] = $the_row3;
285
  }
286
  }
307
  }
308
  }
309
  }
310
+ if ( 'yes' === wcj_get_option( 'wcj_reports_products_sales_display_sales', 'yes' ) ) {
311
  $table_data[] = array_merge( array( '', '', '<strong>' . __( 'Total Items', 'woocommerce-jetpack' ) . '</strong>',
312
  '<strong>' . $totals_sales_by_month . '</strong>' ), $totals_row );
313
  }
314
+ if ( 'yes' === wcj_get_option( 'wcj_reports_products_sales_display_sales_sum', 'yes' ) ) {
315
  $table_data[] = array_merge( array( '', '', '<strong>' . __( 'Total Sum', 'woocommerce-jetpack' ) . '</strong>',
316
  '<strong>' . wc_price( $totals_sales_by_month_sum . '</strong>' ) ), $totals_row2 );
317
  }
318
+ if ( 'yes' === wcj_get_option( 'wcj_reports_products_sales_display_profit', 'no' ) ) {
319
  $table_data[] = array_merge( array( '', '', '<strong>' . __( 'Total Profit', 'woocommerce-jetpack' ) .
320
  '</strong>', '<strong>' . wc_price( $total_profit . '</strong>' ) ), $totals_row3 );
321
  }
includes/reports/wcj-class-reports-stock.php CHANGED
@@ -21,7 +21,7 @@ class WCJ_Reports_Stock {
21
  * @version 3.9.0
22
  * @todo (maybe) `most_stock_price`, `sales_up`, `good_sales_low_stock`
23
  * @todo (maybe) `echo __( 'Here you can generate reports. Some reports are generated using all your orders and products, so if you have a lot of them - it may take a while.', 'woocommerce-jetpack' );`
24
- * @todo (maybe) get_option( 'woocommerce_manage_stock' ) -> `echo __( 'Please enable stock management in <strong>WooCommerce > Settings > Products > Inventory</strong> to generate stock based reports.', 'woocommerce-jetpack' );`
25
  */
26
  function __construct( $args = null ) {
27
  $this->ranges_in_days = array( 7, 14, 30, 60, 90, 180, 360 );
@@ -45,8 +45,8 @@ class WCJ_Reports_Stock {
45
  'desc' => __( 'Report shows all products that are on stock, but have no sales in selected period. Only products added before the start date of selected period are accounted.', 'woocommerce-jetpack' ),
46
  ),
47
  );
48
- $this->product_type = get_option( 'wcj_reports_stock_product_type', 'product' );
49
- $this->include_deleted_products = ( 'yes' === get_option( 'wcj_reports_stock_include_deleted_products', 'yes' ) );
50
  $this->start_time = microtime( true );
51
  $products_info = array();
52
  $this->gather_products_data( $products_info );
@@ -114,7 +114,7 @@ class WCJ_Reports_Stock {
114
  $the_price = $the_product->get_price();
115
  $the_stock = wcj_get_product_total_stock( $the_product );
116
  $the_categories = ( WCJ_IS_WC_VERSION_BELOW_3 ? $the_product->get_categories() : wc_get_product_category_list( $product_id ) );
117
- $the_date = get_the_date( get_option( 'date_format' ), $product_id );
118
  $the_permalink = get_the_permalink( $product_id );
119
  $post_custom = get_post_custom( $product_id );
120
  $total_sales = isset( $post_custom['total_sales'][0] ) ? $post_custom['total_sales'][0] : 0;
@@ -314,7 +314,7 @@ class WCJ_Reports_Stock {
314
  $html .= '<td>' . wc_price( $product_info['stock_price'] ) . $purchase_stock_price_html . '</td>';
315
  $html .= '<td>' . wc_price( $total_current_stock_price ) . '</td>';
316
  $html .= '<td class="wcj_report_table_sales_columns">';
317
- $html .= ( 0 == $product_info['last_sale'] ? __( 'No sales yet', 'woocommerce-jetpack' ) : date_i18n( get_option( 'date_format' ), $product_info['last_sale'] ) );
318
  $html .= '</td>';
319
  $profit_html = ( $product_info['purchase_price'] > 0 && $product_info['sales_in_period'][ $this->range_days ] > 0 ) ?
320
  '<br><em>' . __( 'profit:', 'woocommerce-jetpack' ) . '</em>' . ' '
21
  * @version 3.9.0
22
  * @todo (maybe) `most_stock_price`, `sales_up`, `good_sales_low_stock`
23
  * @todo (maybe) `echo __( 'Here you can generate reports. Some reports are generated using all your orders and products, so if you have a lot of them - it may take a while.', 'woocommerce-jetpack' );`
24
+ * @todo (maybe) wcj_get_option( 'woocommerce_manage_stock' ) -> `echo __( 'Please enable stock management in <strong>WooCommerce > Settings > Products > Inventory</strong> to generate stock based reports.', 'woocommerce-jetpack' );`
25
  */
26
  function __construct( $args = null ) {
27
  $this->ranges_in_days = array( 7, 14, 30, 60, 90, 180, 360 );
45
  'desc' => __( 'Report shows all products that are on stock, but have no sales in selected period. Only products added before the start date of selected period are accounted.', 'woocommerce-jetpack' ),
46
  ),
47
  );
48
+ $this->product_type = wcj_get_option( 'wcj_reports_stock_product_type', 'product' );
49
+ $this->include_deleted_products = ( 'yes' === wcj_get_option( 'wcj_reports_stock_include_deleted_products', 'yes' ) );
50
  $this->start_time = microtime( true );
51
  $products_info = array();
52
  $this->gather_products_data( $products_info );
114
  $the_price = $the_product->get_price();
115
  $the_stock = wcj_get_product_total_stock( $the_product );
116
  $the_categories = ( WCJ_IS_WC_VERSION_BELOW_3 ? $the_product->get_categories() : wc_get_product_category_list( $product_id ) );
117
+ $the_date = get_the_date( wcj_get_option( 'date_format' ), $product_id );
118
  $the_permalink = get_the_permalink( $product_id );
119
  $post_custom = get_post_custom( $product_id );
120
  $total_sales = isset( $post_custom['total_sales'][0] ) ? $post_custom['total_sales'][0] : 0;
314
  $html .= '<td>' . wc_price( $product_info['stock_price'] ) . $purchase_stock_price_html . '</td>';
315
  $html .= '<td>' . wc_price( $total_current_stock_price ) . '</td>';
316
  $html .= '<td class="wcj_report_table_sales_columns">';
317
+ $html .= ( 0 == $product_info['last_sale'] ? __( 'No sales yet', 'woocommerce-jetpack' ) : date_i18n( wcj_get_option( 'date_format' ), $product_info['last_sale'] ) );
318
  $html .= '</td>';
319
  $profit_html = ( $product_info['purchase_price'] > 0 && $product_info['sales_in_period'][ $this->range_days ] > 0 ) ?
320
  '<br><em>' . __( 'profit:', 'woocommerce-jetpack' ) . '</em>' . ' '
includes/settings/meta-box/wcj-settings-meta-box-currency-per-product.php CHANGED
@@ -11,11 +11,11 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
  $currency_codes = array();
13
  $currency_codes[''] = __( 'Default', 'woocommerce-jetpack' );
14
- $currency_codes[ get_option( 'woocommerce_currency' ) ] = get_option( 'woocommerce_currency' );
15
  $currency_codes[ get_woocommerce_currency() ] = get_woocommerce_currency();
16
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_currency_per_product_total_number', 1 ) );
17
  for ( $i = 1; $i <= $total_number; $i++ ) {
18
- $currency_codes[ get_option( 'wcj_currency_per_product_currency_' . $i ) ] = get_option( 'wcj_currency_per_product_currency_' . $i );
19
  }
20
  $options = array(
21
  array(
11
 
12
  $currency_codes = array();
13
  $currency_codes[''] = __( 'Default', 'woocommerce-jetpack' );
14
+ $currency_codes[ wcj_get_option( 'woocommerce_currency' ) ] = wcj_get_option( 'woocommerce_currency' );
15
  $currency_codes[ get_woocommerce_currency() ] = get_woocommerce_currency();
16
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_currency_per_product_total_number', 1 ) );
17
  for ( $i = 1; $i <= $total_number; $i++ ) {
18
+ $currency_codes[ wcj_get_option( 'wcj_currency_per_product_currency_' . $i ) ] = wcj_get_option( 'wcj_currency_per_product_currency_' . $i );
19
  }
20
  $options = array(
21
  array(
includes/settings/meta-box/wcj-settings-meta-box-custom-css.php CHANGED
@@ -23,7 +23,7 @@ return array(
23
  array(
24
  'title' => __( 'CSS', 'woocommerce-jetpack' ),
25
  'name' => 'wcj_product_css',
26
- 'default' => get_option( 'wcj_custom_css_per_product_default_value', '' ),
27
  'type' => 'textarea',
28
  'css' => 'width:100%;min-height:100px;',
29
  ),
23
  array(
24
  'title' => __( 'CSS', 'woocommerce-jetpack' ),
25
  'name' => 'wcj_product_css',
26
+ 'default' => wcj_get_option( 'wcj_custom_css_per_product_default_value', '' ),
27
  'type' => 'textarea',
28
  'css' => 'width:100%;min-height:100px;',
29
  ),
includes/settings/meta-box/wcj-settings-meta-box-multicurrency-base-price.php CHANGED
@@ -23,12 +23,12 @@ if ( $_product->is_type( 'variable' ) ) {
23
  $products[ $main_product_id ] = '';
24
  }
25
  $options = array();
26
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_multicurrency_base_price_total_number', 1 ) );
27
  foreach ( $products as $product_id => $desc ) {
28
  $currency_codes = array();
29
  $currency_codes[ get_woocommerce_currency() ] = get_woocommerce_currency();
30
  for ( $i = 1; $i <= $total_number; $i++ ) {
31
- $currency_codes[ get_option( 'wcj_multicurrency_base_price_currency_' . $i ) ] = get_option( 'wcj_multicurrency_base_price_currency_' . $i );
32
  }
33
  $options[] = array(
34
  'name' => 'wcj_multicurrency_base_price_currency_' . $product_id,
@@ -45,9 +45,9 @@ return $options;
45
  */
46
  $currency_codes = array();
47
  $currency_codes[ get_woocommerce_currency() ] = get_woocommerce_currency();
48
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_multicurrency_base_price_total_number', 1 ) );
49
  for ( $i = 1; $i <= $total_number; $i++ ) {
50
- $currency_codes[ get_option( 'wcj_multicurrency_base_price_currency_' . $i ) ] = get_option( 'wcj_multicurrency_base_price_currency_' . $i );
51
  }
52
  $options = array(
53
  array(
23
  $products[ $main_product_id ] = '';
24
  }
25
  $options = array();
26
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_multicurrency_base_price_total_number', 1 ) );
27
  foreach ( $products as $product_id => $desc ) {
28
  $currency_codes = array();
29
  $currency_codes[ get_woocommerce_currency() ] = get_woocommerce_currency();
30
  for ( $i = 1; $i <= $total_number; $i++ ) {
31
+ $currency_codes[ wcj_get_option( 'wcj_multicurrency_base_price_currency_' . $i ) ] = wcj_get_option( 'wcj_multicurrency_base_price_currency_' . $i );
32
  }
33
  $options[] = array(
34
  'name' => 'wcj_multicurrency_base_price_currency_' . $product_id,
45
  */
46
  $currency_codes = array();
47
  $currency_codes[ get_woocommerce_currency() ] = get_woocommerce_currency();
48
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_multicurrency_base_price_total_number', 1 ) );
49
  for ( $i = 1; $i <= $total_number; $i++ ) {
50
+ $currency_codes[ wcj_get_option( 'wcj_multicurrency_base_price_currency_' . $i ) ] = wcj_get_option( 'wcj_multicurrency_base_price_currency_' . $i );
51
  }
52
  $options = array(
53
  array(
includes/settings/meta-box/wcj-settings-meta-box-multicurrency.php CHANGED
@@ -16,7 +16,7 @@ if ( ! $_product ) {
16
  }
17
  $products = array();
18
  if ( $_product->is_type( 'variable' ) ) {
19
- $list_available_variations_only = ( 'yes' === get_option( 'wcj_multicurrency_per_product_list_available_variations_only', 'yes' ) );
20
  $available_variations = ( $list_available_variations_only ? $_product->get_available_variations() : $_product->get_children() );
21
  foreach ( $available_variations as $variation ) {
22
  $variation_id = ( $list_available_variations_only ? $variation['variation_id'] : $variation );
@@ -27,10 +27,10 @@ if ( $_product->is_type( 'variable' ) ) {
27
  $products[ $main_product_id ] = '';
28
  }
29
  $currencies = array();
30
- $total_number = apply_filters( 'booster_option', 2, get_option( 'wcj_multicurrency_total_number', 2 ) );
31
  foreach ( $products as $product_id => $desc ) {
32
  for ( $i = 1; $i <= $total_number; $i++ ) {
33
- $currency_code = get_option( 'wcj_multicurrency_currency_' . $i );
34
  $currencies = array_merge( $currencies, array(
35
  array(
36
  'name' => 'wcj_multicurrency_per_product_regular_price_' . $currency_code . '_' . $product_id,
@@ -51,7 +51,7 @@ foreach ( $products as $product_id => $desc ) {
51
  'meta_name' => '_' . 'wcj_multicurrency_per_product_sale_price_' . $currency_code,
52
  ),
53
  ) );
54
- if ( 'yes' === get_option( 'wcj_multicurrency_per_product_make_empty', 'no' ) ) {
55
  $currencies[] = array(
56
  'name' => 'wcj_multicurrency_per_product_make_empty_' . $currency_code . '_' . $product_id,
57
  'default' => 'no',
16
  }
17
  $products = array();
18
  if ( $_product->is_type( 'variable' ) ) {
19
+ $list_available_variations_only = ( 'yes' === wcj_get_option( 'wcj_multicurrency_per_product_list_available_variations_only', 'yes' ) );
20
  $available_variations = ( $list_available_variations_only ? $_product->get_available_variations() : $_product->get_children() );
21
  foreach ( $available_variations as $variation ) {
22
  $variation_id = ( $list_available_variations_only ? $variation['variation_id'] : $variation );
27
  $products[ $main_product_id ] = '';
28
  }
29
  $currencies = array();
30
+ $total_number = apply_filters( 'booster_option', 2, wcj_get_option( 'wcj_multicurrency_total_number', 2 ) );
31
  foreach ( $products as $product_id => $desc ) {
32
  for ( $i = 1; $i <= $total_number; $i++ ) {
33
+ $currency_code = wcj_get_option( 'wcj_multicurrency_currency_' . $i );
34
  $currencies = array_merge( $currencies, array(
35
  array(
36
  'name' => 'wcj_multicurrency_per_product_regular_price_' . $currency_code . '_' . $product_id,
51
  'meta_name' => '_' . 'wcj_multicurrency_per_product_sale_price_' . $currency_code,
52
  ),
53
  ) );
54
+ if ( 'yes' === wcj_get_option( 'wcj_multicurrency_per_product_make_empty', 'no' ) ) {
55
  $currencies[] = array(
56
  'name' => 'wcj_multicurrency_per_product_make_empty_' . $currency_code . '_' . $product_id,
57
  'default' => 'no',
includes/settings/meta-box/wcj-settings-meta-box-offer-price.php CHANGED
@@ -26,7 +26,7 @@ return array(
26
  'name' => 'wcj_offer_price_price_step',
27
  'default' => '',
28
  'type' => 'number',
29
- 'placeholder' => get_option( 'wcj_offer_price_price_step', get_option( 'woocommerce_price_num_decimals' ) ),
30
  'custom_attributes' => 'min="0"',
31
  ),
32
  array(
@@ -35,7 +35,7 @@ return array(
35
  'name' => 'wcj_offer_price_min_price',
36
  'default' => '',
37
  'type' => 'number',
38
- 'placeholder' => get_option( 'wcj_offer_price_min_price', 0 ),
39
  'custom_attributes' => 'min="0"',
40
  ),
41
  array(
@@ -44,7 +44,7 @@ return array(
44
  'name' => 'wcj_offer_price_max_price',
45
  'default' => '',
46
  'type' => 'number',
47
- 'placeholder' => get_option( 'wcj_offer_price_max_price', 0 ),
48
  'custom_attributes' => 'min="0"',
49
  ),
50
  array(
@@ -53,7 +53,7 @@ return array(
53
  'name' => 'wcj_offer_price_default_price',
54
  'default' => '',
55
  'type' => 'number',
56
- 'placeholder' => get_option( 'wcj_offer_price_default_price', 0 ),
57
  'custom_attributes' => 'min="0"',
58
  ),
59
  );
26
  'name' => 'wcj_offer_price_price_step',
27
  'default' => '',
28
  'type' => 'number',
29
+ 'placeholder' => wcj_get_option( 'wcj_offer_price_price_step', wcj_get_option( 'woocommerce_price_num_decimals' ) ),
30
  'custom_attributes' => 'min="0"',
31
  ),
32
  array(
35
  'name' => 'wcj_offer_price_min_price',
36
  'default' => '',
37
  'type' => 'number',
38
+ 'placeholder' => wcj_get_option( 'wcj_offer_price_min_price', 0 ),
39
  'custom_attributes' => 'min="0"',
40
  ),
41
  array(
44
  'name' => 'wcj_offer_price_max_price',
45
  'default' => '',
46
  'type' => 'number',
47
+ 'placeholder' => wcj_get_option( 'wcj_offer_price_max_price', 0 ),
48
  'custom_attributes' => 'min="0"',
49
  ),
50
  array(
53
  'name' => 'wcj_offer_price_default_price',
54
  'default' => '',
55
  'type' => 'number',
56
+ 'placeholder' => wcj_get_option( 'wcj_offer_price_default_price', 0 ),
57
  'custom_attributes' => 'min="0"',
58
  ),
59
  );
includes/settings/meta-box/wcj-settings-meta-box-order-quantities.php CHANGED
@@ -25,7 +25,7 @@ if ( $_product->is_type( 'variable' ) ) {
25
  } else {
26
  $products[ $main_product_id ] = '';
27
  }
28
- $qty_step_settings = ( 'yes' === get_option( 'wcj_order_quantities_decimal_qty_enabled', 'no' ) ? '0.000001' : '1' );
29
  $quantities = array();
30
  foreach ( $products as $product_id => $desc ) {
31
  if ( $this->is_min_per_product_enabled ) {
25
  } else {
26
  $products[ $main_product_id ] = '';
27
  }
28
+ $qty_step_settings = ( 'yes' === wcj_get_option( 'wcj_order_quantities_decimal_qty_enabled', 'no' ) ? '0.000001' : '1' );
29
  $quantities = array();
30
  foreach ( $products as $product_id => $desc ) {
31
  if ( $this->is_min_per_product_enabled ) {
includes/settings/meta-box/wcj-settings-meta-box-orders.php CHANGED
@@ -18,7 +18,7 @@ $options = array(
18
  array(
19
  'title' => __( 'Order Currency', 'woocommerce-jetpack' ),
20
  'tooltip' => __( 'Save order after you change this field.', 'woocommerce-jetpack' ),
21
- 'name' => ( 'filter' === get_option( 'wcj_order_admin_currency_method', 'filter' ) ? 'wcj_order_currency' : 'order_currency' ),
22
  'default' => wcj_get_order_currency( $_order ),
23
  'type' => 'select',
24
  'options' => wcj_get_woocommerce_currencies_and_symbols(),
18
  array(
19
  'title' => __( 'Order Currency', 'woocommerce-jetpack' ),
20
  'tooltip' => __( 'Save order after you change this field.', 'woocommerce-jetpack' ),
21
+ 'name' => ( 'filter' === wcj_get_option( 'wcj_order_admin_currency_method', 'filter' ) ? 'wcj_order_currency' : 'order_currency' ),
22
  'default' => wcj_get_order_currency( $_order ),
23
  'type' => 'select',
24
  'options' => wcj_get_woocommerce_currencies_and_symbols(),
includes/settings/meta-box/wcj-settings-meta-box-price-by-country.php CHANGED
@@ -11,20 +11,20 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
  $products = wcj_get_product_ids_for_meta_box_options( get_the_ID() );
13
  $groups = array();
14
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_price_by_country_total_groups_number', 1 ) );
15
  for ( $i = 1; $i <= $total_number; $i++ ) {
16
- $group_currency_code = get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $i );
17
- $admin_title = get_option( 'wcj_price_by_country_countries_group_admin_title_' . $i, __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i );
18
  $countries = '';
19
- switch ( get_option( 'wcj_price_by_country_selection', 'comma_list' ) ) {
20
  case 'comma_list':
21
- $countries .= get_option( 'wcj_price_by_country_exchange_rate_countries_group_' . $i );
22
  break;
23
  case 'multiselect':
24
- $countries .= ( '' != ( $group = get_option( 'wcj_price_by_country_countries_group_' . $i, '' ) ) ? implode( ',', $group ) : '' );
25
  break;
26
  case 'chosen_select':
27
- $countries .= ( '' != ( $group = get_option( 'wcj_price_by_country_countries_group_chosen_select_' . $i, '' ) ) ? implode( ',', $group ) : '' );
28
  break;
29
  }
30
  $admin_title = '<details>' . '<summary>' . $admin_title . ' [' . $group_currency_code . ']' . '</summary>' .
11
 
12
  $products = wcj_get_product_ids_for_meta_box_options( get_the_ID() );
13
  $groups = array();
14
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_price_by_country_total_groups_number', 1 ) );
15
  for ( $i = 1; $i <= $total_number; $i++ ) {
16
+ $group_currency_code = wcj_get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $i );
17
+ $admin_title = wcj_get_option( 'wcj_price_by_country_countries_group_admin_title_' . $i, __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i );
18
  $countries = '';
19
+ switch ( wcj_get_option( 'wcj_price_by_country_selection', 'comma_list' ) ) {
20
  case 'comma_list':
21
+ $countries .= wcj_get_option( 'wcj_price_by_country_exchange_rate_countries_group_' . $i );
22
  break;
23
  case 'multiselect':
24
+ $countries .= ( '' != ( $group = wcj_get_option( 'wcj_price_by_country_countries_group_' . $i, '' ) ) ? implode( ',', $group ) : '' );
25
  break;
26
  case 'chosen_select':
27
+ $countries .= ( '' != ( $group = wcj_get_option( 'wcj_price_by_country_countries_group_chosen_select_' . $i, '' ) ) ? implode( ',', $group ) : '' );
28
  break;
29
  }
30
  $admin_title = '<details>' . '<summary>' . $admin_title . ' [' . $group_currency_code . ']' . '</summary>' .
includes/settings/meta-box/wcj-settings-meta-box-price-by-user-role.php CHANGED
@@ -40,7 +40,7 @@ $options = array(
40
  ),
41
  );
42
  if ( 'yes' === get_post_meta( wcj_get_product_id( $_product ), '_' . 'wcj_price_by_user_role_per_product_settings_enabled', true ) ) {
43
- $visible_roles = get_option( 'wcj_price_by_user_role_per_product_show_roles', '' );
44
  foreach ( $products as $product_id => $desc ) {
45
  foreach ( wcj_get_user_roles() as $role_key => $role_data ) {
46
  if ( ! empty( $visible_roles ) ) {
@@ -83,7 +83,7 @@ if ( 'yes' === get_post_meta( wcj_get_product_id( $_product ), '_' . 'wcj_price_
83
  $copy_buttons_regular = $copy_to_roles_regular . $copy_to_variations_regular . $copy_to_roles_and_variations_regular;
84
  $copy_buttons_sale = $copy_to_roles_sale . $copy_to_variations_sale . $copy_to_roles_and_variations_sale;
85
  // Settings
86
- if ( 'fixed' === get_option( 'wcj_price_by_user_role_per_product_type', 'fixed' ) ) {
87
  $prices_or_multiplier = array(
88
  array(
89
  'name' => 'wcj_price_by_user_role_regular_price_' . $role_key . '_' . $product_id,
40
  ),
41
  );
42
  if ( 'yes' === get_post_meta( wcj_get_product_id( $_product ), '_' . 'wcj_price_by_user_role_per_product_settings_enabled', true ) ) {
43
+ $visible_roles = wcj_get_option( 'wcj_price_by_user_role_per_product_show_roles', '' );
44
  foreach ( $products as $product_id => $desc ) {
45
  foreach ( wcj_get_user_roles() as $role_key => $role_data ) {
46
  if ( ! empty( $visible_roles ) ) {
83
  $copy_buttons_regular = $copy_to_roles_regular . $copy_to_variations_regular . $copy_to_roles_and_variations_regular;
84
  $copy_buttons_sale = $copy_to_roles_sale . $copy_to_variations_sale . $copy_to_roles_and_variations_sale;
85
  // Settings
86
+ if ( 'fixed' === wcj_get_option( 'wcj_price_by_user_role_per_product_type', 'fixed' ) ) {
87
  $prices_or_multiplier = array(
88
  array(
89
  'name' => 'wcj_price_by_user_role_regular_price_' . $role_key . '_' . $product_id,
includes/settings/meta-box/wcj-settings-meta-box-product-add-to-cart.php CHANGED
@@ -10,7 +10,7 @@
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
  $options = array();
13
- if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_add_to_cart_redirect_per_product_enabled', 'no' ) ) ) {
14
  $options = array_merge( $options, array(
15
  array(
16
  'name' => 'wcj_add_to_cart_redirect_enabled',
@@ -32,7 +32,7 @@ if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_add_to_ca
32
  ),
33
  ) );
34
  }
35
- if ( 'per_product' === get_option( 'wcj_add_to_cart_on_visit_enabled', 'no' ) ) {
36
  $options = array_merge( $options, array(
37
  array(
38
  'name' => 'wcj_add_to_cart_on_visit_enabled',
@@ -46,7 +46,7 @@ if ( 'per_product' === get_option( 'wcj_add_to_cart_on_visit_enabled', 'no' ) )
46
  ),
47
  ) );
48
  }
49
- if ( 'yes' === get_option( 'wcj_add_to_cart_button_custom_loop_url_per_product_enabled', 'no' ) ) {
50
  $options = array_merge( $options, array(
51
  array(
52
  'name' => 'wcj_add_to_cart_button_loop_custom_url',
@@ -56,7 +56,7 @@ if ( 'yes' === get_option( 'wcj_add_to_cart_button_custom_loop_url_per_product_e
56
  ),
57
  ) );
58
  }
59
- if ( 'yes' === get_option( 'wcj_add_to_cart_button_ajax_per_product_enabled', 'no' ) ) {
60
  $options = array_merge( $options, array(
61
  array(
62
  'name' => 'wcj_add_to_cart_button_ajax_disable',
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
  $options = array();
13
+ if ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_add_to_cart_redirect_per_product_enabled', 'no' ) ) ) {
14
  $options = array_merge( $options, array(
15
  array(
16
  'name' => 'wcj_add_to_cart_redirect_enabled',
32
  ),
33
  ) );
34
  }
35
+ if ( 'per_product' === wcj_get_option( 'wcj_add_to_cart_on_visit_enabled', 'no' ) ) {
36
  $options = array_merge( $options, array(
37
  array(
38
  'name' => 'wcj_add_to_cart_on_visit_enabled',
46
  ),
47
  ) );
48
  }
49
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_button_custom_loop_url_per_product_enabled', 'no' ) ) {
50
  $options = array_merge( $options, array(
51
  array(
52
  'name' => 'wcj_add_to_cart_button_loop_custom_url',
56
  ),
57
  ) );
58
  }
59
+ if ( 'yes' === wcj_get_option( 'wcj_add_to_cart_button_ajax_per_product_enabled', 'no' ) ) {
60
  $options = array_merge( $options, array(
61
  array(
62
  'name' => 'wcj_add_to_cart_button_ajax_disable',
includes/settings/meta-box/wcj-settings-meta-box-product-by-condition.php CHANGED
@@ -9,7 +9,7 @@
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
- $option_styling = ( 'standard' === get_option( 'wcj_' . $this->id . '_select_style', 'chosen_select' ) ?
13
  array(
14
  'tooltip' => __( 'Use "Control" key to select/deselect multiple options. Hold "Control" and "A" to select all options. Leave empty to disable.', 'woocommerce-jetpack' ),
15
  'css' => 'height:200px;',
@@ -23,7 +23,7 @@ $option_styling = ( 'standard' === get_option( 'wcj_' . $this->id . '_select_sty
23
  );
24
  $all_options = $this->get_options_list();
25
  $options = array();
26
- if ( 'invisible' != apply_filters( 'booster_option', 'visible', get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
27
  $options = array_merge( $options, array( array_merge(
28
  array(
29
  'title' => __( 'Visible', 'woocommerce-jetpack' ),
@@ -35,7 +35,7 @@ if ( 'invisible' != apply_filters( 'booster_option', 'visible', get_option( 'wcj
35
  ), $option_styling )
36
  ) );
37
  }
38
- if ( 'visible' != apply_filters( 'booster_option', 'visible', get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
39
  $options = array_merge( $options, array( array_merge(
40
  array(
41
  'title' => __( 'Invisible', 'woocommerce-jetpack' ),
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
+ $option_styling = ( 'standard' === wcj_get_option( 'wcj_' . $this->id . '_select_style', 'chosen_select' ) ?
13
  array(
14
  'tooltip' => __( 'Use "Control" key to select/deselect multiple options. Hold "Control" and "A" to select all options. Leave empty to disable.', 'woocommerce-jetpack' ),
15
  'css' => 'height:200px;',
23
  );
24
  $all_options = $this->get_options_list();
25
  $options = array();
26
+ if ( 'invisible' != apply_filters( 'booster_option', 'visible', wcj_get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
27
  $options = array_merge( $options, array( array_merge(
28
  array(
29
  'title' => __( 'Visible', 'woocommerce-jetpack' ),
35
  ), $option_styling )
36
  ) );
37
  }
38
+ if ( 'visible' != apply_filters( 'booster_option', 'visible', wcj_get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
39
  $options = array_merge( $options, array( array_merge(
40
  array(
41
  'title' => __( 'Invisible', 'woocommerce-jetpack' ),
includes/settings/meta-box/wcj-settings-meta-box-product-by-date.php CHANGED
@@ -32,7 +32,7 @@ $settings = array(
32
  'tooltip' => __( 'Fill this if you want to set one date from which the product will be available.', 'woocommerce-jetpack' ) . ' ' .
33
  __( 'If this field is filled in, monthly settings fields are ignored.', 'woocommerce-jetpack' ) . '<br /><br />' .
34
  __( 'If you are not using english, please set some numeric format like m/d/Y on "Direct Date Admin Input Date Format" option', 'woocommerce-jetpack' ),
35
- 'custom_attributes' => ( '' != ( $format = get_option( 'wcj_product_by_date_direct_date_format', 'm/d/Y' ) ) ?
36
  'dateformat="' . wcj_date_format_php_to_js( $format ) . '"' : '' ),
37
  ),
38
  );
32
  'tooltip' => __( 'Fill this if you want to set one date from which the product will be available.', 'woocommerce-jetpack' ) . ' ' .
33
  __( 'If this field is filled in, monthly settings fields are ignored.', 'woocommerce-jetpack' ) . '<br /><br />' .
34
  __( 'If you are not using english, please set some numeric format like m/d/Y on "Direct Date Admin Input Date Format" option', 'woocommerce-jetpack' ),
35
+ 'custom_attributes' => ( '' != ( $format = wcj_get_option( 'wcj_product_by_date_direct_date_format', 'm/d/Y' ) ) ?
36
  'dateformat="' . wcj_date_format_php_to_js( $format ) . '"' : '' ),
37
  ),
38
  );
includes/settings/meta-box/wcj-settings-meta-box-product-msrp.php CHANGED
@@ -18,7 +18,7 @@ if ( ! $_product ) {
18
  $products = array();
19
  $options = array();
20
 
21
- if ( $_product->is_type( 'variable' ) && 'no' === get_option( 'wcj_product_msrp_variable_as_simple_enabled', 'no' ) ) {
22
  $available_variations = $_product->get_available_variations();
23
  foreach ( $available_variations as $variation ) {
24
  $variation_product = wc_get_product( $variation['variation_id'] );
@@ -29,7 +29,7 @@ if ( $_product->is_type( 'variable' ) && 'no' === get_option( 'wcj_product_msrp_
29
  }
30
 
31
  // Archive Page Field
32
- if ( 'yes' === get_option( 'wcj_product_msrp_archive_page_field', 'no' ) ) {
33
  $options[] = array(
34
  'name' => 'wcj_msrp_archive_' . $main_product_id,
35
  'default' => 0,
18
  $products = array();
19
  $options = array();
20
 
21
+ if ( $_product->is_type( 'variable' ) && 'no' === wcj_get_option( 'wcj_product_msrp_variable_as_simple_enabled', 'no' ) ) {
22
  $available_variations = $_product->get_available_variations();
23
  foreach ( $available_variations as $variation ) {
24
  $variation_product = wc_get_product( $variation['variation_id'] );
29
  }
30
 
31
  // Archive Page Field
32
+ if ( 'yes' === wcj_get_option( 'wcj_product_msrp_archive_page_field', 'no' ) ) {
33
  $options[] = array(
34
  'name' => 'wcj_msrp_archive_' . $main_product_id,
35
  'default' => 0,
includes/settings/meta-box/wcj-settings-meta-box-product-price-by-formula.php CHANGED
@@ -33,27 +33,27 @@ $options = array(
33
  ),
34
  array(
35
  'name' => 'wcj_product_price_by_formula_eval',
36
- 'default' => get_option( 'wcj_product_price_by_formula_eval', '' ),
37
  'type' => 'text',
38
  'title' => __( 'Formula', 'woocommerce-jetpack' ),
39
  ),
40
  array(
41
  'name' => 'wcj_product_price_by_formula_total_params',
42
- 'default' => get_option( 'wcj_product_price_by_formula_total_params', 1 ),
43
  'type' => 'number',
44
  'title' => __( 'Number of Parameters', 'woocommerce-jetpack' ),
45
  ),
46
  );
47
  $total_params = get_post_meta( get_the_ID(), '_' . 'wcj_product_price_by_formula_total_params', false );
48
  if ( empty( $total_params ) ) {
49
- $total_params = get_option( 'wcj_product_price_by_formula_total_params', 1 );
50
  } else {
51
  $total_params = $total_params[0];
52
  }
53
  for ( $i = 1; $i <= $total_params; $i++ ) {
54
  $options[] = array(
55
  'name' => 'wcj_product_price_by_formula_param_' . $i,
56
- 'default' => get_option( 'wcj_product_price_by_formula_param_' . $i, '' ),
57
  'type' => 'text',
58
  'title' => 'p' . $i,
59
  );
33
  ),
34
  array(
35
  'name' => 'wcj_product_price_by_formula_eval',
36
+ 'default' => wcj_get_option( 'wcj_product_price_by_formula_eval', '' ),
37
  'type' => 'text',
38
  'title' => __( 'Formula', 'woocommerce-jetpack' ),
39
  ),
40
  array(
41
  'name' => 'wcj_product_price_by_formula_total_params',
42
+ 'default' => wcj_get_option( 'wcj_product_price_by_formula_total_params', 1 ),
43
  'type' => 'number',
44
  'title' => __( 'Number of Parameters', 'woocommerce-jetpack' ),
45
  ),
46
  );
47
  $total_params = get_post_meta( get_the_ID(), '_' . 'wcj_product_price_by_formula_total_params', false );
48
  if ( empty( $total_params ) ) {
49
+ $total_params = wcj_get_option( 'wcj_product_price_by_formula_total_params', 1 );
50
  } else {
51
  $total_params = $total_params[0];
52
  }
53
  for ( $i = 1; $i <= $total_params; $i++ ) {
54
  $options[] = array(
55
  'name' => 'wcj_product_price_by_formula_param_' . $i,
56
+ 'default' => wcj_get_option( 'wcj_product_price_by_formula_param_' . $i, '' ),
57
  'type' => 'text',
58
  'title' => 'p' . $i,
59
  );
includes/settings/meta-box/wcj-settings-meta-box-purchase-data.php CHANGED
@@ -16,7 +16,7 @@ if ( ! $_product ) {
16
  return array();
17
  }
18
  $products = array();
19
- if ( $_product->is_type( 'variable' ) && 'no' === get_option( 'wcj_purchase_data_variable_as_simple_enabled', 'no' ) ) {
20
  $available_variations = $_product->get_available_variations();
21
  foreach ( $available_variations as $variation ) {
22
  $variation_product = wc_get_product( $variation['variation_id'] );
@@ -36,7 +36,7 @@ foreach ( $products as $product_id => $desc ) {
36
  'desc' => $desc,
37
  'product_id' => $product_id,
38
  'meta_name' => '_' . 'wcj_purchase_price',
39
- 'enabled' => get_option( 'wcj_purchase_price_enabled', 'yes' ),
40
  ),
41
  array(
42
  'name' => 'wcj_purchase_price_extra_' . $product_id,
@@ -46,7 +46,7 @@ foreach ( $products as $product_id => $desc ) {
46
  'desc' => $desc,
47
  'product_id' => $product_id,
48
  'meta_name' => '_' . 'wcj_purchase_price_extra',
49
- 'enabled' => get_option( 'wcj_purchase_price_extra_enabled', 'yes' ),
50
  ),
51
  array(
52
  'name' => 'wcj_purchase_price_affiliate_commission_' . $product_id,
@@ -56,17 +56,17 @@ foreach ( $products as $product_id => $desc ) {
56
  'desc' => $desc,
57
  'product_id' => $product_id,
58
  'meta_name' => '_' . 'wcj_purchase_price_affiliate_commission',
59
- 'enabled' => get_option( 'wcj_purchase_price_affiliate_commission_enabled', 'no' ),
60
  ),
61
  );
62
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_purchase_data_custom_price_fields_total_number', 1 ) );
63
  for ( $i = 1; $i <= $total_number; $i++ ) {
64
- $the_title = get_option( 'wcj_purchase_data_custom_price_field_name_' . $i, '' );
65
  if ( '' == $the_title ) {
66
  continue;
67
  }
68
- $the_type = get_option( 'wcj_purchase_data_custom_price_field_type_' . $i, 'fixed' );
69
- $the_default_value = get_option( 'wcj_purchase_data_custom_price_field_default_value_' . $i, 0 );
70
  $the_title .= ( 'fixed' === $the_type ) ? ' (' . get_woocommerce_currency_symbol() . ')' : ' (' . '%' . ')';
71
  $product_options[] = array(
72
  'name' => 'wcj_purchase_price_custom_field_' . $i . '_' . $product_id,
@@ -88,7 +88,7 @@ foreach ( $products as $product_id => $desc ) {
88
  'desc' => $desc,
89
  'product_id' => $product_id,
90
  'meta_name' => '_' . 'wcj_purchase_date',
91
- 'enabled' => get_option( 'wcj_purchase_date_enabled', 'yes' ),
92
  ),
93
  array(
94
  'name' => 'wcj_purchase_partner_' . $product_id,
@@ -98,7 +98,7 @@ foreach ( $products as $product_id => $desc ) {
98
  'desc' => $desc,
99
  'product_id' => $product_id,
100
  'meta_name' => '_' . 'wcj_purchase_partner',
101
- 'enabled' => get_option( 'wcj_purchase_partner_enabled', 'yes' ),
102
  ),
103
  array(
104
  'name' => 'wcj_purchase_info_' . $product_id,
@@ -108,7 +108,7 @@ foreach ( $products as $product_id => $desc ) {
108
  'desc' => $desc,
109
  'product_id' => $product_id,
110
  'meta_name' => '_' . 'wcj_purchase_info',
111
- 'enabled' => get_option( 'wcj_purchase_info_enabled', 'yes' ),
112
  ),
113
  ) );
114
  $product_options = apply_filters( 'wcj_purchase_data_product_options', $product_options, $product_id, $desc );
16
  return array();
17
  }
18
  $products = array();
19
+ if ( $_product->is_type( 'variable' ) && 'no' === wcj_get_option( 'wcj_purchase_data_variable_as_simple_enabled', 'no' ) ) {
20
  $available_variations = $_product->get_available_variations();
21
  foreach ( $available_variations as $variation ) {
22
  $variation_product = wc_get_product( $variation['variation_id'] );
36
  'desc' => $desc,
37
  'product_id' => $product_id,
38
  'meta_name' => '_' . 'wcj_purchase_price',
39
+ 'enabled' => wcj_get_option( 'wcj_purchase_price_enabled', 'yes' ),
40
  ),
41
  array(
42
  'name' => 'wcj_purchase_price_extra_' . $product_id,
46
  'desc' => $desc,
47
  'product_id' => $product_id,
48
  'meta_name' => '_' . 'wcj_purchase_price_extra',
49
+ 'enabled' => wcj_get_option( 'wcj_purchase_price_extra_enabled', 'yes' ),
50
  ),
51
  array(
52
  'name' => 'wcj_purchase_price_affiliate_commission_' . $product_id,
56
  'desc' => $desc,
57
  'product_id' => $product_id,
58
  'meta_name' => '_' . 'wcj_purchase_price_affiliate_commission',
59
+ 'enabled' => wcj_get_option( 'wcj_purchase_price_affiliate_commission_enabled', 'no' ),
60
  ),
61
  );
62
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_purchase_data_custom_price_fields_total_number', 1 ) );
63
  for ( $i = 1; $i <= $total_number; $i++ ) {
64
+ $the_title = wcj_get_option( 'wcj_purchase_data_custom_price_field_name_' . $i, '' );
65
  if ( '' == $the_title ) {
66
  continue;
67
  }
68
+ $the_type = wcj_get_option( 'wcj_purchase_data_custom_price_field_type_' . $i, 'fixed' );
69
+ $the_default_value = wcj_get_option( 'wcj_purchase_data_custom_price_field_default_value_' . $i, 0 );
70
  $the_title .= ( 'fixed' === $the_type ) ? ' (' . get_woocommerce_currency_symbol() . ')' : ' (' . '%' . ')';
71
  $product_options[] = array(
72
  'name' => 'wcj_purchase_price_custom_field_' . $i . '_' . $product_id,
88
  'desc' => $desc,
89
  'product_id' => $product_id,
90
  'meta_name' => '_' . 'wcj_purchase_date',
91
+ 'enabled' => wcj_get_option( 'wcj_purchase_date_enabled', 'yes' ),
92
  ),
93
  array(
94
  'name' => 'wcj_purchase_partner_' . $product_id,
98
  'desc' => $desc,
99
  'product_id' => $product_id,
100
  'meta_name' => '_' . 'wcj_purchase_partner',
101
+ 'enabled' => wcj_get_option( 'wcj_purchase_partner_enabled', 'yes' ),
102
  ),
103
  array(
104
  'name' => 'wcj_purchase_info_' . $product_id,
108
  'desc' => $desc,
109
  'product_id' => $product_id,
110
  'meta_name' => '_' . 'wcj_purchase_info',
111
+ 'enabled' => wcj_get_option( 'wcj_purchase_info_enabled', 'yes' ),
112
  ),
113
  ) );
114
  $product_options = apply_filters( 'wcj_purchase_data_product_options', $product_options, $product_id, $desc );
includes/settings/meta-box/wcj-settings-meta-box-related-products.php CHANGED
@@ -11,8 +11,8 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
  $product_id = get_the_ID();
13
  $products = wcj_get_products( array(), 'publish' );
14
- $is_chosen_select = ( 'chosen_select' === get_option( 'wcj_product_info_related_products_per_product_box_type', 'chosen_select' ) );
15
- $default_value = get_option( 'wcj_product_info_related_products_per_product_cmb_default', 'no' );
16
  unset( $products[ $product_id ] );
17
  $options = array(
18
  array(
11
 
12
  $product_id = get_the_ID();
13
  $products = wcj_get_products( array(), 'publish' );
14
+ $is_chosen_select = ( 'chosen_select' === wcj_get_option( 'wcj_product_info_related_products_per_product_box_type', 'chosen_select' ) );
15
+ $default_value = wcj_get_option( 'wcj_product_info_related_products_per_product_cmb_default', 'no' );
16
  unset( $products[ $product_id ] );
17
  $options = array(
18
  array(
includes/settings/meta-box/wcj-settings-meta-box-wholesale-price.php CHANGED
@@ -73,7 +73,7 @@ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_post_meta( $product_
73
  ),
74
  ) );
75
  }
76
- $user_roles = get_option( 'wcj_wholesale_price_by_user_role_roles', '' );
77
  if ( ! empty( $user_roles ) ) {
78
  foreach ( $user_roles as $user_role_key ) {
79
  $options = array_merge( $options, array(
73
  ),
74
  ) );
75
  }
76
+ $user_roles = wcj_get_option( 'wcj_wholesale_price_by_user_role_roles', '' );
77
  if ( ! empty( $user_roles ) ) {
78
  foreach ( $user_roles as $user_role_key ) {
79
  $options = array_merge( $options, array(
includes/settings/wcj-settings-add-to-cart.php CHANGED
@@ -44,7 +44,7 @@ if ( ! empty( $product_categories ) && ! is_wp_error( $product_categories ) ){
44
  $product_cats[ $product_category->term_id ] = $product_category->name;
45
  }
46
  }
47
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_add_to_cart_per_category_total_groups_number', 1 ) ); $i++ ) {
48
  $settings = array_merge( $settings, array(
49
  array(
50
  'title' => __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i,
44
  $product_cats[ $product_category->term_id ] = $product_category->name;
45
  }
46
  }
47
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_add_to_cart_per_category_total_groups_number', 1 ) ); $i++ ) {
48
  $settings = array_merge( $settings, array(
49
  array(
50
  'title' => __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i,
includes/settings/wcj-settings-admin-orders-list.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Settings - Admin Orders List
4
  *
5
- * @version 3.7.0
6
  * @since 3.2.4
7
  * @author Pluggabl LLC.
8
  */
@@ -49,7 +49,7 @@ $settings = array(
49
  ),
50
  ),
51
  );
52
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_orders_list_custom_columns_total_number', 1 ) );
53
  for ( $i = 1; $i <= $total_number; $i++ ) {
54
  $settings = array_merge( $settings, array(
55
  array(
@@ -76,7 +76,7 @@ for ( $i = 1; $i <= $total_number; $i++ ) {
76
  'css' => 'width:100%;',
77
  ),
78
  array(
79
- 'desc' => __( 'Sortable', 'woocommerce-jetpack' ),
80
  'id' => 'wcj_orders_list_custom_columns_sortable_' . $i,
81
  'default' => 'no',
82
  'type' => 'select',
@@ -87,7 +87,7 @@ for ( $i = 1; $i <= $total_number; $i++ ) {
87
  ),
88
  ),
89
  array(
90
- 'desc' => __( 'Key (if sortable)', 'woocommerce-jetpack' ),
91
  'id' => 'wcj_orders_list_custom_columns_sortable_key_' . $i,
92
  'default' => '',
93
  'type' => 'text',
@@ -165,7 +165,7 @@ $settings = array_merge( $settings, array(
165
  'custom_attributes' => apply_filters( 'booster_message', '', 'readonly' ),
166
  ),
167
  ) );
168
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_order_admin_list_multiple_status_presets_total_number', 1 ) );
169
  for ( $i = 1; $i <= $total_number; $i++ ) {
170
  $settings = array_merge( $settings, array(
171
  array(
2
  /**
3
  * Booster for WooCommerce - Settings - Admin Orders List
4
  *
5
+ * @version 5.3.3
6
  * @since 3.2.4
7
  * @author Pluggabl LLC.
8
  */
49
  ),
50
  ),
51
  );
52
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_orders_list_custom_columns_total_number', 1 ) );
53
  for ( $i = 1; $i <= $total_number; $i++ ) {
54
  $settings = array_merge( $settings, array(
55
  array(
76
  'css' => 'width:100%;',
77
  ),
78
  array(
79
+ 'desc' => __( 'Sortable , Select "By meta (as text)" for date sorting', 'woocommerce-jetpack' ),
80
  'id' => 'wcj_orders_list_custom_columns_sortable_' . $i,
81
  'default' => 'no',
82
  'type' => 'select',
87
  ),
88
  ),
89
  array(
90
+ 'desc' => sprintf( __( 'Key (if sortable) %s Add "_" (underscore) before key if the key is from "Checkout Custom Fields module"') , '</br>' , 'woocommerce-jetpack' ),
91
  'id' => 'wcj_orders_list_custom_columns_sortable_key_' . $i,
92
  'default' => '',
93
  'type' => 'text',
165
  'custom_attributes' => apply_filters( 'booster_message', '', 'readonly' ),
166
  ),
167
  ) );
168
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_order_admin_list_multiple_status_presets_total_number', 1 ) );
169
  for ( $i = 1; $i <= $total_number; $i++ ) {
170
  $settings = array_merge( $settings, array(
171
  array(
includes/settings/wcj-settings-admin-products-list.php CHANGED
@@ -35,7 +35,7 @@ $settings = array(
35
  ),
36
  ),
37
  );
38
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_products_admin_list_custom_columns_total_number', 1 ) );
39
  for ( $i = 1; $i <= $total_number; $i++ ) {
40
  $settings = array_merge( $settings, array(
41
  array(
35
  ),
36
  ),
37
  );
38
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_products_admin_list_custom_columns_total_number', 1 ) );
39
  for ( $i = 1; $i <= $total_number; $i++ ) {
40
  $settings = array_merge( $settings, array(
41
  array(
includes/settings/wcj-settings-cart.php CHANGED
@@ -33,7 +33,7 @@ $settings = array(
33
  'id' => 'wcj_cart_custom_info_options',
34
  ),
35
  );
36
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_cart_custom_info_total_number', 1 ) ); $i++ ) {
37
  $settings = array_merge( $settings, array(
38
  array(
39
  'title' => __( 'Info Block', 'woocommerce-jetpack' ) . ' #' . $i,
33
  'id' => 'wcj_cart_custom_info_options',
34
  ),
35
  );
36
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_cart_custom_info_total_number', 1 ) ); $i++ ) {
37
  $settings = array_merge( $settings, array(
38
  array(
39
  'title' => __( 'Info Block', 'woocommerce-jetpack' ) . ' #' . $i,
includes/settings/wcj-settings-checkout-custom-fields.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Settings - Checkout Custom Fields
4
  *
5
- * @version 5.2.0
6
  * @since 2.8.0
7
  * @author Pluggabl LLC.
8
  */
@@ -109,7 +109,7 @@ $settings = array(
109
  'id' => 'wcj_checkout_custom_fields_options',
110
  ),
111
  );
112
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
113
  $settings = array_merge( $settings,
114
  array(
115
  array(
@@ -121,7 +121,7 @@ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_checkou
121
  'title' => __( 'Enable/Disable', 'woocommerce-jetpack' ),
122
  'desc' => '<strong>' . __( 'Enable', 'woocommerce-jetpack' ) . '</strong>',
123
  'desc_tip' => __( 'Key', 'woocommerce-jetpack' ) . ': ' .
124
- '<code>' . get_option( 'wcj_checkout_custom_field_section_' . $i, 'billing' ) . '_' . 'wcj_checkout_field_' . $i . '</code>',
125
  'id' => 'wcj_checkout_custom_field_enabled_' . $i,
126
  'default' => 'no',
127
  'type' => 'checkbox',
@@ -277,7 +277,7 @@ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_checkou
277
  array(
278
  'title' => __( 'Datepicker/Weekpicker: Date Format', 'woocommerce-jetpack' ),
279
  'desc' => __( 'Visit <a href="https://codex.wordpress.org/Formatting_Date_and_Time" target="_blank">documentation on date and time formatting</a> for valid date formats', 'woocommerce-jetpack' ),
280
- 'desc_tip' => __( 'Leave blank to use your current WordPress format', 'woocommerce-jetpack' ) . ': ' . get_option( 'date_format' ),
281
  'id' => 'wcj_checkout_custom_field_datepicker_format_' . $i,
282
  'type' => 'text',
283
  'default' => '',
@@ -289,6 +289,14 @@ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_checkou
289
  'type' => 'number',
290
  'default' => -365,
291
  ),
 
 
 
 
 
 
 
 
292
  array(
293
  'title' => __( 'Datepicker/Weekpicker: Max Date', 'woocommerce-jetpack' ),
294
  'desc' => __( 'days', 'woocommerce-jetpack' ),
2
  /**
3
  * Booster for WooCommerce - Settings - Checkout Custom Fields
4
  *
5
+ * @version 5.3.3
6
  * @since 2.8.0
7
  * @author Pluggabl LLC.
8
  */
109
  'id' => 'wcj_checkout_custom_fields_options',
110
  ),
111
  );
112
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
113
  $settings = array_merge( $settings,
114
  array(
115
  array(
121
  'title' => __( 'Enable/Disable', 'woocommerce-jetpack' ),
122
  'desc' => '<strong>' . __( 'Enable', 'woocommerce-jetpack' ) . '</strong>',
123
  'desc_tip' => __( 'Key', 'woocommerce-jetpack' ) . ': ' .
124
+ '<code>' . wcj_get_option( 'wcj_checkout_custom_field_section_' . $i, 'billing' ) . '_' . 'wcj_checkout_field_' . $i . '</code>',
125
  'id' => 'wcj_checkout_custom_field_enabled_' . $i,
126
  'default' => 'no',
127
  'type' => 'checkbox',
277
  array(
278
  'title' => __( 'Datepicker/Weekpicker: Date Format', 'woocommerce-jetpack' ),
279
  'desc' => __( 'Visit <a href="https://codex.wordpress.org/Formatting_Date_and_Time" target="_blank">documentation on date and time formatting</a> for valid date formats', 'woocommerce-jetpack' ),
280
+ 'desc_tip' => __( 'Leave blank to use your current WordPress format', 'woocommerce-jetpack' ) . ': ' . get_option( 'date_format' ) . "</br>" . __( 'Use Y-m-d format if you want to use this field for sorting', 'woocommerce-jetpack' ),
281
  'id' => 'wcj_checkout_custom_field_datepicker_format_' . $i,
282
  'type' => 'text',
283
  'default' => '',
289
  'type' => 'number',
290
  'default' => -365,
291
  ),
292
+ array(
293
+ 'title' => __( 'Datepicker/Weekpicker: Current day time limit', 'woocommerce-jetpack' ),
294
+ 'desc_tip' => __( 'If the Min Date is 0, Today\'s date will be no longer available after selected time limit.', 'woocommerce-jetpack' ),
295
+ 'id' => 'wcj_checkout_custom_field_datepicker_current_day_time_limit_' . $i,
296
+ 'type' => 'time',
297
+ 'default' => "10:00",
298
+ 'css' => "width:400px",
299
+ ),
300
  array(
301
  'title' => __( 'Datepicker/Weekpicker: Max Date', 'woocommerce-jetpack' ),
302
  'desc' => __( 'days', 'woocommerce-jetpack' ),
includes/settings/wcj-settings-checkout-custom-info.php CHANGED
@@ -29,7 +29,7 @@ $settings = array(
29
  'id' => 'wcj_checkout_custom_info_blocks_options',
30
  ),
31
  );
32
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_custom_info_total_number', 1 ) );
33
  for ( $i = 1; $i <= $total_number; $i++ ) {
34
  $settings = array_merge( $settings, array(
35
  array(
29
  'id' => 'wcj_checkout_custom_info_blocks_options',
30
  ),
31
  );
32
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_custom_info_total_number', 1 ) );
33
  for ( $i = 1; $i <= $total_number; $i++ ) {
34
  $settings = array_merge( $settings, array(
35
  array(
includes/settings/wcj-settings-checkout-fees.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Settings - Checkout Fees
4
  *
5
- * @version 4.6.1
6
  * @since 3.7.0
7
  * @author Pluggabl LLC.
8
  */
@@ -28,11 +28,11 @@ $settings = array(
28
  'id' => 'wcj_checkout_fees_general_options',
29
  ),
30
  );
31
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_fees_total_number', 1 ) );
32
- $fees_titles = get_option( 'wcj_checkout_fees_data_titles', array() );
33
  $fees = array();
34
  for ( $i = 1; $i <= $total_number; $i ++ ) {
35
- $fees[ $i ] = $fees_titles[ $i ];
36
  }
37
 
38
  for ( $i = 1; $i <= $total_number; $i++ ) {
2
  /**
3
  * Booster for WooCommerce - Settings - Checkout Fees
4
  *
5
+ * @version 5.3.3
6
  * @since 3.7.0
7
  * @author Pluggabl LLC.
8
  */
28
  'id' => 'wcj_checkout_fees_general_options',
29
  ),
30
  );
31
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_fees_total_number', 1 ) );
32
+ $fees_titles = wcj_get_option( 'wcj_checkout_fees_data_titles', array() );
33
  $fees = array();
34
  for ( $i = 1; $i <= $total_number; $i ++ ) {
35
+ $fees[ $i ] = $fees_titles != null ? $fees_titles[ $i ] : '';
36
  }
37
 
38
  for ( $i = 1; $i <= $total_number; $i++ ) {
includes/settings/wcj-settings-checkout-files-upload.php CHANGED
@@ -31,7 +31,7 @@ $settings = array(
31
  ),
32
  ),
33
  );
34
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_checkout_files_upload_total_number', 1 ) );
35
  for ( $i = 1; $i <= $total_number; $i++ ) {
36
  $settings = array_merge( $settings, array(
37
  array(
@@ -267,7 +267,7 @@ $settings = array_merge( $settings, array(
267
  ),
268
  array(
269
  'title' => __( 'Send Additional Email to Admin on User Actions', 'woocommerce-jetpack' ),
270
- 'desc_tip' => sprintf( __( 'Admin email: <em>%s</em>.', 'woocommerce-jetpack' ), get_option( 'admin_email' ) ),
271
  'id' => 'wcj_checkout_files_upload_additional_admin_emails[actions]',
272
  'default' => array(),
273
  'type' => 'multiselect',
31
  ),
32
  ),
33
  );
34
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_checkout_files_upload_total_number', 1 ) );
35
  for ( $i = 1; $i <= $total_number; $i++ ) {
36
  $settings = array_merge( $settings, array(
37
  array(
267
  ),
268
  array(
269
  'title' => __( 'Send Additional Email to Admin on User Actions', 'woocommerce-jetpack' ),
270
+ 'desc_tip' => sprintf( __( 'Admin email: <em>%s</em>.', 'woocommerce-jetpack' ), wcj_get_option( 'admin_email' ) ),
271
  'id' => 'wcj_checkout_files_upload_additional_admin_emails[actions]',
272
  'default' => array(),
273
  'type' => 'multiselect',
includes/settings/wcj-settings-currency-exchange-rates.php CHANGED
@@ -12,8 +12,8 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
 
13
  $desc = '';
14
  if ( $this->is_enabled() ) {
15
- if ( '' != get_option( 'wcj_currency_exchange_rate_cron_time', '' ) ) {
16
- $scheduled_time_diff = get_option( 'wcj_currency_exchange_rate_cron_time', '' ) - time();
17
  if ( $scheduled_time_diff > 60 ) {
18
  $desc = '<br><em>' . sprintf( __( '%s till next update.', 'woocommerce-jetpack' ), human_time_diff( 0, $scheduled_time_diff ) ) . '</em>';
19
  } elseif ( $scheduled_time_diff > 0 ) {
@@ -155,7 +155,7 @@ $settings = array_merge( $settings, array(
155
  'custom_attributes' => apply_filters( 'booster_message', '', 'readonly' ),
156
  ),
157
  ) );
158
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_currency_exchange_custom_currencies_total_number', 1 ) );
159
  for ( $i = 1; $i <= $total_number; $i++ ) {
160
  $settings = array_merge( $settings, array(
161
  array(
12
 
13
  $desc = '';
14
  if ( $this->is_enabled() ) {
15
+ if ( '' != wcj_get_option( 'wcj_currency_exchange_rate_cron_time', '' ) ) {
16
+ $scheduled_time_diff = wcj_get_option( 'wcj_currency_exchange_rate_cron_time', '' ) - time();
17
  if ( $scheduled_time_diff > 60 ) {
18
  $desc = '<br><em>' . sprintf( __( '%s till next update.', 'woocommerce-jetpack' ), human_time_diff( 0, $scheduled_time_diff ) ) . '</em>';
19
  } elseif ( $scheduled_time_diff > 0 ) {
155
  'custom_attributes' => apply_filters( 'booster_message', '', 'readonly' ),
156
  ),
157
  ) );
158
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_currency_exchange_custom_currencies_total_number', 1 ) );
159
  for ( $i = 1; $i <= $total_number; $i++ ) {
160
  $settings = array_merge( $settings, array(
161
  array(
includes/settings/wcj-settings-currency-per-product.php CHANGED
@@ -152,21 +152,21 @@ $settings = array(
152
  ),
153
  ),
154
  );
155
- if ( 'yes' === get_option( 'wcj_currency_per_product_by_users_enabled', 'no' ) ) {
156
  $users_as_options = wcj_get_users_as_options();
157
  }
158
- if ( 'yes' === get_option( 'wcj_currency_per_product_by_user_roles_enabled', 'no' ) ) {
159
  $user_roles_as_options = wcj_get_user_roles_options();
160
  }
161
- if ( 'yes' === get_option( 'wcj_currency_per_product_by_product_cats_enabled', 'no' ) ) {
162
  $product_cats_as_options = wcj_get_terms( 'product_cat' );
163
  }
164
- if ( 'yes' === get_option( 'wcj_currency_per_product_by_product_tags_enabled', 'no' ) ) {
165
  $product_tags_as_options = wcj_get_terms( 'product_tag' );
166
  }
167
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_currency_per_product_total_number', 1 ) );
168
  for ( $i = 1; $i <= $total_number; $i++ ) {
169
- $currency_to = get_option( 'wcj_currency_per_product_currency_' . $i, $currency_from );
170
  $custom_attributes = array(
171
  'currency_from' => $currency_from,
172
  'currency_to' => $currency_to,
@@ -193,7 +193,7 @@ for ( $i = 1; $i <= $total_number; $i++ ) {
193
  'value' => $currency_from . '/' . $currency_to,
194
  ),
195
  ) );
196
- if ( 'yes' === get_option( 'wcj_currency_per_product_by_users_enabled', 'no' ) ) {
197
  $settings = array_merge( $settings, array(
198
  array(
199
  'desc' => __( 'Product Authors', 'woocommerce-jetpack' ),
@@ -205,7 +205,7 @@ for ( $i = 1; $i <= $total_number; $i++ ) {
205
  ),
206
  ) );
207
  }
208
- if ( 'yes' === get_option( 'wcj_currency_per_product_by_user_roles_enabled', 'no' ) ) {
209
  $settings = array_merge( $settings, array(
210
  array(
211
  'desc' => __( 'Product Authors User Roles', 'woocommerce-jetpack' ),
@@ -217,7 +217,7 @@ for ( $i = 1; $i <= $total_number; $i++ ) {
217
  ),
218
  ) );
219
  }
220
- if ( 'yes' === get_option( 'wcj_currency_per_product_by_product_cats_enabled', 'no' ) ) {
221
  $settings = array_merge( $settings, array(
222
  array(
223
  'desc' => __( 'Product Categories', 'woocommerce-jetpack' ),
@@ -229,7 +229,7 @@ for ( $i = 1; $i <= $total_number; $i++ ) {
229
  ),
230
  ) );
231
  }
232
- if ( 'yes' === get_option( 'wcj_currency_per_product_by_product_tags_enabled', 'no' ) ) {
233
  $settings = array_merge( $settings, array(
234
  array(
235
  'desc' => __( 'Product Tags', 'woocommerce-jetpack' ),
152
  ),
153
  ),
154
  );
155
+ if ( 'yes' === wcj_get_option( 'wcj_currency_per_product_by_users_enabled', 'no' ) ) {
156
  $users_as_options = wcj_get_users_as_options();
157
  }
158
+ if ( 'yes' === wcj_get_option( 'wcj_currency_per_product_by_user_roles_enabled', 'no' ) ) {
159
  $user_roles_as_options = wcj_get_user_roles_options();
160
  }
161
+ if ( 'yes' === wcj_get_option( 'wcj_currency_per_product_by_product_cats_enabled', 'no' ) ) {
162
  $product_cats_as_options = wcj_get_terms( 'product_cat' );
163
  }
164
+ if ( 'yes' === wcj_get_option( 'wcj_currency_per_product_by_product_tags_enabled', 'no' ) ) {
165
  $product_tags_as_options = wcj_get_terms( 'product_tag' );
166
  }
167
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_currency_per_product_total_number', 1 ) );
168
  for ( $i = 1; $i <= $total_number; $i++ ) {
169
+ $currency_to = wcj_get_option( 'wcj_currency_per_product_currency_' . $i, $currency_from );
170
  $custom_attributes = array(
171
  'currency_from' => $currency_from,
172
  'currency_to' => $currency_to,
193
  'value' => $currency_from . '/' . $currency_to,
194
  ),
195
  ) );
196
+ if ( 'yes' === wcj_get_option( 'wcj_currency_per_product_by_users_enabled', 'no' ) ) {
197
  $settings = array_merge( $settings, array(
198
  array(
199
  'desc' => __( 'Product Authors', 'woocommerce-jetpack' ),
205
  ),
206
  ) );
207
  }
208
+ if ( 'yes' === wcj_get_option( 'wcj_currency_per_product_by_user_roles_enabled', 'no' ) ) {
209
  $settings = array_merge( $settings, array(
210
  array(
211
  'desc' => __( 'Product Authors User Roles', 'woocommerce-jetpack' ),
217
  ),
218
  ) );
219
  }
220
+ if ( 'yes' === wcj_get_option( 'wcj_currency_per_product_by_product_cats_enabled', 'no' ) ) {
221
  $settings = array_merge( $settings, array(
222
  array(
223
  'desc' => __( 'Product Categories', 'woocommerce-jetpack' ),
229
  ),
230
  ) );
231
  }
232
+ if ( 'yes' === wcj_get_option( 'wcj_currency_per_product_by_product_tags_enabled', 'no' ) ) {
233
  $settings = array_merge( $settings, array(
234
  array(
235
  'desc' => __( 'Product Tags', 'woocommerce-jetpack' ),
includes/settings/wcj-settings-currency.php CHANGED
@@ -66,7 +66,7 @@ $settings = array_merge( $settings, array(
66
  'custom_attributes' => apply_filters( 'booster_message', '', 'readonly' ),
67
  ),
68
  ) );
69
- $custom_currency_total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_currency_custom_currency_total_number', 1 ) );
70
  for ( $i = 1; $i <= $custom_currency_total_number; $i++ ) {
71
  $settings = array_merge( $settings, array(
72
  array(
66
  'custom_attributes' => apply_filters( 'booster_message', '', 'readonly' ),
67
  ),
68
  ) );
69
+ $custom_currency_total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_currency_custom_currency_total_number', 1 ) );
70
  for ( $i = 1; $i <= $custom_currency_total_number; $i++ ) {
71
  $settings = array_merge( $settings, array(
72
  array(
includes/settings/wcj-settings-emails.php CHANGED
@@ -28,7 +28,7 @@ $settings = array(
28
  'custom_attributes' => apply_filters( 'booster_message', '', 'readonly' ),
29
  ),
30
  );
31
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_emails_custom_emails_total_number', 1 ) );
32
  for ( $i = 1; $i <= $total_number; $i++ ) {
33
  $settings = array_merge( $settings, array(
34
  array(
28
  'custom_attributes' => apply_filters( 'booster_message', '', 'readonly' ),
29
  ),
30
  );
31
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_emails_custom_emails_total_number', 1 ) );
32
  for ( $i = 1; $i <= $total_number; $i++ ) {
33
  $settings = array_merge( $settings, array(
34
  array(
includes/settings/wcj-settings-export.php CHANGED
@@ -70,7 +70,7 @@ $settings = array(
70
  ),
71
  ),
72
  );
73
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_export_orders_fields_additional_total_number', 1 ) );
74
  for ( $i = 1; $i <= $total_number; $i++ ) {
75
  $settings = array_merge( $settings, array(
76
  array(
@@ -138,7 +138,7 @@ $settings = array_merge( $settings, array(
138
  ),
139
  ),
140
  ) );
141
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_export_orders_items_fields_additional_total_number', 1 ) );
142
  for ( $i = 1; $i <= $total_number; $i++ ) {
143
  $settings = array_merge( $settings, array(
144
  array(
@@ -220,7 +220,7 @@ $settings = array_merge( $settings, array(
220
  ),
221
  ),
222
  ) );
223
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_export_products_fields_additional_total_number', 1 ) );
224
  for ( $i = 1; $i <= $total_number; $i++ ) {
225
  $settings = array_merge( $settings, array(
226
  array(
70
  ),
71
  ),
72
  );
73
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_export_orders_fields_additional_total_number', 1 ) );
74
  for ( $i = 1; $i <= $total_number; $i++ ) {
75
  $settings = array_merge( $settings, array(
76
  array(
138
  ),
139
  ),
140
  ) );
141
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_export_orders_items_fields_additional_total_number', 1 ) );
142
  for ( $i = 1; $i <= $total_number; $i++ ) {
143
  $settings = array_merge( $settings, array(
144
  array(
220
  ),
221
  ),
222
  ) );
223
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_export_products_fields_additional_total_number', 1 ) );
224
  for ( $i = 1; $i <= $total_number; $i++ ) {
225
  $settings = array_merge( $settings, array(
226
  array(
includes/settings/wcj-settings-global-discount.php CHANGED
@@ -9,7 +9,7 @@
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
- $is_multiselect_products = ( 'yes' === get_option( 'wcj_list_for_products', 'yes' ) );
13
 
14
  do_action( 'wcj_before_get_terms', $this->id );
15
  do_action( 'wcj_before_get_products', $this->id );
@@ -40,7 +40,7 @@ $settings = array(
40
  'id' => 'wcj_global_discount_options',
41
  ),
42
  );
43
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_global_discount_groups_total_number', 1 ) ); $i++ ) {
44
  wcj_maybe_convert_and_update_option_value( array(
45
  array( 'id' => 'wcj_global_discount_sale_products_incl_' . $i, 'default' => '' ),
46
  array( 'id' => 'wcj_global_discount_sale_products_excl_' . $i, 'default' => '' ),
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
+ $is_multiselect_products = ( 'yes' === wcj_get_option( 'wcj_list_for_products', 'yes' ) );
13
 
14
  do_action( 'wcj_before_get_terms', $this->id );
15
  do_action( 'wcj_before_get_products', $this->id );
40
  'id' => 'wcj_global_discount_options',
41
  ),
42
  );
43
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_global_discount_groups_total_number', 1 ) ); $i++ ) {
44
  wcj_maybe_convert_and_update_option_value( array(
45
  array( 'id' => 'wcj_global_discount_sale_products_incl_' . $i, 'default' => '' ),
46
  array( 'id' => 'wcj_global_discount_sale_products_excl_' . $i, 'default' => '' ),
includes/settings/wcj-settings-mini-cart.php CHANGED
@@ -28,7 +28,7 @@ $settings = array(
28
  'id' => 'wcj_mini_cart_custom_info_options',
29
  ),
30
  );
31
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_mini_cart_custom_info_total_number', 1 ) ); $i++ ) {
32
  $settings = array_merge( $settings, array(
33
  array(
34
  'title' => __( 'Info Block', 'woocommerce-jetpack' ) . ' #' . $i,
28
  'id' => 'wcj_mini_cart_custom_info_options',
29
  ),
30
  );
31
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_mini_cart_custom_info_total_number', 1 ) ); $i++ ) {
32
  $settings = array_merge( $settings, array(
33
  array(
34
  'title' => __( 'Info Block', 'woocommerce-jetpack' ) . ' #' . $i,
includes/settings/wcj-settings-multicurrency-base-price.php CHANGED
@@ -44,7 +44,7 @@ $settings = array(
44
  'desc' => __( 'rounding precision', 'woocommerce-jetpack' ),
45
  'desc_tip' => __( 'Number of decimals.', 'woocommerce-jetpack' ),
46
  'id' => 'wcj_multicurrency_base_price_round_precision',
47
- 'default' => get_option( 'woocommerce_price_num_decimals' ),
48
  'type' => 'number',
49
  'custom_attributes' => array( 'min' => 0 ),
50
  ),
@@ -126,9 +126,9 @@ $settings = array(
126
  ),
127
  ),
128
  );
129
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_multicurrency_base_price_total_number', 1 ) );
130
  for ( $i = 1; $i <= $total_number; $i++ ) {
131
- $currency_to = get_option( 'wcj_multicurrency_base_price_currency_' . $i, $currency_from );
132
  $custom_attributes = array(
133
  'currency_from' => $currency_from,
134
  'currency_to' => $currency_to,
44
  'desc' => __( 'rounding precision', 'woocommerce-jetpack' ),
45
  'desc_tip' => __( 'Number of decimals.', 'woocommerce-jetpack' ),
46
  'id' => 'wcj_multicurrency_base_price_round_precision',
47
+ 'default' => wcj_get_option( 'woocommerce_price_num_decimals' ),
48
  'type' => 'number',
49
  'custom_attributes' => array( 'min' => 0 ),
50
  ),
126
  ),
127
  ),
128
  );
129
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_multicurrency_base_price_total_number', 1 ) );
130
  for ( $i = 1; $i <= $total_number; $i++ ) {
131
+ $currency_to = wcj_get_option( 'wcj_multicurrency_base_price_currency_' . $i, $currency_from );
132
  $custom_attributes = array(
133
  'currency_from' => $currency_from,
134
  'currency_to' => $currency_to,
includes/settings/wcj-settings-multicurrency.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Settings - Multicurrency (Currency Switcher)
4
  *
5
- * @version 5.1.0
6
  * @since 2.8.0
7
  * @author Pluggabl LLC.
8
  * @todo "pretty prices"
@@ -85,7 +85,7 @@ $settings = array(
85
  'title' => __( 'Rounding Precision', 'woocommerce-jetpack' ),
86
  'desc_tip' => __( 'If rounding is enabled, set rounding precision here.', 'woocommerce-jetpack' ),
87
  'id' => 'wcj_multicurrency_rounding_precision',
88
- 'default' => absint( get_option( 'woocommerce_price_num_decimals', 2 ) ),
89
  'type' => 'number',
90
  'custom_attributes' => array( 'min' => 0 ),
91
  ),
@@ -116,6 +116,15 @@ $settings = array(
116
  'type' => 'title',
117
  'id' => 'wcj_multicurrency_compatibility',
118
  ),
 
 
 
 
 
 
 
 
 
119
  /*array(
120
  'title' => __( 'Prices and Currencies by Country Module', 'woocommerce-jetpack' ),
121
  'desc' => __( 'Enable', 'woocommerce-jetpack' ),
@@ -289,9 +298,9 @@ $settings = array(
289
  ),
290
  ),
291
  );
292
- $total_number = apply_filters( 'booster_option', 2, get_option( 'wcj_multicurrency_total_number', 2 ) );
293
  for ( $i = 1; $i <= $total_number; $i++ ) {
294
- $currency_to = get_option( 'wcj_multicurrency_currency_' . $i, $currency_from );
295
  $custom_attributes = array(
296
  'currency_from' => $currency_from,
297
  'currency_to' => $currency_to,
@@ -325,6 +334,43 @@ $settings = array_merge( $settings, array(
325
  'id' => 'wcj_multicurrency_currencies_options',
326
  ),
327
  ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  $settings = array_merge( $settings, array(
329
  array(
330
  'title' => __( 'Role Defaults', 'woocommerce-jetpack' ),
@@ -345,11 +391,11 @@ $settings = array_merge( $settings, array(
345
  ) );
346
  $module_currencies = array();
347
  for ( $i = 1; $i <= $total_number; $i++ ) {
348
- $currency_code = get_option( 'wcj_multicurrency_currency_' . $i, $currency_from );
349
  $module_currencies[ $currency_code ] = $all_currencies[ $currency_code ];
350
  }
351
  $module_currencies = array_unique( $module_currencies );
352
- $module_roles = get_option( 'wcj_multicurrency_role_defaults_roles', '' );
353
  if ( ! empty( $module_roles ) ) {
354
  foreach ( $module_roles as $role_key ) { // wcj_get_user_roles() as $role_key => $role_data
355
  $settings = array_merge( $settings, array(
2
  /**
3
  * Booster for WooCommerce - Settings - Multicurrency (Currency Switcher)
4
  *
5
+ * @version 5.3.4
6
  * @since 2.8.0
7
  * @author Pluggabl LLC.
8
  * @todo "pretty prices"
85
  'title' => __( 'Rounding Precision', 'woocommerce-jetpack' ),
86
  'desc_tip' => __( 'If rounding is enabled, set rounding precision here.', 'woocommerce-jetpack' ),
87
  'id' => 'wcj_multicurrency_rounding_precision',
88
+ 'default' => absint( wcj_get_option( 'woocommerce_price_num_decimals', 2 ) ),
89
  'type' => 'number',
90
  'custom_attributes' => array( 'min' => 0 ),
91
  ),
116
  'type' => 'title',
117
  'id' => 'wcj_multicurrency_compatibility',
118
  ),
119
+ array(
120
+ 'title' => __( 'Free Shipping', 'woocommerce-jetpack' ),
121
+ 'desc' => empty( $message = apply_filters( 'booster_message', '', 'desc' ) ) ? __( 'Enable', 'woocommerce-jetpack' ) : $message,
122
+ 'custom_attributes' => apply_filters( 'booster_message', '', 'disabled' ),
123
+ 'desc_tip' => __( 'Converts minimum amount from WooCommerce Free Shipping native method.', 'woocommerce-jetpack' ),
124
+ 'id' => 'wcj_multicurrency_compatibility_free_shipping',
125
+ 'default' => 'no',
126
+ 'type' => 'checkbox',
127
+ ),
128
  /*array(
129
  'title' => __( 'Prices and Currencies by Country Module', 'woocommerce-jetpack' ),
130
  'desc' => __( 'Enable', 'woocommerce-jetpack' ),
298
  ),
299
  ),
300
  );
301
+ $total_number = apply_filters( 'booster_option', 2, wcj_get_option( 'wcj_multicurrency_total_number', 2 ) );
302
  for ( $i = 1; $i <= $total_number; $i++ ) {
303
+ $currency_to = wcj_get_option( 'wcj_multicurrency_currency_' . $i, $currency_from );
304
  $custom_attributes = array(
305
  'currency_from' => $currency_from,
306
  'currency_to' => $currency_to,
334
  'id' => 'wcj_multicurrency_currencies_options',
335
  ),
336
  ) );
337
+
338
+ // Default currency
339
+ $currencies = array();
340
+ for ( $i = 1; $i <= $total_number; $i ++ ) {
341
+ $currency_to = wcj_get_option( 'wcj_multicurrency_currency_' . $i, $currency_from );
342
+ $currencies[ $i ] = $all_currencies[ $currency_to ];
343
+ }
344
+ $settings = array_merge( $settings, array(
345
+ array(
346
+ 'title' => __( 'Default Currency', 'woocommerce-jetpack' ),
347
+ 'type' => 'title',
348
+ 'desc' => __( 'The default currency displayed on frontend.', 'woocommerce-jetpack' ),
349
+ 'id' => 'wcj_multicurrency_default_currency_opt',
350
+ ),
351
+ array(
352
+ 'title' => __( 'Currency', 'woocommerce-jetpack' ),
353
+ 'id' => 'wcj_multicurrency_default_currency',
354
+ 'default' => 1,
355
+ 'type' => 'select',
356
+ 'options' => $currencies,
357
+ 'desc' => '',
358
+ 'desc_tip' => __( 'The default currency will only be set if the current user hasn\'t selected it yet.', 'woocommerce-jetpack' ),
359
+ ),
360
+ array(
361
+ 'title' => __( 'Force', 'woocommerce-jetpack' ),
362
+ 'id' => 'wcj_multicurrency_default_currency_force',
363
+ 'default' => 'no',
364
+ 'type' => 'checkbox',
365
+ 'desc' => __( 'Enable', 'woocommerce-jetpack' ),
366
+ 'desc_tip' => __( 'If enabled, the default currency will be fixed and users won\'t be able to change it.', 'woocommerce-jetpack' ),
367
+ ),
368
+ array(
369
+ 'type' => 'sectionend',
370
+ 'id' => 'wcj_multicurrency_default_currency_opt',
371
+ ),
372
+ ));
373
+
374
  $settings = array_merge( $settings, array(
375
  array(
376
  'title' => __( 'Role Defaults', 'woocommerce-jetpack' ),
391
  ) );
392
  $module_currencies = array();
393
  for ( $i = 1; $i <= $total_number; $i++ ) {
394
+ $currency_code = wcj_get_option( 'wcj_multicurrency_currency_' . $i, $currency_from );
395
  $module_currencies[ $currency_code ] = $all_currencies[ $currency_code ];
396
  }
397
  $module_currencies = array_unique( $module_currencies );
398
+ $module_roles = wcj_get_option( 'wcj_multicurrency_role_defaults_roles', '' );
399
  if ( ! empty( $module_roles ) ) {
400
  foreach ( $module_roles as $role_key ) { // wcj_get_user_roles() as $role_key => $role_data
401
  $settings = array_merge( $settings, array(
includes/settings/wcj-settings-my-account.php CHANGED
@@ -150,7 +150,7 @@ $settings = array_merge( $settings, array(
150
  'id' => 'wcj_my_account_custom_pages_main_options',
151
  ),
152
  ) );
153
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_my_account_custom_pages_total_number', 1 ) ); $i++ ) {
154
  $settings = array_merge( $settings, array(
155
  array(
156
  'title' => __( 'Custom Page', 'woocommerce-jetpack' ) . ' #' . $i,
@@ -250,7 +250,7 @@ $settings = array_merge( $settings, array(
250
  'id' => 'wcj_my_account_custom_info_options',
251
  ),
252
  ) );
253
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_my_account_custom_info_total_number', 1 ) ); $i++ ) {
254
  $settings = array_merge( $settings, array(
255
  array(
256
  'title' => __( 'Info Block', 'woocommerce-jetpack' ) . ' #' . $i,
150
  'id' => 'wcj_my_account_custom_pages_main_options',
151
  ),
152
  ) );
153
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_my_account_custom_pages_total_number', 1 ) ); $i++ ) {
154
  $settings = array_merge( $settings, array(
155
  array(
156
  'title' => __( 'Custom Page', 'woocommerce-jetpack' ) . ' #' . $i,
250
  'id' => 'wcj_my_account_custom_info_options',
251
  ),
252
  ) );
253
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_my_account_custom_info_total_number', 1 ) ); $i++ ) {
254
  $settings = array_merge( $settings, array(
255
  array(
256
  'title' => __( 'Info Block', 'woocommerce-jetpack' ) . ' #' . $i,
includes/settings/wcj-settings-offer-price.php CHANGED
@@ -168,7 +168,7 @@ return array(
168
  'desc_tip' => __( 'Number of decimals', 'woocommerce' ),
169
  'id' => 'wcj_offer_price_price_step',
170
  'type' => 'number',
171
- 'default' => get_option( 'woocommerce_price_num_decimals' ),
172
  'custom_attributes' => array( 'min' => 0 ),
173
  ),
174
  array(
@@ -316,7 +316,7 @@ return array(
316
  sprintf(
317
  __( 'Use %s to send to administrator email: %s.',
318
  'woocommerce-jetpack' ), '<code>' . '%admin_email%' . '</code>',
319
- '<code>' . get_option( 'admin_email' ) . '</code>'
320
  ) . ' ' .
321
  wcj_message_replaced_values( array( '%admin_email%', '%product_author_email%' ) ),
322
  'id' => 'wcj_offer_price_email_address',
168
  'desc_tip' => __( 'Number of decimals', 'woocommerce' ),
169
  'id' => 'wcj_offer_price_price_step',
170
  'type' => 'number',
171
+ 'default' => wcj_get_option( 'woocommerce_price_num_decimals' ),
172
  'custom_attributes' => array( 'min' => 0 ),
173
  ),
174
  array(
316
  sprintf(
317
  __( 'Use %s to send to administrator email: %s.',
318
  'woocommerce-jetpack' ), '<code>' . '%admin_email%' . '</code>',
319
+ '<code>' . wcj_get_option( 'admin_email' ) . '</code>'
320
  ) . ' ' .
321
  wcj_message_replaced_values( array( '%admin_email%', '%product_author_email%' ) ),
322
  'id' => 'wcj_offer_price_email_address',
includes/settings/wcj-settings-order-custom-statuses.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce Settings - Order Custom Statuses
4
  *
5
- * @version 4.8.0
6
  * @since 2.8.0
7
  * @author Pluggabl LLC.
8
  */
@@ -24,6 +24,14 @@ return array(
24
  'type' => 'select',
25
  'options' => array_merge( array( 'wcj_no_changes' => __( 'No changes', 'woocommerce-jetpack' ) ), wcj_get_order_statuses() ),
26
  ),
 
 
 
 
 
 
 
 
27
  array(
28
  'title' => __( 'Add All Statuses to Admin Order Bulk Actions', 'woocommerce-jetpack' ),
29
  'desc' => __( 'Add', 'woocommerce-jetpack' ),
2
  /**
3
  * Booster for WooCommerce Settings - Order Custom Statuses
4
  *
5
+ * @version 5.3.3
6
  * @since 2.8.0
7
  * @author Pluggabl LLC.
8
  */
24
  'type' => 'select',
25
  'options' => array_merge( array( 'wcj_no_changes' => __( 'No changes', 'woocommerce-jetpack' ) ), wcj_get_order_statuses() ),
26
  ),
27
+ array(
28
+ 'title' => __( 'Set Default Order Status Forcefully', 'woocommerce-jetpack' ),
29
+ 'desc' => __( 'Enable', 'woocommerce-jetpack' ),
30
+ 'desc_tip' => __( 'You can set the default order status forcefully from here. Forcing the status can result in unpredictable consequences, enable the checkbox here.', 'woocommerce-jetpack' ),
31
+ 'id' => 'wcj_orders_custom_statuses_default_status_forcefully',
32
+ 'default' => 'no',
33
+ 'type' => 'checkbox',
34
+ ),
35
  array(
36
  'title' => __( 'Add All Statuses to Admin Order Bulk Actions', 'woocommerce-jetpack' ),
37
  'desc' => __( 'Add', 'woocommerce-jetpack' ),
includes/settings/wcj-settings-order-quantities.php CHANGED
@@ -10,7 +10,7 @@
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
 
13
- $qty_step_settings = ( 'yes' === get_option( 'wcj_order_quantities_decimal_qty_enabled', 'no' ) ? '0.000001' : '1' );
14
 
15
  return array(
16
  array(
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
 
13
+ $qty_step_settings = ( 'yes' === wcj_get_option( 'wcj_order_quantities_decimal_qty_enabled', 'no' ) ? '0.000001' : '1' );
14
 
15
  return array(
16
  array(
includes/settings/wcj-settings-orders.php CHANGED
@@ -10,7 +10,7 @@
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
  $bulk_regenerate_download_permissions_all_orders_cron_desc = '';
13
- if ( $this->is_enabled() && 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_order_bulk_regenerate_download_permissions_enabled', 'no' ) ) ) {
14
  $bulk_regenerate_download_permissions_all_orders_cron_desc = wcj_crons_get_next_event_time_message( 'wcj_bulk_regenerate_download_permissions_all_orders_cron_time' );
15
  }
16
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
  $bulk_regenerate_download_permissions_all_orders_cron_desc = '';
13
+ if ( $this->is_enabled() && 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_order_bulk_regenerate_download_permissions_enabled', 'no' ) ) ) {
14
  $bulk_regenerate_download_permissions_all_orders_cron_desc = wcj_crons_get_next_event_time_message( 'wcj_bulk_regenerate_download_permissions_all_orders_cron_time' );
15
  }
16
 
includes/settings/wcj-settings-payment-gateways-by-shipping.php CHANGED
@@ -10,7 +10,7 @@
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
 
13
- $use_shipping_instance = ( 'yes' === get_option( 'wcj_payment_gateways_by_shipping_use_shipping_instance', 'no' ) );
14
  $shipping_methods = ( $use_shipping_instance ? wcj_get_shipping_methods_instances() : wcj_get_shipping_methods() );
15
  $settings = array(
16
  array(
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
 
13
+ $use_shipping_instance = ( 'yes' === wcj_get_option( 'wcj_payment_gateways_by_shipping_use_shipping_instance', 'no' ) );
14
  $shipping_methods = ( $use_shipping_instance ? wcj_get_shipping_methods_instances() : wcj_get_shipping_methods() );
15
  $settings = array(
16
  array(
includes/settings/wcj-settings-payment-gateways-currency.php CHANGED
@@ -21,7 +21,7 @@ $settings = array(
21
  $currency_from = get_woocommerce_currency();
22
  $available_gateways = WC()->payment_gateways->payment_gateways();
23
  foreach ( $available_gateways as $key => $gateway ) {
24
- $currency_to = get_option( 'wcj_gateways_currency_' . $key, get_woocommerce_currency() );
25
  $custom_attributes = array(
26
  'currency_from' => $currency_from,
27
  'currency_to' => $currency_to,
21
  $currency_from = get_woocommerce_currency();
22
  $available_gateways = WC()->payment_gateways->payment_gateways();
23
  foreach ( $available_gateways as $key => $gateway ) {
24
+ $currency_to = wcj_get_option( 'wcj_gateways_currency_' . $key, get_woocommerce_currency() );
25
  $custom_attributes = array(
26
  'currency_from' => $currency_from,
27
  'currency_to' => $currency_to,
includes/settings/wcj-settings-payment-gateways-fees.php CHANGED
@@ -93,7 +93,7 @@ foreach ( $available_gateways as $key => $gateway ) {
93
  'desc' => __( 'Number of decimals', 'woocommerce-jetpack' ),
94
  'desc_tip' => __( 'If rounding is enabled, set precision (i.e. number of decimals) here.', 'woocommerce-jetpack' ),
95
  'id' => "wcj_gateways_fees_round_precision[{$key}]",
96
- 'default' => get_option( 'woocommerce_price_num_decimals', 2 ),
97
  'type' => 'number',
98
  'custom_attributes' => array( 'step' => '1', 'min' => '0' ),
99
  ),
93
  'desc' => __( 'Number of decimals', 'woocommerce-jetpack' ),
94
  'desc_tip' => __( 'If rounding is enabled, set precision (i.e. number of decimals) here.', 'woocommerce-jetpack' ),
95
  'id' => "wcj_gateways_fees_round_precision[{$key}]",
96
+ 'default' => wcj_get_option( 'woocommerce_price_num_decimals', 2 ),
97
  'type' => 'number',
98
  'custom_attributes' => array( 'step' => '1', 'min' => '0' ),
99
  ),
includes/settings/wcj-settings-payment-gateways-icons.php CHANGED
@@ -27,7 +27,7 @@ foreach ( $available_gateways as $key => $gateway ) {
27
  $custom_attributes = array();
28
  $desc_tip = '';
29
  }
30
- $current_icon_url = get_option( 'wcj_gateways_icons_' . $key . '_icon', '' );
31
  $desc = ( '' != $current_icon_url ) ? '<img width="16" src="' . $current_icon_url . '" alt="' . $gateway->title . '" title="' . $gateway->title . '" />' : '';
32
  $settings = array_merge( $settings, array(
33
  array(
27
  $custom_attributes = array();
28
  $desc_tip = '';
29
  }
30
+ $current_icon_url = wcj_get_option( 'wcj_gateways_icons_' . $key . '_icon', '' );
31
  $desc = ( '' != $current_icon_url ) ? '<img width="16" src="' . $current_icon_url . '" alt="' . $gateway->title . '" title="' . $gateway->title . '" />' : '';
32
  $settings = array_merge( $settings, array(
33
  array(
includes/settings/wcj-settings-payment-gateways-per-category.php CHANGED
@@ -10,8 +10,8 @@
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
  $product_cats = wcj_get_terms( 'product_cat' );
13
- $is_multiselect_products = ( 'yes' === get_option( 'wcj_list_for_products', 'yes' ) );
14
- $do_use_variations = ( 'yes' === get_option( 'wcj_gateways_per_category_use_variations', 'no' ) );
15
  $products = ( $is_multiselect_products ? wcj_get_products( array(), 'any', 512, $do_use_variations, $do_use_variations ) : false );
16
  $available_gateways = WC()->payment_gateways->payment_gateways();
17
  $settings = array(
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
  $product_cats = wcj_get_terms( 'product_cat' );
13
+ $is_multiselect_products = ( 'yes' === wcj_get_option( 'wcj_list_for_products', 'yes' ) );
14
+ $do_use_variations = ( 'yes' === wcj_get_option( 'wcj_gateways_per_category_use_variations', 'no' ) );
15
  $products = ( $is_multiselect_products ? wcj_get_products( array(), 'any', 512, $do_use_variations, $do_use_variations ) : false );
16
  $available_gateways = WC()->payment_gateways->payment_gateways();
17
  $settings = array(
includes/settings/wcj-settings-payment-gateways.php CHANGED
@@ -30,7 +30,7 @@ $settings = array(
30
  apply_filters( 'booster_message', '', 'readonly' ) : array( 'step' => '1', 'min' => '1' ),
31
  ),
32
  );
33
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_custom_payment_gateways_number', 1 ) ); $i++ ) {
34
  $settings = array_merge( $settings, array(
35
  array(
36
  'title' => __( 'Admin Title Custom Gateway', 'woocommerce-jetpack' ) . ' #' . $i,
30
  apply_filters( 'booster_message', '', 'readonly' ) : array( 'step' => '1', 'min' => '1' ),
31
  ),
32
  );
33
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_custom_payment_gateways_number', 1 ) ); $i++ ) {
34
  $settings = array_merge( $settings, array(
35
  array(
36
  'title' => __( 'Admin Title Custom Gateway', 'woocommerce-jetpack' ) . ' #' . $i,
includes/settings/wcj-settings-pdf-invoicing-advanced.php CHANGED
@@ -12,26 +12,26 @@
12
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
13
 
14
  $is_full_fonts = wcj_check_and_maybe_download_tcpdf_fonts();
15
- if ( 'yes' === get_option( 'wcj_invoicing_fonts_manager_do_not_download', 'no' ) ) {
16
  $fonts_manager_desc = __( 'Fonts download is disabled.', 'woocommerce-jetpack' );
17
  } else {
18
  if ( $is_full_fonts ) {
19
  $fonts_manager_desc = __( 'Fonts are up to date.', 'woocommerce-jetpack' ) . ' ' . sprintf(
20
  __( 'Latest successful download or version check was on %s.', 'woocommerce-jetpack' ),
21
- date( 'Y-m-d H:i:s', get_option( 'wcj_invoicing_fonts_version_timestamp', null ) )
22
  );
23
  } else {
24
  $fonts_manager_desc = __( 'Fonts are NOT up to date. Please try downloading by pressing the button below.', 'woocommerce-jetpack' );
25
- if ( null != get_option( 'wcj_invoicing_fonts_version', null ) ) {
26
  $fonts_manager_desc .= ' ' . sprintf(
27
  __( 'Latest successful downloaded version is %s.', 'woocommerce-jetpack' ),
28
  get_option( 'wcj_invoicing_fonts_version', null )
29
  );
30
  }
31
- if ( null != get_option( 'wcj_invoicing_fonts_version_timestamp', null ) ) {
32
  $fonts_manager_desc .= ' ' . sprintf(
33
  __( 'Latest download executed on %s.', 'woocommerce-jetpack' ),
34
- date( 'Y-m-d H:i:s', get_option( 'wcj_invoicing_fonts_version_timestamp', null ) )
35
  );
36
  }
37
  }
12
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
13
 
14
  $is_full_fonts = wcj_check_and_maybe_download_tcpdf_fonts();
15
+ if ( 'yes' === wcj_get_option( 'wcj_invoicing_fonts_manager_do_not_download', 'no' ) ) {
16
  $fonts_manager_desc = __( 'Fonts download is disabled.', 'woocommerce-jetpack' );
17
  } else {
18
  if ( $is_full_fonts ) {
19
  $fonts_manager_desc = __( 'Fonts are up to date.', 'woocommerce-jetpack' ) . ' ' . sprintf(
20
  __( 'Latest successful download or version check was on %s.', 'woocommerce-jetpack' ),
21
+ date( 'Y-m-d H:i:s', wcj_get_option( 'wcj_invoicing_fonts_version_timestamp', null ) )
22
  );
23
  } else {
24
  $fonts_manager_desc = __( 'Fonts are NOT up to date. Please try downloading by pressing the button below.', 'woocommerce-jetpack' );
25
+ if ( null != wcj_get_option( 'wcj_invoicing_fonts_version', null ) ) {
26
  $fonts_manager_desc .= ' ' . sprintf(
27
  __( 'Latest successful downloaded version is %s.', 'woocommerce-jetpack' ),
28
  get_option( 'wcj_invoicing_fonts_version', null )
29
  );
30
  }
31
+ if ( null != wcj_get_option( 'wcj_invoicing_fonts_version_timestamp', null ) ) {
32
  $fonts_manager_desc .= ' ' . sprintf(
33
  __( 'Latest download executed on %s.', 'woocommerce-jetpack' ),
34
+ date( 'Y-m-d H:i:s', wcj_get_option( 'wcj_invoicing_fonts_version_timestamp', null ) )
35
  );
36
  }
37
  }
includes/settings/wcj-settings-pdf-invoicing-display.php CHANGED
@@ -11,7 +11,7 @@
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
 
13
  $settings = array();
14
- $invoice_types = ( 'yes' === get_option( 'wcj_invoicing_hide_disabled_docs_settings', 'no' ) ) ? wcj_get_enabled_invoice_types() : wcj_get_invoice_types();
15
  foreach ( $invoice_types as $invoice_type ) {
16
  $document_number_shortode = ( isset( $invoice_type['is_custom_doc'] ) && true === $invoice_type['is_custom_doc'] ?
17
  '[wcj_custom_doc_number doc_nr="' . $invoice_type['custom_doc_nr'] . '"]' : '[wcj_' . $invoice_type['id'] . '_number]' );
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
 
13
  $settings = array();
14
+ $invoice_types = ( 'yes' === wcj_get_option( 'wcj_invoicing_hide_disabled_docs_settings', 'no' ) ) ? wcj_get_enabled_invoice_types() : wcj_get_invoice_types();
15
  foreach ( $invoice_types as $invoice_type ) {
16
  $document_number_shortode = ( isset( $invoice_type['is_custom_doc'] ) && true === $invoice_type['is_custom_doc'] ?
17
  '[wcj_custom_doc_number doc_nr="' . $invoice_type['custom_doc_nr'] . '"]' : '[wcj_' . $invoice_type['id'] . '_number]' );
includes/settings/wcj-settings-pdf-invoicing-emails.php CHANGED
@@ -28,7 +28,7 @@ foreach ( $available_gateways as $key => $gateway ) {
28
  'customer_reset_password' => __( 'Customer - Reset Password', 'woocommerce-jetpack' ),
29
  );
30
  if ( wcj_is_module_enabled( 'emails' ) ) {
31
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_emails_custom_emails_total_number', 1 ) ); $i++ ) {
32
  $available_emails[ 'wcj_custom' . '_' . $i ] = __( 'Custom', 'woocommerce-jetpack' ) . ' #' . $i;
33
  }
34
  } */
@@ -40,7 +40,7 @@ foreach ( $wc_emails as $wc_email ) {
40
  }
41
  }
42
  $settings = array();
43
- $invoice_types = ( 'yes' === get_option( 'wcj_invoicing_hide_disabled_docs_settings', 'no' ) ) ? wcj_get_enabled_invoice_types() : wcj_get_invoice_types();
44
  foreach ( $invoice_types as $invoice_type ) {
45
  $settings = array_merge( $settings, array(
46
  array(
28
  'customer_reset_password' => __( 'Customer - Reset Password', 'woocommerce-jetpack' ),
29
  );
30
  if ( wcj_is_module_enabled( 'emails' ) ) {
31
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_emails_custom_emails_total_number', 1 ) ); $i++ ) {
32
  $available_emails[ 'wcj_custom' . '_' . $i ] = __( 'Custom', 'woocommerce-jetpack' ) . ' #' . $i;
33
  }
34
  } */
40
  }
41
  }
42
  $settings = array();
43
+ $invoice_types = ( 'yes' === wcj_get_option( 'wcj_invoicing_hide_disabled_docs_settings', 'no' ) ) ? wcj_get_enabled_invoice_types() : wcj_get_invoice_types();
44
  foreach ( $invoice_types as $invoice_type ) {
45
  $settings = array_merge( $settings, array(
46
  array(
includes/settings/wcj-settings-pdf-invoicing-footer.php CHANGED
@@ -10,7 +10,7 @@
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
  $settings = array();
13
- $invoice_types = ( 'yes' === get_option( 'wcj_invoicing_hide_disabled_docs_settings', 'no' ) ) ? wcj_get_enabled_invoice_types() : wcj_get_invoice_types();
14
  foreach ( $invoice_types as $invoice_type ) {
15
  $settings = array_merge( $settings, array(
16
  array(
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
  $settings = array();
13
+ $invoice_types = ( 'yes' === wcj_get_option( 'wcj_invoicing_hide_disabled_docs_settings', 'no' ) ) ? wcj_get_enabled_invoice_types() : wcj_get_invoice_types();
14
  foreach ( $invoice_types as $invoice_type ) {
15
  $settings = array_merge( $settings, array(
16
  array(
includes/settings/wcj-settings-pdf-invoicing-header.php CHANGED
@@ -11,7 +11,7 @@
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
 
13
  $settings = array();
14
- $invoice_types = ( 'yes' === get_option( 'wcj_invoicing_hide_disabled_docs_settings', 'no' ) ) ? wcj_get_enabled_invoice_types() : wcj_get_invoice_types();
15
  foreach ( $invoice_types as $invoice_type ) {
16
  $settings = array_merge( $settings, array(
17
  array(
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
 
13
  $settings = array();
14
+ $invoice_types = ( 'yes' === wcj_get_option( 'wcj_invoicing_hide_disabled_docs_settings', 'no' ) ) ? wcj_get_enabled_invoice_types() : wcj_get_invoice_types();
15
  foreach ( $invoice_types as $invoice_type ) {
16
  $settings = array_merge( $settings, array(
17
  array(
includes/settings/wcj-settings-pdf-invoicing-numbering.php CHANGED
@@ -10,7 +10,7 @@
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
  $settings = array();
13
- $invoice_types = ( 'yes' === get_option( 'wcj_invoicing_hide_disabled_docs_settings', 'no' ) ? wcj_get_enabled_invoice_types() : wcj_get_invoice_types() );
14
  foreach ( $invoice_types as $invoice_type ) {
15
  $settings = array_merge( $settings, array(
16
  array(
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
  $settings = array();
13
+ $invoice_types = ( 'yes' === wcj_get_option( 'wcj_invoicing_hide_disabled_docs_settings', 'no' ) ? wcj_get_enabled_invoice_types() : wcj_get_invoice_types() );
14
  foreach ( $invoice_types as $invoice_type ) {
15
  $settings = array_merge( $settings, array(
16
  array(
includes/settings/wcj-settings-pdf-invoicing-page.php CHANGED
@@ -10,7 +10,7 @@
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
  $settings = array();
13
- $invoice_types = ( 'yes' === get_option( 'wcj_invoicing_hide_disabled_docs_settings', 'no' ) ) ? wcj_get_enabled_invoice_types() : wcj_get_invoice_types();
14
  foreach ( $invoice_types as $invoice_type ) {
15
  $settings = array_merge( $settings, array(
16
  array(
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
  $settings = array();
13
+ $invoice_types = ( 'yes' === wcj_get_option( 'wcj_invoicing_hide_disabled_docs_settings', 'no' ) ) ? wcj_get_enabled_invoice_types() : wcj_get_invoice_types();
14
  foreach ( $invoice_types as $invoice_type ) {
15
  $settings = array_merge( $settings, array(
16
  array(
includes/settings/wcj-settings-pdf-invoicing-styling.php CHANGED
@@ -11,7 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
  $is_full_fonts = wcj_check_and_maybe_download_tcpdf_fonts();
13
  $settings = array();
14
- $invoice_types = ( 'yes' === get_option( 'wcj_invoicing_hide_disabled_docs_settings', 'no' ) ) ? wcj_get_enabled_invoice_types() : wcj_get_invoice_types();
15
  foreach ( $invoice_types as $invoice_type ) {
16
  // Font family
17
  $font_family_option = ( $is_full_fonts ?
11
 
12
  $is_full_fonts = wcj_check_and_maybe_download_tcpdf_fonts();
13
  $settings = array();
14
+ $invoice_types = ( 'yes' === wcj_get_option( 'wcj_invoicing_hide_disabled_docs_settings', 'no' ) ) ? wcj_get_enabled_invoice_types() : wcj_get_invoice_types();
15
  foreach ( $invoice_types as $invoice_type ) {
16
  // Font family
17
  $font_family_option = ( $is_full_fonts ?
includes/settings/wcj-settings-pdf-invoicing-templates.php CHANGED
@@ -16,7 +16,7 @@ $tip = sprintf( __( 'For the list of available shortcodes, please visit %s.', 'w
16
  );
17
 
18
  $settings = array();
19
- $invoice_types = ( 'yes' === get_option( 'wcj_invoicing_hide_disabled_docs_settings', 'no' ) ) ? wcj_get_enabled_invoice_types() : wcj_get_invoice_types();
20
  foreach ( $invoice_types as $invoice_type ) {
21
  $settings = array_merge( $settings, array(
22
  array(
16
  );
17
 
18
  $settings = array();
19
+ $invoice_types = ( 'yes' === wcj_get_option( 'wcj_invoicing_hide_disabled_docs_settings', 'no' ) ) ? wcj_get_enabled_invoice_types() : wcj_get_invoice_types();
20
  foreach ( $invoice_types as $invoice_type ) {
21
  $settings = array_merge( $settings, array(
22
  array(
includes/settings/wcj-settings-price-by-country.php CHANGED
@@ -304,19 +304,19 @@ $settings = array(
304
  'css' => 'width:100px;',
305
  ),
306
  );
307
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i++ ) {
308
- $admin_title = get_option( 'wcj_price_by_country_countries_group_admin_title_' . $i, __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i );
309
  if ( __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i == $admin_title ) {
310
  $admin_title = '';
311
  } else {
312
  $admin_title = ': ' . $admin_title;
313
  }
314
  $admin_title = __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i . $admin_title;
315
- switch ( get_option( 'wcj_price_by_country_selection', 'comma_list' ) ) {
316
  case 'comma_list':
317
  $settings[] = array(
318
- 'title' => $admin_title . ( '' != get_option( 'wcj_price_by_country_exchange_rate_countries_group_' . $i, '' ) ?
319
- ' (' . count( explode( ',', get_option( 'wcj_price_by_country_exchange_rate_countries_group_' . $i, '' ) ) ) . ')' : '' ),
320
  'desc' => __( 'Countries. List of comma separated country codes.<br>For country codes and predefined sets visit <a href="https://booster.io/country-codes/" target="_blank">https://booster.io/country-codes/</a>', 'woocommerce-jetpack' ),
321
  'id' => 'wcj_price_by_country_exchange_rate_countries_group_' . $i,
322
  'default' => '',
@@ -326,8 +326,8 @@ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_price_b
326
  break;
327
  case 'multiselect':
328
  $settings[] = array(
329
- 'title' => $admin_title . ( is_array( get_option( 'wcj_price_by_country_countries_group_' . $i, '' ) ) ?
330
- ' (' . count( get_option( 'wcj_price_by_country_countries_group_' . $i, '' ) ) . ')' : '' ),
331
  'id' => 'wcj_price_by_country_countries_group_' . $i,
332
  'default' => '',
333
  'type' => 'multiselect',
@@ -337,8 +337,8 @@ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_price_b
337
  break;
338
  case 'chosen_select':
339
  $settings[] = array(
340
- 'title' => $admin_title . ( is_array( get_option( 'wcj_price_by_country_countries_group_chosen_select_' . $i, '' ) ) ?
341
- ' (' . count( get_option( 'wcj_price_by_country_countries_group_chosen_select_' . $i, '' ) ) . ')' : '' ),
342
  'id' => 'wcj_price_by_country_countries_group_chosen_select_' . $i,
343
  'default' => '',
344
  'type' => 'multiselect',
@@ -389,9 +389,9 @@ $settings = array_merge( $settings, array(
389
  'custom_attributes' => apply_filters( 'booster_message', '', 'disabled' ),
390
  ),
391
  ) );
392
- $currency_from = apply_filters( 'woocommerce_currency', get_option('woocommerce_currency') );
393
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i++ ) {
394
- $currency_to = get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $i );
395
  $custom_attributes = array(
396
  'currency_from' => $currency_from,
397
  'currency_to' => $currency_to,
304
  'css' => 'width:100px;',
305
  ),
306
  );
307
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i++ ) {
308
+ $admin_title = wcj_get_option( 'wcj_price_by_country_countries_group_admin_title_' . $i, __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i );
309
  if ( __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i == $admin_title ) {
310
  $admin_title = '';
311
  } else {
312
  $admin_title = ': ' . $admin_title;
313
  }
314
  $admin_title = __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i . $admin_title;
315
+ switch ( wcj_get_option( 'wcj_price_by_country_selection', 'comma_list' ) ) {
316
  case 'comma_list':
317
  $settings[] = array(
318
+ 'title' => $admin_title . ( '' != wcj_get_option( 'wcj_price_by_country_exchange_rate_countries_group_' . $i, '' ) ?
319
+ ' (' . count( explode( ',', wcj_get_option( 'wcj_price_by_country_exchange_rate_countries_group_' . $i, '' ) ) ) . ')' : '' ),
320
  'desc' => __( 'Countries. List of comma separated country codes.<br>For country codes and predefined sets visit <a href="https://booster.io/country-codes/" target="_blank">https://booster.io/country-codes/</a>', 'woocommerce-jetpack' ),
321
  'id' => 'wcj_price_by_country_exchange_rate_countries_group_' . $i,
322
  'default' => '',
326
  break;
327
  case 'multiselect':
328
  $settings[] = array(
329
+ 'title' => $admin_title . ( is_array( wcj_get_option( 'wcj_price_by_country_countries_group_' . $i, '' ) ) ?
330
+ ' (' . count( wcj_get_option( 'wcj_price_by_country_countries_group_' . $i, '' ) ) . ')' : '' ),
331
  'id' => 'wcj_price_by_country_countries_group_' . $i,
332
  'default' => '',
333
  'type' => 'multiselect',
337
  break;
338
  case 'chosen_select':
339
  $settings[] = array(
340
+ 'title' => $admin_title . ( is_array( wcj_get_option( 'wcj_price_by_country_countries_group_chosen_select_' . $i, '' ) ) ?
341
+ ' (' . count( wcj_get_option( 'wcj_price_by_country_countries_group_chosen_select_' . $i, '' ) ) . ')' : '' ),
342
  'id' => 'wcj_price_by_country_countries_group_chosen_select_' . $i,
343
  'default' => '',
344
  'type' => 'multiselect',
389
  'custom_attributes' => apply_filters( 'booster_message', '', 'disabled' ),
390
  ),
391
  ) );
392
+ $currency_from = apply_filters( 'woocommerce_currency', wcj_get_option('woocommerce_currency') );
393
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i++ ) {
394
+ $currency_to = wcj_get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $i );
395
  $custom_attributes = array(
396
  'currency_from' => $currency_from,
397
  'currency_to' => $currency_to,
includes/settings/wcj-settings-price-by-user-role.php CHANGED
@@ -225,7 +225,7 @@ foreach ( $taxonomies as $taxonomy ) {
225
  'custom_attributes' => apply_filters( 'booster_message', '', 'disabled' ),
226
  ),
227
  ) );
228
- $_taxonomies = apply_filters( 'booster_option', '', get_option( 'wcj_price_by_user_role_' . $taxonomy['name'], '' ) );
229
  if ( ! empty( $_taxonomies ) ) {
230
  foreach ( $_taxonomies as $_taxonomy ) {
231
  foreach ( wcj_get_user_roles() as $role_key => $role_data ) {
225
  'custom_attributes' => apply_filters( 'booster_message', '', 'disabled' ),
226
  ),
227
  ) );
228
+ $_taxonomies = apply_filters( 'booster_option', '', wcj_get_option( 'wcj_price_by_user_role_' . $taxonomy['name'], '' ) );
229
  if ( ! empty( $_taxonomies ) ) {
230
  foreach ( $_taxonomies as $_taxonomy ) {
231
  foreach ( wcj_get_user_roles() as $role_key => $role_data ) {
includes/settings/wcj-settings-price-formats.php CHANGED
@@ -51,8 +51,8 @@ $settings = array(
51
  ),
52
  ),
53
  );
54
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_price_formats_total_number', 1 ) ); $i++ ) {
55
- $currency_symbol = get_woocommerce_currency_symbol( get_option( 'wcj_price_formats_currency_' . $i, get_woocommerce_currency() ) );
56
  $settings = array_merge( $settings, array(
57
  array(
58
  'title' => __( 'Format', 'woocommerce-jetpack' ) . ' #' . $i,
@@ -66,7 +66,7 @@ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_price_f
66
  array(
67
  'desc' => __( 'Currency Position', 'woocommerce-jetpack' ),
68
  'id' => 'wcj_price_formats_currency_position_' . $i,
69
- 'default' => get_option( 'woocommerce_currency_pos' ),
70
  'type' => 'select',
71
  'options' => array(
72
  'left' => __( 'Left', 'woocommerce' ) . ' (' . $currency_symbol . '99.99)',
@@ -108,7 +108,7 @@ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_price_f
108
  array(
109
  'desc' => __( 'Number of Decimals', 'woocommerce-jetpack' ),
110
  'id' => 'wcj_price_formats_number_of_decimals_' . $i,
111
- 'default' => get_option( 'woocommerce_price_num_decimals', 2 ),
112
  'type' => 'number',
113
  'custom_attributes' => array( 'min' => 0, 'step' => 1 ),
114
  'css' => 'width:300px;',
51
  ),
52
  ),
53
  );
54
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_price_formats_total_number', 1 ) ); $i++ ) {
55
+ $currency_symbol = get_woocommerce_currency_symbol( wcj_get_option( 'wcj_price_formats_currency_' . $i, get_woocommerce_currency() ) );
56
  $settings = array_merge( $settings, array(
57
  array(
58
  'title' => __( 'Format', 'woocommerce-jetpack' ) . ' #' . $i,
66
  array(
67
  'desc' => __( 'Currency Position', 'woocommerce-jetpack' ),
68
  'id' => 'wcj_price_formats_currency_position_' . $i,
69
+ 'default' => wcj_get_option( 'woocommerce_currency_pos' ),
70
  'type' => 'select',
71
  'options' => array(
72
  'left' => __( 'Left', 'woocommerce' ) . ' (' . $currency_symbol . '99.99)',
108
  array(
109
  'desc' => __( 'Number of Decimals', 'woocommerce-jetpack' ),
110
  'id' => 'wcj_price_formats_number_of_decimals_' . $i,
111
+ 'default' => wcj_get_option( 'woocommerce_price_num_decimals', 2 ),
112
  'type' => 'number',
113
  'custom_attributes' => array( 'min' => 0, 'step' => 1 ),
114
  'css' => 'width:300px;',
includes/settings/wcj-settings-product-addons.php CHANGED
@@ -66,7 +66,7 @@ $settings = array_merge( $settings, array(
66
  ),
67
  ),
68
  ) );
69
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_product_addons_all_products_total_number', 1 ) );
70
  for ( $i = 1; $i <= $total_number; $i++ ) {
71
  $settings = array_merge( $settings, array(
72
  array(
66
  ),
67
  ),
68
  ) );
69
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_product_addons_all_products_total_number', 1 ) );
70
  for ( $i = 1; $i <= $total_number; $i++ ) {
71
  $settings = array_merge( $settings, array(
72
  array(
includes/settings/wcj-settings-product-by-user.php CHANGED
@@ -70,7 +70,7 @@ $settings = array_merge(
70
  'desc' => __( 'Number of decimals', 'woocommerce' ),
71
  'desc_tip' => __( 'Used for price fields only.', 'woocommerce-jetpack' ),
72
  'id' => 'wcj_product_by_user_price_step',
73
- 'default' => get_option( 'woocommerce_price_num_decimals', 2 ),
74
  'type' => 'number',
75
  'custom_attributes' => array( 'step' => '1', 'min' => '0' ),
76
  ),
@@ -142,7 +142,7 @@ $settings = array_merge(
142
  ),
143
  )
144
  );
145
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_product_by_user_custom_taxonomies_total', 1 ) ); $i++ ) {
146
  $settings = array_merge( $settings, array(
147
  array(
148
  'title' => __( 'Custom Taxonomy', 'woocommerce-jetpack' ) . ' #' . $i,
70
  'desc' => __( 'Number of decimals', 'woocommerce' ),
71
  'desc_tip' => __( 'Used for price fields only.', 'woocommerce-jetpack' ),
72
  'id' => 'wcj_product_by_user_price_step',
73
+ 'default' => wcj_get_option( 'woocommerce_price_num_decimals', 2 ),
74
  'type' => 'number',
75
  'custom_attributes' => array( 'step' => '1', 'min' => '0' ),
76
  ),
142
  ),
143
  )
144
  );
145
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_product_by_user_custom_taxonomies_total', 1 ) ); $i++ ) {
146
  $settings = array_merge( $settings, array(
147
  array(
148
  'title' => __( 'Custom Taxonomy', 'woocommerce-jetpack' ) . ' #' . $i,
includes/settings/wcj-settings-product-custom-info.php CHANGED
@@ -9,9 +9,9 @@
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
- $is_multiselect_products = ( 'yes' === get_option( 'wcj_list_for_products', 'yes' ) );
13
- $is_multiselect_cats = ( 'yes' === get_option( 'wcj_list_for_products_cats', 'yes' ) );
14
- $is_multiselect_tags = ( 'yes' === get_option( 'wcj_list_for_products_tags', 'yes' ) );
15
  $product_cats = ( $is_multiselect_cats ? wcj_get_terms( 'product_cat' ) : false );
16
  $product_tags = ( $is_multiselect_tags ? wcj_get_terms( 'product_tag' ) : false );
17
  $settings = array();
@@ -19,7 +19,7 @@ $single_or_archive_array = array( 'single', 'archive' );
19
 
20
  foreach ( $single_or_archive_array as $single_or_archive ) {
21
 
22
- if ( '' == ( $extra_filters = get_option( 'wcj_product_custom_info_extra_filters_' . $single_or_archive, '' ) ) ) {
23
  $extra_filters = array();
24
  } else {
25
  $extra_filters = explode( PHP_EOL, $extra_filters );
@@ -61,7 +61,7 @@ foreach ( $single_or_archive_array as $single_or_archive ) {
61
  'id' => 'wcj_product_custom_info_options_' . $single_or_archive,
62
  ),
63
  ) );
64
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_product_custom_info_total_number_' . $single_or_archive, 1 ) ); $i++ ) {
65
 
66
  wcj_maybe_convert_and_update_option_value( array(
67
  array( 'id' => 'wcj_product_custom_info_products_to_include_' . $single_or_archive . '_' . $i, 'default' => '' ),
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
+ $is_multiselect_products = ( 'yes' === wcj_get_option( 'wcj_list_for_products', 'yes' ) );
13
+ $is_multiselect_cats = ( 'yes' === wcj_get_option( 'wcj_list_for_products_cats', 'yes' ) );
14
+ $is_multiselect_tags = ( 'yes' === wcj_get_option( 'wcj_list_for_products_tags', 'yes' ) );
15
  $product_cats = ( $is_multiselect_cats ? wcj_get_terms( 'product_cat' ) : false );
16
  $product_tags = ( $is_multiselect_tags ? wcj_get_terms( 'product_tag' ) : false );
17
  $settings = array();
19
 
20
  foreach ( $single_or_archive_array as $single_or_archive ) {
21
 
22
+ if ( '' == ( $extra_filters = wcj_get_option( 'wcj_product_custom_info_extra_filters_' . $single_or_archive, '' ) ) ) {
23
  $extra_filters = array();
24
  } else {
25
  $extra_filters = explode( PHP_EOL, $extra_filters );
61
  'id' => 'wcj_product_custom_info_options_' . $single_or_archive,
62
  ),
63
  ) );
64
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_product_custom_info_total_number_' . $single_or_archive, 1 ) ); $i++ ) {
65
 
66
  wcj_maybe_convert_and_update_option_value( array(
67
  array( 'id' => 'wcj_product_custom_info_products_to_include_' . $single_or_archive . '_' . $i, 'default' => '' ),
includes/settings/wcj-settings-product-input-fields.php CHANGED
@@ -74,11 +74,11 @@ $settings = array(
74
  'id' => 'wcj_product_input_fields_global_options',
75
  ),
76
  );
77
- $is_multiselect_products = ( 'yes' === get_option( 'wcj_list_for_products', 'yes' ) );
78
  $product_cats = wcj_get_terms( 'product_cat' );
79
  $product_tags = wcj_get_terms( 'product_tag' );
80
  $options = $this->get_global_product_fields_options();
81
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_product_input_fields_global_total_number', 1 ) ); $i++ ) {
82
  $settings = array_merge( $settings, array(
83
  array(
84
  'title' => __( 'Product Input Field', 'woocommerce-jetpack' ) . ' #' . $i,
74
  'id' => 'wcj_product_input_fields_global_options',
75
  ),
76
  );
77
+ $is_multiselect_products = ( 'yes' === wcj_get_option( 'wcj_list_for_products', 'yes' ) );
78
  $product_cats = wcj_get_terms( 'product_cat' );
79
  $product_tags = wcj_get_terms( 'product_tag' );
80
  $options = $this->get_global_product_fields_options();
81
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_product_input_fields_global_total_number', 1 ) ); $i++ ) {
82
  $settings = array_merge( $settings, array(
83
  array(
84
  'title' => __( 'Product Input Field', 'woocommerce-jetpack' ) . ' #' . $i,
includes/settings/wcj-settings-product-listings.php CHANGED
@@ -15,7 +15,7 @@ $options = array(
15
  'wcj_product_listings_exclude_cats_on_archives',
16
  );
17
  foreach ( $options as $option ) {
18
- $value = get_option( $option, '' );
19
  if ( ! is_array( $value ) ) {
20
  $value = explode( ',', str_replace( ' ', '', $value ) );
21
  update_option( $option, $value );
15
  'wcj_product_listings_exclude_cats_on_archives',
16
  );
17
  foreach ( $options as $option ) {
18
+ $value = wcj_get_option( $option, '' );
19
  if ( ! is_array( $value ) ) {
20
  $value = explode( ',', str_replace( ' ', '', $value ) );
21
  update_option( $option, $value );
includes/settings/wcj-settings-product-open-pricing.php CHANGED
@@ -12,7 +12,7 @@
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
 
15
- $default_price_step = 1 / pow( 10, absint( get_option( 'woocommerce_price_num_decimals', 2 ) ) );
16
  $positions = array(
17
  'woocommerce_before_add_to_cart_button' => __( 'Before add to cart button', 'woocommerce-jetpack' ), // since WC v2.1.0
18
  'woocommerce_after_add_to_cart_button' => __( 'After add to cart button', 'woocommerce-jetpack' ), // since WC v2.1.0
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
 
15
+ $default_price_step = 1 / pow( 10, absint( wcj_get_option( 'woocommerce_price_num_decimals', 2 ) ) );
16
  $positions = array(
17
  'woocommerce_before_add_to_cart_button' => __( 'Before add to cart button', 'woocommerce-jetpack' ), // since WC v2.1.0
18
  'woocommerce_after_add_to_cart_button' => __( 'After add to cart button', 'woocommerce-jetpack' ), // since WC v2.1.0
includes/settings/wcj-settings-product-price-by-formula.php CHANGED
@@ -41,7 +41,7 @@ $settings = array(
41
  'type' => 'custom_number',
42
  ),
43
  );
44
- $total_number = get_option( 'wcj_product_price_by_formula_total_params', 1 );
45
  for ( $i = 1; $i <= $total_number; $i++ ) {
46
  $settings[] = array(
47
  'title' => 'p' . $i,
41
  'type' => 'custom_number',
42
  ),
43
  );
44
+ $total_number = wcj_get_option( 'wcj_product_price_by_formula_total_params', 1 );
45
  for ( $i = 1; $i <= $total_number; $i++ ) {
46
  $settings[] = array(
47
  'title' => 'p' . $i,
includes/settings/wcj-settings-product-tabs.php CHANGED
@@ -64,7 +64,7 @@ $settings = array(
64
  $product_tags_options = wcj_get_terms( 'product_tag' );
65
  $product_cats_options = wcj_get_terms( 'product_cat' );
66
  $products_options = wcj_get_products();
67
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_custom_product_tabs_global_total_number', 1 ) ); $i++ ) {
68
  $settings = array_merge( $settings,
69
  array(
70
  array(
@@ -166,7 +166,7 @@ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_custom_
166
  ),
167
  )
168
  );
169
- if ( '' != get_option( 'wcj_custom_product_tabs_title_global_hide_in_product_ids_' . $i, '' ) ) {
170
  $settings = array_merge( $settings, array(
171
  array(
172
  'desc' => __( 'Comma separated PRODUCT IDs to HIDE this tab', 'woocommerce-jetpack' ) . '. <strong><em>' . __( 'Deprecated', 'woocommerce-jetpack' ) . '!</em></strong>',
@@ -178,7 +178,7 @@ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_custom_
178
  ),
179
  ) );
180
  }
181
- if ( '' != get_option( 'wcj_custom_product_tabs_title_global_show_in_product_ids_' . $i, '' ) ) {
182
  $settings = array_merge( $settings, array(
183
  array(
184
  'desc' => __( 'Comma separated PRODUCT IDs to SHOW this tab', 'woocommerce-jetpack' ) . '. <strong><em>' . __( 'Deprecated', 'woocommerce-jetpack' ) . '!</em></strong>',
@@ -190,7 +190,7 @@ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_custom_
190
  ),
191
  ) );
192
  }
193
- if ( '' != get_option( 'wcj_custom_product_tabs_title_global_hide_in_cats_ids_' . $i, '' ) ) {
194
  $settings = array_merge( $settings, array(
195
  array(
196
  'desc' => __( 'Comma separated CATEGORY IDs to HIDE this tab', 'woocommerce-jetpack' ) . '. <strong><em>' . __( 'Deprecated', 'woocommerce-jetpack' ) . '!</em></strong>',
@@ -202,7 +202,7 @@ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_custom_
202
  ),
203
  ) );
204
  }
205
- if ( '' != get_option( 'wcj_custom_product_tabs_title_global_show_in_cats_ids_' . $i, '' ) ) {
206
  $settings = array_merge( $settings, array(
207
  array(
208
  'desc' => __( 'Comma separated CATEGORY IDs to SHOW this tab', 'woocommerce-jetpack' ) . '. <strong><em>' . __( 'Deprecated', 'woocommerce-jetpack' ) . '!</em></strong>',
@@ -264,7 +264,7 @@ $settings = array_merge( $settings, array(
264
  ),
265
  ),
266
  ) );
267
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_custom_product_tabs_local_total_number_default', 1 ) ); $i++ ) {
268
  $settings = array_merge( $settings, array(
269
  array(
270
  'title' => __( 'Custom Product Tab', 'woocommerce-jetpack' ) . ' #' . $i,
64
  $product_tags_options = wcj_get_terms( 'product_tag' );
65
  $product_cats_options = wcj_get_terms( 'product_cat' );
66
  $products_options = wcj_get_products();
67
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_custom_product_tabs_global_total_number', 1 ) ); $i++ ) {
68
  $settings = array_merge( $settings,
69
  array(
70
  array(
166
  ),
167
  )
168
  );
169
+ if ( '' != wcj_get_option( 'wcj_custom_product_tabs_title_global_hide_in_product_ids_' . $i, '' ) ) {
170
  $settings = array_merge( $settings, array(
171
  array(
172
  'desc' => __( 'Comma separated PRODUCT IDs to HIDE this tab', 'woocommerce-jetpack' ) . '. <strong><em>' . __( 'Deprecated', 'woocommerce-jetpack' ) . '!</em></strong>',
178
  ),
179
  ) );
180
  }
181
+ if ( '' != wcj_get_option( 'wcj_custom_product_tabs_title_global_show_in_product_ids_' . $i, '' ) ) {
182
  $settings = array_merge( $settings, array(
183
  array(
184
  'desc' => __( 'Comma separated PRODUCT IDs to SHOW this tab', 'woocommerce-jetpack' ) . '. <strong><em>' . __( 'Deprecated', 'woocommerce-jetpack' ) . '!</em></strong>',
190
  ),
191
  ) );
192
  }
193
+ if ( '' != wcj_get_option( 'wcj_custom_product_tabs_title_global_hide_in_cats_ids_' . $i, '' ) ) {
194
  $settings = array_merge( $settings, array(
195
  array(
196
  'desc' => __( 'Comma separated CATEGORY IDs to HIDE this tab', 'woocommerce-jetpack' ) . '. <strong><em>' . __( 'Deprecated', 'woocommerce-jetpack' ) . '!</em></strong>',
202
  ),
203
  ) );
204
  }
205
+ if ( '' != wcj_get_option( 'wcj_custom_product_tabs_title_global_show_in_cats_ids_' . $i, '' ) ) {
206
  $settings = array_merge( $settings, array(
207
  array(
208
  'desc' => __( 'Comma separated CATEGORY IDs to SHOW this tab', 'woocommerce-jetpack' ) . '. <strong><em>' . __( 'Deprecated', 'woocommerce-jetpack' ) . '!</em></strong>',
264
  ),
265
  ),
266
  ) );
267
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_custom_product_tabs_local_total_number_default', 1 ) ); $i++ ) {
268
  $settings = array_merge( $settings, array(
269
  array(
270
  'title' => __( 'Custom Product Tab', 'woocommerce-jetpack' ) . ' #' . $i,
includes/settings/wcj-settings-products-xml.php CHANGED
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
  $product_cats_options = wcj_get_terms( 'product_cat' );
15
  $product_tags_options = wcj_get_terms( 'product_tag' );
16
  $products_options = wcj_get_products();
17
- $is_multiselect_products = ( 'yes' === get_option( 'wcj_list_for_products', 'yes' ) );
18
  $settings = array(
19
  array(
20
  'title' => __( 'Options', 'woocommerce-jetpack' ),
@@ -44,7 +44,7 @@ $settings = array(
44
  'id' => 'wcj_products_xml_options',
45
  ),
46
  );
47
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_products_xml_total_files', 1 ) ); $i++ ) {
48
  wcj_maybe_convert_and_update_option_value( array(
49
  array( 'id' => 'wcj_products_xml_products_incl_' . $i, 'default' => '' ),
50
  array( 'id' => 'wcj_products_xml_products_excl_' . $i, 'default' => '' ),
@@ -58,10 +58,10 @@ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_product
58
  wcj_crons_get_next_event_time_message( 'wcj_create_products_xml_cron_time_' . $i );
59
  }
60
  $products_time_file_created_desc = '';
61
- if ( '' != get_option( 'wcj_products_time_file_created_' . $i, '' ) ) {
62
  $products_time_file_created_desc = sprintf(
63
  __( 'Recent file was created on %s', 'woocommerce-jetpack' ),
64
- '<code>' . date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), get_option( 'wcj_products_time_file_created_' . $i, '' ) ) . '</code>'
65
  );
66
  }
67
  $default_file_name = ( ( 1 == $i ) ? 'products.xml' : 'products_' . $i . '.xml' );
@@ -116,10 +116,10 @@ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_product
116
  ),
117
  array(
118
  'title' => __( 'XML File Path and Name', 'woocommerce-jetpack' ),
119
- 'desc_tip' => __( 'Path on server:', 'woocommerce-jetpack' ) . ' ' . ABSPATH . get_option( 'wcj_products_xml_file_path_' . $i, $default_file_name ),
120
  'desc' => __( 'URL:', 'woocommerce-jetpack' ) . ' ' .
121
- '<a target="_blank" href="' . site_url() . '/' . get_option( 'wcj_products_xml_file_path_' . $i, $default_file_name ) . '">' .
122
- site_url() . '/' . get_option( 'wcj_products_xml_file_path_' . $i, $default_file_name ) . '</a>',
123
  'id' => 'wcj_products_xml_file_path_' . $i,
124
  'default' => $default_file_name,
125
  'type' => 'text',
14
  $product_cats_options = wcj_get_terms( 'product_cat' );
15
  $product_tags_options = wcj_get_terms( 'product_tag' );
16
  $products_options = wcj_get_products();
17
+ $is_multiselect_products = ( 'yes' === wcj_get_option( 'wcj_list_for_products', 'yes' ) );
18
  $settings = array(
19
  array(
20
  'title' => __( 'Options', 'woocommerce-jetpack' ),
44
  'id' => 'wcj_products_xml_options',
45
  ),
46
  );
47
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_products_xml_total_files', 1 ) ); $i++ ) {
48
  wcj_maybe_convert_and_update_option_value( array(
49
  array( 'id' => 'wcj_products_xml_products_incl_' . $i, 'default' => '' ),
50
  array( 'id' => 'wcj_products_xml_products_excl_' . $i, 'default' => '' ),
58
  wcj_crons_get_next_event_time_message( 'wcj_create_products_xml_cron_time_' . $i );
59
  }
60
  $products_time_file_created_desc = '';
61
+ if ( '' != wcj_get_option( 'wcj_products_time_file_created_' . $i, '' ) ) {
62
  $products_time_file_created_desc = sprintf(
63
  __( 'Recent file was created on %s', 'woocommerce-jetpack' ),
64
+ '<code>' . date_i18n( wcj_get_option( 'date_format' ) . ' ' . wcj_get_option( 'time_format' ), wcj_get_option( 'wcj_products_time_file_created_' . $i, '' ) ) . '</code>'
65
  );
66
  }
67
  $default_file_name = ( ( 1 == $i ) ? 'products.xml' : 'products_' . $i . '.xml' );
116
  ),
117
  array(
118
  'title' => __( 'XML File Path and Name', 'woocommerce-jetpack' ),
119
+ 'desc_tip' => __( 'Path on server:', 'woocommerce-jetpack' ) . ' ' . ABSPATH . wcj_get_option( 'wcj_products_xml_file_path_' . $i, $default_file_name ),
120
  'desc' => __( 'URL:', 'woocommerce-jetpack' ) . ' ' .
121
+ '<a target="_blank" href="' . site_url() . '/' . wcj_get_option( 'wcj_products_xml_file_path_' . $i, $default_file_name ) . '">' .
122
+ site_url() . '/' . wcj_get_option( 'wcj_products_xml_file_path_' . $i, $default_file_name ) . '</a>',
123
  'id' => 'wcj_products_xml_file_path_' . $i,
124
  'default' => $default_file_name,
125
  'type' => 'text',
includes/settings/wcj-settings-purchase-data.php CHANGED
@@ -68,7 +68,7 @@ $settings = array(
68
  'custom_attributes' => apply_filters( 'booster_message', '', 'readonly' ),
69
  ),
70
  );
71
- $total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_purchase_data_custom_price_fields_total_number', 1 ) );
72
  for ( $i = 1; $i <= $total_number; $i++ ) {
73
  $settings = array_merge( $settings, array(
74
  array(
68
  'custom_attributes' => apply_filters( 'booster_message', '', 'readonly' ),
69
  ),
70
  );
71
+ $total_number = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_purchase_data_custom_price_fields_total_number', 1 ) );
72
  for ( $i = 1; $i <= $total_number; $i++ ) {
73
  $settings = array_merge( $settings, array(
74
  array(
includes/settings/wcj-settings-related-products.php CHANGED
@@ -9,7 +9,7 @@
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
- $is_multiselect_products = ( 'yes' === get_option( 'wcj_list_for_products', 'yes' ) );
13
  $products = ( $is_multiselect_products ? wcj_get_products() : false );
14
  $product_cats = wcj_get_terms( 'product_cat' );
15
  $product_tags = wcj_get_terms( 'product_tag' );
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
+ $is_multiselect_products = ( 'yes' === wcj_get_option( 'wcj_list_for_products', 'yes' ) );
13
  $products = ( $is_multiselect_products ? wcj_get_products() : false );
14
  $product_cats = wcj_get_terms( 'product_cat' );
15
  $product_tags = wcj_get_terms( 'product_tag' );
includes/settings/wcj-settings-sale-flash.php CHANGED
@@ -104,7 +104,7 @@ foreach ( $product_terms as $id => $_product_terms ) {
104
  'options' => $_product_terms,
105
  ),
106
  ) );
107
- foreach ( get_option( 'wcj_sale_flash_per_' . $id . '_terms', array() ) as $term_id ) {
108
  $settings = array_merge( $settings, array(
109
  array(
110
  'title' => ( isset( $_product_terms[ $term_id ] ) ? $_product_terms[ $term_id ] : sprintf( __( 'Term #%s', 'woocommerce-jetpack' ), $term_id ) ),
104
  'options' => $_product_terms,
105
  ),
106
  ) );
107
+ foreach ( wcj_get_option( 'wcj_sale_flash_per_' . $id . '_terms', array() ) as $term_id ) {
108
  $settings = array_merge( $settings, array(
109
  array(
110
  'title' => ( isset( $_product_terms[ $term_id ] ) ? $_product_terms[ $term_id ] : sprintf( __( 'Term #%s', 'woocommerce-jetpack' ), $term_id ) ),
includes/settings/wcj-settings-shipping-by-condition.php CHANGED
@@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  exit; // Exit if accessed directly
13
  }
14
 
15
- $use_shipping_instances = ( 'yes' === get_option( 'wcj_' . $this->id . '_use_shipping_instance', 'no' ) );
16
  $shipping_methods = ( $use_shipping_instances ? wcj_get_shipping_methods_instances( true ) : WC()->shipping()->load_shipping_methods() );
17
  $settings = array();
18
 
12
  exit; // Exit if accessed directly
13
  }
14
 
15
+ $use_shipping_instances = ( 'yes' === wcj_get_option( 'wcj_' . $this->id . '_use_shipping_instance', 'no' ) );
16
  $shipping_methods = ( $use_shipping_instances ? wcj_get_shipping_methods_instances( true ) : WC()->shipping()->load_shipping_methods() );
17
  $settings = array();
18
 
includes/settings/wcj-settings-shipping-by-order-amount.php CHANGED
@@ -9,7 +9,7 @@
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
- $use_shipping_instances = ( 'yes' === get_option( 'wcj_shipping_by_order_amount_use_shipping_instance', 'no' ) );
13
  $settings = array(
14
  array(
15
  'title' => __( 'General Options', 'woocommerce-jetpack' ),
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
+ $use_shipping_instances = ( 'yes' === wcj_get_option( 'wcj_shipping_by_order_amount_use_shipping_instance', 'no' ) );
13
  $settings = array(
14
  array(
15
  'title' => __( 'General Options', 'woocommerce-jetpack' ),
includes/settings/wcj-settings-shipping-by-order-qty.php CHANGED
@@ -9,7 +9,7 @@
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
- $use_shipping_instances = ( 'yes' === get_option( 'wcj_shipping_by_order_qty_use_shipping_instance', 'no' ) );
13
  $settings = array(
14
  array(
15
  'title' => __( 'General Options', 'woocommerce-jetpack' ),
9
 
10
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
 
12
+ $use_shipping_instances = ( 'yes' === wcj_get_option( 'wcj_shipping_by_order_qty_use_shipping_instance', 'no' ) );
13
  $settings = array(
14
  array(
15
  'title' => __( 'General Options', 'woocommerce-jetpack' ),
includes/settings/wcj-settings-shipping-description.php CHANGED
@@ -64,7 +64,7 @@ $settings = array(
64
  'default' => 'no',
65
  ),
66
  );
67
- $use_shipping_instances = ( 'yes' === get_option( 'wcj_shipping_descriptions_use_shipping_instance', 'no' ) );
68
  $shipping_methods = ( $use_shipping_instances ? wcj_get_shipping_methods_instances( true ) : WC()->shipping()->get_shipping_methods() );
69
  foreach ( $shipping_methods as $method ) {
70
  $settings = array_merge( $settings, array(
64
  'default' => 'no',
65
  ),
66
  );
67
+ $use_shipping_instances = ( 'yes' === wcj_get_option( 'wcj_shipping_descriptions_use_shipping_instance', 'no' ) );
68
  $shipping_methods = ( $use_shipping_instances ? wcj_get_shipping_methods_instances( true ) : WC()->shipping()->get_shipping_methods() );
69
  foreach ( $shipping_methods as $method ) {
70
  $settings = array_merge( $settings, array(
includes/settings/wcj-settings-shipping-icons.php CHANGED
@@ -66,7 +66,7 @@ $settings = array(
66
  'default' => 'no',
67
  ),
68
  );
69
- $use_shipping_instances = ( 'yes' === get_option( 'wcj_shipping_icons_use_shipping_instance', 'no' ) );
70
  $shipping_methods = ( $use_shipping_instances ? wcj_get_shipping_methods_instances( true ) : WC()->shipping()->get_shipping_methods() );
71
  foreach ( $shipping_methods as $method ) {
72
  $settings = array_merge( $settings, array(
66
  'default' => 'no',
67
  ),
68
  );
69
+ $use_shipping_instances = ( 'yes' === wcj_get_option( 'wcj_shipping_icons_use_shipping_instance', 'no' ) );
70
  $shipping_methods = ( $use_shipping_instances ? wcj_get_shipping_methods_instances( true ) : WC()->shipping()->get_shipping_methods() );
71
  foreach ( $shipping_methods as $method ) {
72
  $settings = array_merge( $settings, array(
includes/settings/wcj-settings-shipping-time.php CHANGED
@@ -15,8 +15,8 @@
15
 
16
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
17
 
18
- $use_shipping_instances = ( 'yes' === get_option( 'wcj_shipping_time_use_shipping_instance', 'no' ) );
19
- $use_shipping_classes = ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_shipping_time_use_shipping_classes', 'no' ) ) );
20
  $shipping_methods = ( $use_shipping_instances ? wcj_get_shipping_methods_instances( true ) : WC()->shipping()->load_shipping_methods() );
21
  $shipping_classes_data = ( $use_shipping_classes ? wcj_get_shipping_classes() : array( '' => '' ) );
22
  $settings = array();
15
 
16
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
17
 
18
+ $use_shipping_instances = ( 'yes' === wcj_get_option( 'wcj_shipping_time_use_shipping_instance', 'no' ) );
19
+ $use_shipping_classes = ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_shipping_time_use_shipping_classes', 'no' ) ) );
20
  $shipping_methods = ( $use_shipping_instances ? wcj_get_shipping_methods_instances( true ) : WC()->shipping()->load_shipping_methods() );
21
  $shipping_classes_data = ( $use_shipping_classes ? wcj_get_shipping_classes() : array( '' => '' ) );
22
  $settings = array();
includes/settings/wcj-settings-shipping.php CHANGED
@@ -55,7 +55,7 @@ $settings = array_merge( $settings, array(
55
  'custom_attributes' => array( 'step' => '1', 'min' => '0' ),
56
  ),
57
  ) );
58
- for ( $i = 1; $i <= get_option( 'wcj_shipping_custom_shipping_total_number', 1 ); $i++ ) {
59
  $settings = array_merge( $settings, array(
60
  array(
61
  'title' => __( 'Admin Title Custom Shipping', 'woocommerce-jetpack' ) . ' #' . $i,
55
  'custom_attributes' => array( 'step' => '1', 'min' => '0' ),
56
  ),
57
  ) );
58
+ for ( $i = 1; $i <= wcj_get_option( 'wcj_shipping_custom_shipping_total_number', 1 ); $i++ ) {
59
  $settings = array_merge( $settings, array(
60
  array(
61
  'title' => __( 'Admin Title Custom Shipping', 'woocommerce-jetpack' ) . ' #' . $i,
includes/settings/wcj-settings-sku.php CHANGED
@@ -153,7 +153,7 @@ $settings = array(
153
  'title' => __( 'Salt', 'woocommerce-jetpack' ),
154
  'desc_tip' => __( 'A random string that will make your SKUs really unique.', 'woocommerce-jetpack' ),
155
  'id' => 'wcj_sku_hashids_salt',
156
- 'default' => get_option( 'wcj_sku_hashids_salt_default', '' ),
157
  'type' => 'text',
158
  ),
159
  array(
153
  'title' => __( 'Salt', 'woocommerce-jetpack' ),
154
  'desc_tip' => __( 'A random string that will make your SKUs really unique.', 'woocommerce-jetpack' ),
155
  'id' => 'wcj_sku_hashids_salt',
156
+ 'default' => wcj_get_option( 'wcj_sku_hashids_salt_default', '' ),
157
  'type' => 'text',
158
  ),
159
  array(
includes/settings/wcj-settings-tax-display.php CHANGED
@@ -115,7 +115,7 @@ $settings = array(
115
  'options' => wcj_get_user_roles_options(),
116
  ),
117
  );
118
- if ( '' != ( $display_taxes_by_user_role_roles = get_option( 'wcj_product_listings_display_taxes_by_user_role_roles', '' ) ) ) {
119
  foreach ( $display_taxes_by_user_role_roles as $display_taxes_by_user_role_role ) {
120
  $settings = array_merge( $settings, array(
121
  array(
115
  'options' => wcj_get_user_roles_options(),
116
  ),
117
  );
118
+ if ( '' != ( $display_taxes_by_user_role_roles = wcj_get_option( 'wcj_product_listings_display_taxes_by_user_role_roles', '' ) ) ) {
119
  foreach ( $display_taxes_by_user_role_roles as $display_taxes_by_user_role_role ) {
120
  $settings = array_merge( $settings, array(
121
  array(
includes/settings/wcj-settings-template-editor.php CHANGED
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
 
15
  $new_paths = $this->get_paths();
16
  $templates = array();
17
- $templates_by_path = get_option( 'wcj_template_editor_templates_by_path', array() );
18
  foreach ( $new_paths as $path ) {
19
  $scanned_templates = $this->scan_templates( $path, $path );
20
  $templates_by_path[ $path ] = $scanned_templates;
@@ -55,7 +55,7 @@ $settings = array(
55
  'options' => $templates,
56
  ),
57
  );
58
- foreach ( get_option( 'wcj_template_editor_templates_to_edit', array() ) as $template ) {
59
  $default_template_path = wc_locate_template( $template, '', $this->get_path_by_template( $template ) );
60
  $replaced_template_path = wcj_get_wcj_uploads_dir( 'templates', false ) . DIRECTORY_SEPARATOR . $template;
61
  $style = 'style="color:' . ( file_exists( $replaced_template_path ) ? 'green' : 'red' ) . ';"';
14
 
15
  $new_paths = $this->get_paths();
16
  $templates = array();
17
+ $templates_by_path = wcj_get_option( 'wcj_template_editor_templates_by_path', array() );
18
  foreach ( $new_paths as $path ) {
19
  $scanned_templates = $this->scan_templates( $path, $path );
20
  $templates_by_path[ $path ] = $scanned_templates;
55
  'options' => $templates,
56
  ),
57
  );
58
+ foreach ( wcj_get_option( 'wcj_template_editor_templates_to_edit', array() ) as $template ) {
59
  $default_template_path = wc_locate_template( $template, '', $this->get_path_by_template( $template ) );
60
  $replaced_template_path = wcj_get_wcj_uploads_dir( 'templates', false ) . DIRECTORY_SEPARATOR . $template;
61
  $style = 'style="color:' . ( file_exists( $replaced_template_path ) ? 'green' : 'red' ) . ';"';
includes/settings/wcj-settings-url-coupons.php CHANGED
@@ -21,7 +21,7 @@ $settings = array(
21
  'title' => __( 'URL Coupons Key', 'woocommerce-jetpack' ),
22
  'desc_tip' => __( 'URL key. If you change this, make sure it\'s unique and is not used anywhere on your site (e.g. by another plugin).', 'woocommerce-jetpack' ),
23
  'desc' => sprintf( __( 'Your users can apply shop\'s standard coupons, by visiting URL. E.g.: %s.', 'woocommerce-jetpack' ),
24
- '<code>' . site_url() . '/?' . get_option( 'wcj_url_coupons_key', 'wcj_apply_coupon' ) . '=couponcode' . '</code>' ),
25
  'id' => 'wcj_url_coupons_key',
26
  'default' => 'wcj_apply_coupon',
27
  'type' => 'text',
21
  'title' => __( 'URL Coupons Key', 'woocommerce-jetpack' ),
22
  'desc_tip' => __( 'URL key. If you change this, make sure it\'s unique and is not used anywhere on your site (e.g. by another plugin).', 'woocommerce-jetpack' ),
23
  'desc' => sprintf( __( 'Your users can apply shop\'s standard coupons, by visiting URL. E.g.: %s.', 'woocommerce-jetpack' ),
24
+ '<code>' . site_url() . '/?' . wcj_get_option( 'wcj_url_coupons_key', 'wcj_apply_coupon' ) . '=couponcode' . '</code>' ),
25
  'id' => 'wcj_url_coupons_key',
26
  'default' => 'wcj_apply_coupon',
27
  'type' => 'text',
includes/settings/wcj-settings-wholesale-price.php CHANGED
@@ -201,7 +201,7 @@ $settings = array(
201
  'css' => 'width:100px;',
202
  ),
203
  );
204
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_wholesale_price_levels_number', 1 ) ); $i++ ) {
205
  $settings = array_merge( $settings, array(
206
  array(
207
  'title' => __( 'Min Quantity', 'woocommerce-jetpack' ) . ' #' . $i,
@@ -242,7 +242,7 @@ $settings = array_merge( $settings, array(
242
  'options' => wcj_get_user_roles_options(),
243
  ),
244
  ) );
245
- $user_roles = get_option( 'wcj_wholesale_price_by_user_role_roles', '' );
246
  if ( ! empty( $user_roles ) ) {
247
  foreach ( $user_roles as $user_role_key ) {
248
  $settings = array_merge( $settings, array(
@@ -258,7 +258,7 @@ if ( ! empty( $user_roles ) ) {
258
  'css' => 'width:100px;',
259
  ),
260
  ) );
261
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_wholesale_price_levels_number_' . $user_role_key, 1 ) ); $i++ ) {
262
  $settings = array_merge( $settings, array(
263
  array(
264
  'title' => __( 'Min Quantity', 'woocommerce-jetpack' ) . ' #' . $i . ' [' . $user_role_key . ']',
201
  'css' => 'width:100px;',
202
  ),
203
  );
204
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_wholesale_price_levels_number', 1 ) ); $i++ ) {
205
  $settings = array_merge( $settings, array(
206
  array(
207
  'title' => __( 'Min Quantity', 'woocommerce-jetpack' ) . ' #' . $i,
242
  'options' => wcj_get_user_roles_options(),
243
  ),
244
  ) );
245
+ $user_roles = wcj_get_option( 'wcj_wholesale_price_by_user_role_roles', '' );
246
  if ( ! empty( $user_roles ) ) {
247
  foreach ( $user_roles as $user_role_key ) {
248
  $settings = array_merge( $settings, array(
258
  'css' => 'width:100px;',
259
  ),
260
  ) );
261
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_wholesale_price_levels_number_' . $user_role_key, 1 ) ); $i++ ) {
262
  $settings = array_merge( $settings, array(
263
  array(
264
  'title' => __( 'Min Quantity', 'woocommerce-jetpack' ) . ' #' . $i . ' [' . $user_role_key . ']',
includes/shipping/class-wc-shipping-wcj-custom-with-shipping-zones.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Shipping - Custom Shipping with Shipping Zones
4
  *
5
- * @version 4.6.0
6
  * @since 2.5.6
7
  * @author Pluggabl LLC.
8
  */
@@ -31,14 +31,14 @@ if ( ! class_exists( 'WC_Shipping_WCJ_Custom_W_Zones' ) ) :
31
  /**
32
  * Init settings
33
  *
34
- * @version 4.6.0
35
  * @since 2.5.6
36
  * @access public
37
  * @return void
38
  */
39
  function init( $instance_id ) {
40
  $this->id = 'booster_custom_shipping_w_zones';
41
- $this->method_title = get_option( 'wcj_shipping_custom_shipping_w_zones_admin_title', __( 'Booster: Custom Shipping', 'woocommerce-jetpack' ) );
42
  $this->method_description = __( 'Booster: Custom Shipping Method', 'woocommerce-jetpack' );
43
 
44
  $this->instance_id = absint( $instance_id );
@@ -81,7 +81,7 @@ if ( ! class_exists( 'WC_Shipping_WCJ_Custom_W_Zones' ) ) :
81
  /**
82
  * sanitize_settings.
83
  *
84
- * @version 4.6.0
85
  * @since 4.5.0
86
  *
87
  * @param $settings
@@ -91,7 +91,7 @@ if ( ! class_exists( 'WC_Shipping_WCJ_Custom_W_Zones' ) ) :
91
  */
92
  function sanitize_settings( $settings, $shipping_method ) {
93
  $settings = array_filter( $settings );
94
- $total_rows = $settings['weight_table_total_rows'];
95
  $keys_to_remove = array();
96
  foreach ( $settings as $key => $value ) {
97
  if (
@@ -118,7 +118,7 @@ if ( ! class_exists( 'WC_Shipping_WCJ_Custom_W_Zones' ) ) :
118
  if ( $this->instance_id ) {
119
  $settings_name = 'woocommerce_' . $this->id . '_' . $this->instance_id . '_settings';
120
  if ( ! isset( self::$wcj_settings[ $settings_name ] ) ) {
121
- $settings = get_option( $settings_name );
122
  self::$wcj_settings[ $settings_name ] = $settings;
123
  } else {
124
  $settings = self::$wcj_settings[ $settings_name ];
@@ -280,11 +280,11 @@ if ( ! class_exists( 'WC_Shipping_WCJ_Custom_W_Zones' ) ) :
280
  for ( $i = 1; $i <= $this->weight_table_total_rows; $i++ ) {
281
  $option_name_weight = 'weight_table_weight_row_' . $i;
282
  $option_name_cost = 'weight_table_cost_row_' . $i;
283
- if ( $weight <= $this->get_option( $option_name_weight ) ) {
284
- return $this->get_option( $option_name_cost );
285
  }
286
  }
287
- return $this->get_option( $option_name_cost ); // fallback - last row
288
  }
289
 
290
  /**
2
  /**
3
  * Booster for WooCommerce - Shipping - Custom Shipping with Shipping Zones
4
  *
5
+ * @version 5.3.4
6
  * @since 2.5.6
7
  * @author Pluggabl LLC.
8
  */
31
  /**
32
  * Init settings
33
  *
34
+ * @version 5.3.4
35
  * @since 2.5.6
36
  * @access public
37
  * @return void
38
  */
39
  function init( $instance_id ) {
40
  $this->id = 'booster_custom_shipping_w_zones';
41
+ $this->method_title = wcj_get_option( 'wcj_shipping_custom_shipping_w_zones_admin_title', __( 'Booster: Custom Shipping', 'woocommerce-jetpack' ) );
42
  $this->method_description = __( 'Booster: Custom Shipping Method', 'woocommerce-jetpack' );
43
 
44
  $this->instance_id = absint( $instance_id );
81
  /**
82
  * sanitize_settings.
83
  *
84
+ * @version 5.3.4
85
  * @since 4.5.0
86
  *
87
  * @param $settings
91
  */
92
  function sanitize_settings( $settings, $shipping_method ) {
93
  $settings = array_filter( $settings );
94
+ $total_rows = isset( $settings['weight_table_total_rows'] ) ? $settings['weight_table_total_rows'] : 0;
95
  $keys_to_remove = array();
96
  foreach ( $settings as $key => $value ) {
97
  if (
118
  if ( $this->instance_id ) {
119
  $settings_name = 'woocommerce_' . $this->id . '_' . $this->instance_id . '_settings';
120
  if ( ! isset( self::$wcj_settings[ $settings_name ] ) ) {
121
+ $settings = wcj_get_option( $settings_name );
122
  self::$wcj_settings[ $settings_name ] = $settings;
123
  } else {
124
  $settings = self::$wcj_settings[ $settings_name ];
280
  for ( $i = 1; $i <= $this->weight_table_total_rows; $i++ ) {
281
  $option_name_weight = 'weight_table_weight_row_' . $i;
282
  $option_name_cost = 'weight_table_cost_row_' . $i;
283
+ if ( $weight <= wcj_get_option( $option_name_weight ) ) {
284
+ return wcj_get_option( $option_name_cost );
285
  }
286
  }
287
+ return wcj_get_option( $option_name_cost ); // fallback - last row
288
  }
289
 
290
  /**
includes/shipping/class-wc-shipping-wcj-custom.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Shipping - Custom Shipping
4
  *
5
- * @version 3.4.0
6
  * @since 2.4.8
7
  * @author Pluggabl LLC.
8
  */
@@ -27,14 +27,14 @@ class WC_Shipping_WCJ_Custom_Template extends WC_Shipping_Method {
27
  /**
28
  * Init settings
29
  *
30
- * @version 2.8.0
31
  * @access public
32
  * @return void
33
  */
34
  function init( $id_count ) {
35
 
36
  $this->id = 'booster_custom_shipping_' . $id_count;
37
- $this->method_title = get_option( 'wcj_shipping_custom_shipping_admin_title_' . $id_count, __( 'Custom', 'woocommerce-jetpack' ) . ' #' . $id_count );
38
  $this->method_description = __( 'Booster: Custom Shipping Method', 'woocommerce-jetpack' ) . ' #' . $id_count;
39
 
40
  // Load the settings.
@@ -84,7 +84,7 @@ class WC_Shipping_WCJ_Custom_Template extends WC_Shipping_Method {
84
  /**
85
  * Initialise Settings Form Fields
86
  *
87
- * @version 2.8.0
88
  */
89
  function init_form_fields() {
90
  $type_options = array(
2
  /**
3
  * Booster for WooCommerce - Shipping - Custom Shipping
4
  *
5
+ * @version 5.3.4
6
  * @since 2.4.8
7
  * @author Pluggabl LLC.
8
  */
27
  /**
28
  * Init settings
29
  *
30
+ * @version 5.3.4
31
  * @access public
32
  * @return void
33
  */
34
  function init( $id_count ) {
35
 
36
  $this->id = 'booster_custom_shipping_' . $id_count;
37
+ $this->method_title = wcj_get_option( 'wcj_shipping_custom_shipping_admin_title_' . $id_count, __( 'Custom', 'woocommerce-jetpack' ) . ' #' . $id_count );
38
  $this->method_description = __( 'Booster: Custom Shipping Method', 'woocommerce-jetpack' ) . ' #' . $id_count;
39
 
40
  // Load the settings.
84
  /**
85
  * Initialise Settings Form Fields
86
  *
87
+ * @version 5.3.4
88
  */
89
  function init_form_fields() {
90
  $type_options = array(
includes/shortcodes/class-wcj-shortcodes-general.php CHANGED
@@ -66,9 +66,9 @@ class WCJ_General_Shortcodes extends WCJ_Shortcodes {
66
  );
67
 
68
  $this->the_atts = array(
69
- 'date_format' => get_option( 'date_format' ),
70
- 'time_format' => get_option( 'time_format' ),
71
- 'datetime_format' => get_option( 'date_format' ) . ' ' . get_option( 'time_format' ),
72
  'lang' => '',
73
  'form_method' => 'post',
74
  'class' => '',
@@ -133,7 +133,7 @@ class WCJ_General_Shortcodes extends WCJ_Shortcodes {
133
  * @todo [dev] maybe also add `get_site_option()`
134
  */
135
  function wcj_get_option( $atts ) {
136
- $result = ( isset( $atts['name'] ) ? get_option( $atts['name'], ( isset( $atts['default'] ) ? $atts['default'] : false ) ) : '' );
137
  return ( is_array( $result ) ?
138
  ( isset( $atts['field'] ) && isset( $result[ $atts['field'] ] ) ? $result[ $atts['field'] ] : implode( ', ', $result ) ) :
139
  $result );
@@ -251,8 +251,8 @@ class WCJ_General_Shortcodes extends WCJ_Shortcodes {
251
  * @todo `$atts['shipping_class_term_id']` - class term ID is not visible anywhere for admin, so probably need to use `slug` instead
252
  */
253
  function wcj_shipping_time_table( $atts ) {
254
- $do_use_shipping_instances = ( 'yes' === get_option( 'wcj_shipping_time_use_shipping_instance', 'no' ) );
255
- $do_use_shipping_classes = ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_shipping_time_use_shipping_classes', 'no' ) ) );
256
  $shipping_class_term_id = ( isset( $atts['shipping_class_term_id'] ) ? $atts['shipping_class_term_id'] : '0' );
257
  $option_id_shipping_class = ( $do_use_shipping_classes ? '_class_' . $shipping_class_term_id : '' );
258
  return wcj_get_shipping_time_table( $do_use_shipping_instances, $option_id_shipping_class );
@@ -371,7 +371,7 @@ class WCJ_General_Shortcodes extends WCJ_Shortcodes {
371
  * @todo (maybe) `get` instead of `post`
372
  */
373
  function wcj_button_toggle_tax_display( $atts ) {
374
- $current_value = ( '' == ( $session_value = wcj_session_get( 'wcj_toggle_tax_display' ) ) ? get_option( 'woocommerce_tax_display_shop', 'excl' ) : $session_value );
375
  $label = $atts[ 'label_' . $current_value ];
376
  return '<form method="post" action=""><input type="submit" name="wcj_button_toggle_tax_display"' .
377
  ' class="' . $atts['class'] . '" style="' . $atts['style'] . '" value="' . $label . '"></form>';
@@ -407,7 +407,7 @@ class WCJ_General_Shortcodes extends WCJ_Shortcodes {
407
  * @since 3.2.1
408
  */
409
  function wcj_wp_option( $atts ) {
410
- return ( '' != $atts['option'] ? get_option( $atts['option'], $atts['default'] ) : '' );
411
  }
412
 
413
  /**
@@ -448,7 +448,7 @@ class WCJ_General_Shortcodes extends WCJ_Shortcodes {
448
  );
449
  switch ( $atts['selector_type'] ) {
450
  case 'product_custom_visibility':
451
- $options = wcj_get_select_options( get_option( 'wcj_product_custom_visibility_options_list', '' ) );
452
  break;
453
  default: // 'country'
454
  $options = wcj_get_countries();
@@ -483,7 +483,7 @@ class WCJ_General_Shortcodes extends WCJ_Shortcodes {
483
  * @todo (maybe) add similar function
484
  */
485
  function wcj_currency_exchange_rate( $atts ) {
486
- return ( '' != $atts['from'] && '' != $atts['to'] ) ? get_option( 'wcj_currency_exchange_rates_' . sanitize_title( $atts['from'] . $atts['to'] ) ) : '';
487
  }
488
 
489
  /**
@@ -497,7 +497,7 @@ class WCJ_General_Shortcodes extends WCJ_Shortcodes {
497
  $all_currencies = WCJ()->modules['currency_exchange_rates']->get_all_currencies_exchange_rates_settings();
498
  $table_data = array();
499
  foreach ( $all_currencies as $currency ) {
500
- $table_data[] = array( $currency['title'], get_option( $currency['id'] ) );
501
  }
502
  if ( ! empty( $table_data ) ) {
503
  return wcj_get_table_html( $table_data, array( 'table_class' => 'wcj_currency_exchange_rates_table', 'table_heading_type' => 'vertical' ) );
@@ -654,9 +654,9 @@ class WCJ_General_Shortcodes extends WCJ_Shortcodes {
654
  $shortcode_currencies = explode( ',', $shortcode_currencies );
655
  }
656
  if ( empty( $shortcode_currencies ) ) {
657
- $total_number = apply_filters( 'booster_option', 2, get_option( 'wcj_multicurrency_total_number', 2 ) );
658
  for ( $i = 1; $i <= $total_number; $i++ ) {
659
- $shortcode_currencies[] = get_option( 'wcj_multicurrency_currency_' . $i );
660
  }
661
  }
662
  return $shortcode_currencies;
@@ -676,7 +676,7 @@ class WCJ_General_Shortcodes extends WCJ_Shortcodes {
676
 
677
  // Check for user role options
678
  $role_option_name_addon = '';
679
- $user_roles = get_option( 'wcj_wholesale_price_by_user_role_roles', '' );
680
  if ( ! empty( $user_roles ) ) {
681
  $current_user_role = wcj_get_current_user_first_role();
682
  foreach ( $user_roles as $user_role_key ) {
@@ -688,9 +688,9 @@ class WCJ_General_Shortcodes extends WCJ_Shortcodes {
688
  }
689
 
690
  $wholesale_price_levels = array();
691
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_wholesale_price_levels_number' . $role_option_name_addon, 1 ) ); $i++ ) {
692
- $level_qty = get_option( 'wcj_wholesale_price_level_min_qty' . $role_option_name_addon . '_' . $i, PHP_INT_MAX );
693
- $discount = get_option( 'wcj_wholesale_price_level_discount_percent' . $role_option_name_addon . '_' . $i, 0 );
694
  $wholesale_price_levels[] = array( 'quantity' => $level_qty, 'discount' => $discount, );
695
  }
696
 
@@ -709,7 +709,7 @@ class WCJ_General_Shortcodes extends WCJ_Shortcodes {
709
  array( $wholesale_price_level['quantity'], $wholesale_price_level['quantity'], $level_max_qty ),
710
  $atts['heading_format']
711
  );
712
- $data_discount[] = ( 'fixed' === get_option( 'wcj_wholesale_price_discount_type', 'percent' ) )
713
  ? '-' . wc_price( $wholesale_price_level['discount'] ) : '-' . $wholesale_price_level['discount'] . '%';
714
  $columns_styles[] = $atts['columns_style'];
715
  }
@@ -744,11 +744,11 @@ class WCJ_General_Shortcodes extends WCJ_Shortcodes {
744
  if ( null !== ( $session_value = wcj_session_get( 'wcj-currency' ) ) ) {
745
  $selected_currency = $session_value;
746
  } else {
747
- $module_roles = get_option( 'wcj_multicurrency_role_defaults_roles', '' );
748
  if ( ! empty( $module_roles ) ) {
749
  $current_user_role = wcj_get_current_user_first_role();
750
  if ( in_array( $current_user_role, $module_roles ) ) {
751
- $selected_currency = get_option( 'wcj_multicurrency_role_defaults_' . $current_user_role, '' );
752
  }
753
  }
754
  }
@@ -757,7 +757,7 @@ class WCJ_General_Shortcodes extends WCJ_Shortcodes {
757
  }
758
  $links = array();
759
  $first_link = '';
760
- $switcher_template = get_option( 'wcj_multicurrency_switcher_template', '%currency_name% (%currency_symbol%)' );
761
  foreach ( $shortcode_currencies as $currency_code ) {
762
  if ( isset( $currencies[ $currency_code ] ) ) {
763
  $template_replaced_values = array(
@@ -824,11 +824,11 @@ class WCJ_General_Shortcodes extends WCJ_Shortcodes {
824
  if ( null !== ( $session_value = wcj_session_get( 'wcj-currency' ) ) ) {
825
  $selected_currency = $session_value;
826
  } else {
827
- $module_roles = get_option( 'wcj_multicurrency_role_defaults_roles', '' );
828
  if ( ! empty( $module_roles ) ) {
829
  $current_user_role = wcj_get_current_user_first_role();
830
  if ( in_array( $current_user_role, $module_roles ) ) {
831
- $selected_currency = get_option( 'wcj_multicurrency_role_defaults_' . $current_user_role, '' );
832
  }
833
  }
834
  }
@@ -836,7 +836,7 @@ class WCJ_General_Shortcodes extends WCJ_Shortcodes {
836
  wcj_session_set( 'wcj-currency', $atts['default'] );
837
  $selected_currency = $atts['default'];
838
  }
839
- $switcher_template = get_option( 'wcj_multicurrency_switcher_template', '%currency_name% (%currency_symbol%)' );
840
  foreach ( $shortcode_currencies as $currency_code ) {
841
  if ( isset( $currencies[ $currency_code ] ) ) {
842
  $template_replaced_values = array(
@@ -909,14 +909,14 @@ class WCJ_General_Shortcodes extends WCJ_Shortcodes {
909
  $html .= '<select name="wcj-country" id="wcj-country" style="' . $select_style . '" class="' . $select_class . '" onchange="this.form.submit()">';
910
  if ( empty( $shortcode_countries ) ) {
911
  foreach ( $countries as $country_code => $country_name ) {
912
- $data_icon = ( 'yes' === get_option( 'wcj_price_by_country_jquery_wselect_enabled', 'no' ) ? ' data-icon="' . wcj_plugin_url() . '/assets/images/flag-icons/' . strtolower( $country_code ) . '.png"' : '' );
913
  $option_label = ( 'yes' === $atts['replace_with_currency'] ) ? $currencies_names_and_symbols[ wcj_get_currency_by_country( $country_code ) ] : $country_name;
914
  $html .= '<option' . $data_icon . ' value="' . $country_code . '" ' . selected( $country_code, $selected_country, false ) . '>' . $option_label . '</option>';
915
  }
916
  } else {
917
  foreach ( $shortcode_countries as $country_code ) {
918
  if ( isset( $countries[ $country_code ] ) ) {
919
- $data_icon = ( 'yes' === get_option( 'wcj_price_by_country_jquery_wselect_enabled', 'no' ) ? ' data-icon="' . wcj_plugin_url() . '/assets/images/flag-icons/' . strtolower( $country_code ) . '.png"' : '' );
920
  $option_label = ( 'yes' === $atts['replace_with_currency'] ) ? $currencies_names_and_symbols[ wcj_get_currency_by_country( $country_code ) ] : $countries[ $country_code ];
921
  $html .= '<option' . $data_icon . ' value="' . $country_code . '" ' . selected( $country_code, $selected_country, false ) . '>' . $option_label . '</option>';
922
  }
66
  );
67
 
68
  $this->the_atts = array(
69
+ 'date_format' => wcj_get_option( 'date_format' ),
70
+ 'time_format' => wcj_get_option( 'time_format' ),
71
+ 'datetime_format' => wcj_get_option( 'date_format' ) . ' ' . wcj_get_option( 'time_format' ),
72
  'lang' => '',
73
  'form_method' => 'post',
74
  'class' => '',
133
  * @todo [dev] maybe also add `get_site_option()`
134
  */
135
  function wcj_get_option( $atts ) {
136
+ $result = ( isset( $atts['name'] ) ? wcj_get_option( $atts['name'], ( isset( $atts['default'] ) ? $atts['default'] : false ) ) : '' );
137
  return ( is_array( $result ) ?
138
  ( isset( $atts['field'] ) && isset( $result[ $atts['field'] ] ) ? $result[ $atts['field'] ] : implode( ', ', $result ) ) :
139
  $result );
251
  * @todo `$atts['shipping_class_term_id']` - class term ID is not visible anywhere for admin, so probably need to use `slug` instead
252
  */
253
  function wcj_shipping_time_table( $atts ) {
254
+ $do_use_shipping_instances = ( 'yes' === wcj_get_option( 'wcj_shipping_time_use_shipping_instance', 'no' ) );
255
+ $do_use_shipping_classes = ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_shipping_time_use_shipping_classes', 'no' ) ) );
256
  $shipping_class_term_id = ( isset( $atts['shipping_class_term_id'] ) ? $atts['shipping_class_term_id'] : '0' );
257
  $option_id_shipping_class = ( $do_use_shipping_classes ? '_class_' . $shipping_class_term_id : '' );
258
  return wcj_get_shipping_time_table( $do_use_shipping_instances, $option_id_shipping_class );
371
  * @todo (maybe) `get` instead of `post`
372
  */
373
  function wcj_button_toggle_tax_display( $atts ) {
374
+ $current_value = ( '' == ( $session_value = wcj_session_get( 'wcj_toggle_tax_display' ) ) ? wcj_get_option( 'woocommerce_tax_display_shop', 'excl' ) : $session_value );
375
  $label = $atts[ 'label_' . $current_value ];
376
  return '<form method="post" action=""><input type="submit" name="wcj_button_toggle_tax_display"' .
377
  ' class="' . $atts['class'] . '" style="' . $atts['style'] . '" value="' . $label . '"></form>';
407
  * @since 3.2.1
408
  */
409
  function wcj_wp_option( $atts ) {
410
+ return ( '' != $atts['option'] ? wcj_get_option( $atts['option'], $atts['default'] ) : '' );
411
  }
412
 
413
  /**
448
  );
449
  switch ( $atts['selector_type'] ) {
450
  case 'product_custom_visibility':
451
+ $options = wcj_get_select_options( wcj_get_option( 'wcj_product_custom_visibility_options_list', '' ) );
452
  break;
453
  default: // 'country'
454
  $options = wcj_get_countries();
483
  * @todo (maybe) add similar function
484
  */
485
  function wcj_currency_exchange_rate( $atts ) {
486
+ return ( '' != $atts['from'] && '' != $atts['to'] ) ? wcj_get_option( 'wcj_currency_exchange_rates_' . sanitize_title( $atts['from'] . $atts['to'] ) ) : '';
487
  }
488
 
489
  /**
497
  $all_currencies = WCJ()->modules['currency_exchange_rates']->get_all_currencies_exchange_rates_settings();
498
  $table_data = array();
499
  foreach ( $all_currencies as $currency ) {
500
+ $table_data[] = array( $currency['title'], wcj_get_option( $currency['id'] ) );
501
  }
502
  if ( ! empty( $table_data ) ) {
503
  return wcj_get_table_html( $table_data, array( 'table_class' => 'wcj_currency_exchange_rates_table', 'table_heading_type' => 'vertical' ) );
654
  $shortcode_currencies = explode( ',', $shortcode_currencies );
655
  }
656
  if ( empty( $shortcode_currencies ) ) {
657
+ $total_number = apply_filters( 'booster_option', 2, wcj_get_option( 'wcj_multicurrency_total_number', 2 ) );
658
  for ( $i = 1; $i <= $total_number; $i++ ) {
659
+ $shortcode_currencies[] = wcj_get_option( 'wcj_multicurrency_currency_' . $i );
660
  }
661
  }
662
  return $shortcode_currencies;
676
 
677
  // Check for user role options
678
  $role_option_name_addon = '';
679
+ $user_roles = wcj_get_option( 'wcj_wholesale_price_by_user_role_roles', '' );
680
  if ( ! empty( $user_roles ) ) {
681
  $current_user_role = wcj_get_current_user_first_role();
682
  foreach ( $user_roles as $user_role_key ) {
688
  }
689
 
690
  $wholesale_price_levels = array();
691
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_wholesale_price_levels_number' . $role_option_name_addon, 1 ) ); $i++ ) {
692
+ $level_qty = wcj_get_option( 'wcj_wholesale_price_level_min_qty' . $role_option_name_addon . '_' . $i, PHP_INT_MAX );
693
+ $discount = wcj_get_option( 'wcj_wholesale_price_level_discount_percent' . $role_option_name_addon . '_' . $i, 0 );
694
  $wholesale_price_levels[] = array( 'quantity' => $level_qty, 'discount' => $discount, );
695
  }
696
 
709
  array( $wholesale_price_level['quantity'], $wholesale_price_level['quantity'], $level_max_qty ),
710
  $atts['heading_format']
711
  );
712
+ $data_discount[] = ( 'fixed' === wcj_get_option( 'wcj_wholesale_price_discount_type', 'percent' ) )
713
  ? '-' . wc_price( $wholesale_price_level['discount'] ) : '-' . $wholesale_price_level['discount'] . '%';
714
  $columns_styles[] = $atts['columns_style'];
715
  }
744
  if ( null !== ( $session_value = wcj_session_get( 'wcj-currency' ) ) ) {
745
  $selected_currency = $session_value;
746
  } else {
747
+ $module_roles = wcj_get_option( 'wcj_multicurrency_role_defaults_roles', '' );
748
  if ( ! empty( $module_roles ) ) {
749
  $current_user_role = wcj_get_current_user_first_role();
750
  if ( in_array( $current_user_role, $module_roles ) ) {
751
+ $selected_currency = wcj_get_option( 'wcj_multicurrency_role_defaults_' . $current_user_role, '' );
752
  }
753
  }
754
  }
757
  }
758
  $links = array();
759
  $first_link = '';
760
+ $switcher_template = wcj_get_option( 'wcj_multicurrency_switcher_template', '%currency_name% (%currency_symbol%)' );
761
  foreach ( $shortcode_currencies as $currency_code ) {
762
  if ( isset( $currencies[ $currency_code ] ) ) {
763
  $template_replaced_values = array(
824
  if ( null !== ( $session_value = wcj_session_get( 'wcj-currency' ) ) ) {
825
  $selected_currency = $session_value;
826
  } else {
827
+ $module_roles = wcj_get_option( 'wcj_multicurrency_role_defaults_roles', '' );
828
  if ( ! empty( $module_roles ) ) {
829
  $current_user_role = wcj_get_current_user_first_role();
830
  if ( in_array( $current_user_role, $module_roles ) ) {
831
+ $selected_currency = wcj_get_option( 'wcj_multicurrency_role_defaults_' . $current_user_role, '' );
832
  }
833
  }
834
  }
836
  wcj_session_set( 'wcj-currency', $atts['default'] );
837
  $selected_currency = $atts['default'];
838
  }
839
+ $switcher_template = wcj_get_option( 'wcj_multicurrency_switcher_template', '%currency_name% (%currency_symbol%)' );
840
  foreach ( $shortcode_currencies as $currency_code ) {
841
  if ( isset( $currencies[ $currency_code ] ) ) {
842
  $template_replaced_values = array(
909
  $html .= '<select name="wcj-country" id="wcj-country" style="' . $select_style . '" class="' . $select_class . '" onchange="this.form.submit()">';
910
  if ( empty( $shortcode_countries ) ) {
911
  foreach ( $countries as $country_code => $country_name ) {
912
+ $data_icon = ( 'yes' === wcj_get_option( 'wcj_price_by_country_jquery_wselect_enabled', 'no' ) ? ' data-icon="' . wcj_plugin_url() . '/assets/images/flag-icons/' . strtolower( $country_code ) . '.png"' : '' );
913
  $option_label = ( 'yes' === $atts['replace_with_currency'] ) ? $currencies_names_and_symbols[ wcj_get_currency_by_country( $country_code ) ] : $country_name;
914
  $html .= '<option' . $data_icon . ' value="' . $country_code . '" ' . selected( $country_code, $selected_country, false ) . '>' . $option_label . '</option>';
915
  }
916
  } else {
917
  foreach ( $shortcode_countries as $country_code ) {
918
  if ( isset( $countries[ $country_code ] ) ) {
919
+ $data_icon = ( 'yes' === wcj_get_option( 'wcj_price_by_country_jquery_wselect_enabled', 'no' ) ? ' data-icon="' . wcj_plugin_url() . '/assets/images/flag-icons/' . strtolower( $country_code ) . '.png"' : '' );
920
  $option_label = ( 'yes' === $atts['replace_with_currency'] ) ? $currencies_names_and_symbols[ wcj_get_currency_by_country( $country_code ) ] : $countries[ $country_code ];
921
  $html .= '<option' . $data_icon . ' value="' . $country_code . '" ' . selected( $country_code, $selected_country, false ) . '>' . $option_label . '</option>';
922
  }
includes/shortcodes/class-wcj-shortcodes-invoices.php CHANGED
@@ -37,7 +37,7 @@ class WCJ_Invoices_Shortcodes extends WCJ_Shortcodes {
37
 
38
  $this->the_atts = array(
39
  'order_id' => 0,
40
- 'date_format' => get_option( 'date_format' ),
41
  'days' => 0,
42
  'invoice_type' => 'invoice',
43
  'doc_nr' => 1,
37
 
38
  $this->the_atts = array(
39
  'order_id' => 0,
40
+ 'date_format' => wcj_get_option( 'date_format' ),
41
  'days' => 0,
42
  'invoice_type' => 'invoice',
43
  'doc_nr' => 1,
includes/shortcodes/class-wcj-shortcodes-order-items.php CHANGED
@@ -451,9 +451,9 @@ class WCJ_Order_Items_Shortcodes extends WCJ_Shortcodes {
451
  */
452
  function get_product_item_name( $item ) {
453
  $item_name = $item['name'];
454
- if ( 'yes' == get_option( 'wcj_pdf_invoicing_advanced_item_name_as_prod_title_enable', 'no' ) ) {
455
  if (
456
- 'yes' == get_option( 'wcj_pdf_invoicing_advanced_item_name_as_prod_title_wpml', 'no' )
457
  && function_exists( 'icl_object_id' )
458
  ) {
459
  $item_name = get_the_title( icl_object_id( $item->get_product_ID(), 'product', false, ICL_LANGUAGE_CODE ) );
@@ -529,7 +529,7 @@ class WCJ_Order_Items_Shortcodes extends WCJ_Shortcodes {
529
  $the_item_title .= '</div>';
530
  }
531
  // "WooCommerce TM Extra Product Options" plugin options
532
- if ( 'yes' === get_option( 'wcj_general_advanced_wcepo_enable', 'yes' ) ) {
533
  $tmcartepo_data = ( WCJ_IS_WC_VERSION_BELOW_3 ?
534
  ( isset( $item['tmcartepo_data'] ) ? maybe_unserialize( $item['tmcartepo_data'] ) : '' ) :
535
  $item->get_meta( '_tmcartepo_data' )
451
  */
452
  function get_product_item_name( $item ) {
453
  $item_name = $item['name'];
454
+ if ( 'yes' == wcj_get_option( 'wcj_pdf_invoicing_advanced_item_name_as_prod_title_enable', 'no' ) ) {
455
  if (
456
+ 'yes' == wcj_get_option( 'wcj_pdf_invoicing_advanced_item_name_as_prod_title_wpml', 'no' )
457
  && function_exists( 'icl_object_id' )
458
  ) {
459
  $item_name = get_the_title( icl_object_id( $item->get_product_ID(), 'product', false, ICL_LANGUAGE_CODE ) );
529
  $the_item_title .= '</div>';
530
  }
531
  // "WooCommerce TM Extra Product Options" plugin options
532
+ if ( 'yes' === wcj_get_option( 'wcj_general_advanced_wcepo_enable', 'yes' ) ) {
533
  $tmcartepo_data = ( WCJ_IS_WC_VERSION_BELOW_3 ?
534
  ( isset( $item['tmcartepo_data'] ) ? maybe_unserialize( $item['tmcartepo_data'] ) : '' ) :
535
  $item->get_meta( '_tmcartepo_data' )
includes/shortcodes/class-wcj-shortcodes-orders.php CHANGED
@@ -106,8 +106,8 @@ class WCJ_Orders_Shortcodes extends WCJ_Shortcodes {
106
  'order_id' => 0,
107
  'hide_currency' => 'no',
108
  'excl_tax' => 'no',
109
- 'date_format' => get_option( 'date_format' ),
110
- 'time_format' => get_option( 'time_format' ),
111
  'hide_if_zero' => 'no',
112
  'add_html_on_price' => true,
113
  'field_id' => '',
@@ -115,7 +115,7 @@ class WCJ_Orders_Shortcodes extends WCJ_Shortcodes {
115
  'round_by_line' => 'no',
116
  'whole' => '',
117
  'decimal' => '&cent;',
118
- 'precision' => get_option( 'woocommerce_price_num_decimals', 2 ),
119
  'lang' => 'EN',
120
  'unique_only' => 'no',
121
  'function_name' => '',
@@ -215,7 +215,7 @@ class WCJ_Orders_Shortcodes extends WCJ_Shortcodes {
215
  } else {
216
  $convert_to_currency = $atts['currency'];
217
  if ( '%shop_currency%' === $convert_to_currency ) {
218
- $convert_to_currency = get_option( 'woocommerce_currency' );
219
  }
220
  return wcj_price( $raw_price * wcj_get_saved_exchange_rate( $order_currency, $convert_to_currency ), $convert_to_currency, $atts['hide_currency'], $atts );
221
  }
@@ -242,7 +242,7 @@ class WCJ_Orders_Shortcodes extends WCJ_Shortcodes {
242
  function wcj_order_profit( $atts ) {
243
  $total = 0;
244
  foreach ( $this->the_order->get_items() as $item_id => $item ) {
245
- $product_id = ( ( isset( $item['variation_id'] ) && 0 != $item['variation_id'] && 'no' === get_option( 'wcj_purchase_data_variable_as_simple_enabled', 'no' ) )
246
  ? $item['variation_id'] : $item['product_id'] );
247
  $value = 0;
248
  if ( 0 != ( $purchase_price = wc_get_product_purchase_price( $product_id ) ) ) {
@@ -335,11 +335,11 @@ class WCJ_Orders_Shortcodes extends WCJ_Shortcodes {
335
  /* translators: 1: refund id 2: refund date */
336
  esc_html__( 'Refund #%1$s - %2$s', 'woocommerce' ),
337
  esc_html( $_refund->get_id() ),
338
- esc_html( wc_format_datetime( $_refund->get_date_created(), get_option( 'date_format' ) . ', ' . get_option( 'time_format' ) ) )
339
  );
340
  break;
341
  case 'refund_date':
342
- $cell = esc_html( wc_format_datetime( $_refund->get_date_created(), get_option( 'date_format' ) . ', ' . get_option( 'time_format' ) ) );
343
  break;
344
  case 'refund_reason':
345
  $cell = $_refund->get_reason();
106
  'order_id' => 0,
107
  'hide_currency' => 'no',
108
  'excl_tax' => 'no',
109
+ 'date_format' => wcj_get_option( 'date_format' ),
110
+ 'time_format' => wcj_get_option( 'time_format' ),
111
  'hide_if_zero' => 'no',
112
  'add_html_on_price' => true,
113
  'field_id' => '',
115
  'round_by_line' => 'no',
116
  'whole' => '',
117
  'decimal' => '&cent;',
118
+ 'precision' => wcj_get_option( 'woocommerce_price_num_decimals', 2 ),
119
  'lang' => 'EN',
120
  'unique_only' => 'no',
121
  'function_name' => '',
215
  } else {
216
  $convert_to_currency = $atts['currency'];
217
  if ( '%shop_currency%' === $convert_to_currency ) {
218
+ $convert_to_currency = wcj_get_option( 'woocommerce_currency' );
219
  }
220
  return wcj_price( $raw_price * wcj_get_saved_exchange_rate( $order_currency, $convert_to_currency ), $convert_to_currency, $atts['hide_currency'], $atts );
221
  }
242
  function wcj_order_profit( $atts ) {
243
  $total = 0;
244
  foreach ( $this->the_order->get_items() as $item_id => $item ) {
245
+ $product_id = ( ( isset( $item['variation_id'] ) && 0 != $item['variation_id'] && 'no' === wcj_get_option( 'wcj_purchase_data_variable_as_simple_enabled', 'no' ) )
246
  ? $item['variation_id'] : $item['product_id'] );
247
  $value = 0;
248
  if ( 0 != ( $purchase_price = wc_get_product_purchase_price( $product_id ) ) ) {
335
  /* translators: 1: refund id 2: refund date */
336
  esc_html__( 'Refund #%1$s - %2$s', 'woocommerce' ),
337
  esc_html( $_refund->get_id() ),
338
+ esc_html( wc_format_datetime( $_refund->get_date_created(), wcj_get_option( 'date_format' ) . ', ' . wcj_get_option( 'time_format' ) ) )
339
  );
340
  break;
341
  case 'refund_date':
342
+ $cell = esc_html( wc_format_datetime( $_refund->get_date_created(), wcj_get_option( 'date_format' ) . ', ' . wcj_get_option( 'time_format' ) ) );
343
  break;
344
  case 'refund_reason':
345
  $cell = $_refund->get_reason();
includes/shortcodes/class-wcj-shortcodes-products-add-form.php CHANGED
@@ -29,42 +29,42 @@ class WCJ_Products_Add_Form_Shortcodes extends WCJ_Shortcodes {
29
 
30
  $this->the_atts = array(
31
  'product_id' => 0,
32
- 'post_status' => get_option( 'wcj_product_by_user_status', 'draft' ),
33
-
34
- 'desc_enabled' => get_option( 'wcj_product_by_user_desc_enabled', 'no' ),
35
- 'short_desc_enabled' => get_option( 'wcj_product_by_user_short_desc_enabled', 'no' ),
36
- 'regular_price_enabled' => get_option( 'wcj_product_by_user_regular_price_enabled', 'no' ),
37
- 'sale_price_enabled' => get_option( 'wcj_product_by_user_sale_price_enabled', 'no' ),
38
- 'external_url_enabled' => get_option( 'wcj_product_by_user_external_url_enabled', 'no' ),
39
- 'cats_enabled' => get_option( 'wcj_product_by_user_cats_enabled', 'no' ),
40
- 'tags_enabled' => get_option( 'wcj_product_by_user_tags_enabled', 'no' ),
41
- 'image_enabled' => apply_filters( 'booster_option', 'no', get_option( 'wcj_product_by_user_image_enabled', 'no' ) ),
42
-
43
- 'desc_required' => get_option( 'wcj_product_by_user_desc_required', 'no' ),
44
- 'short_desc_required' => get_option( 'wcj_product_by_user_short_desc_required', 'no' ),
45
- 'regular_price_required' => get_option( 'wcj_product_by_user_regular_price_required', 'no' ),
46
- 'sale_price_required' => get_option( 'wcj_product_by_user_sale_price_required', 'no' ),
47
- 'external_url_required' => get_option( 'wcj_product_by_user_external_url_required', 'no' ),
48
- 'cats_required' => get_option( 'wcj_product_by_user_cats_required', 'no' ),
49
- 'tags_required' => get_option( 'wcj_product_by_user_tags_required', 'no' ),
50
- 'image_required' => apply_filters( 'booster_option', 'no', get_option( 'wcj_product_by_user_image_required', 'no' ) ),
51
-
52
- 'visibility' => implode( ',', get_option( 'wcj_product_by_user_user_visibility', array() ) ),
53
  'module' => 'product_by_user',
54
  'module_name' => __( 'Product by User', 'woocommerce-jetpack' ),
55
  );
56
 
57
- if ( 'external' !== get_option( 'wcj_product_by_user_product_type', 'simple' ) ) {
58
  $this->the_atts['external_url_enabled'] = 'no';
59
  $this->the_atts['external_url_required'] = 'no';
60
  }
61
 
62
- $this->the_atts['custom_taxonomies_total'] = apply_filters( 'booster_option', 1, get_option( 'wcj_product_by_user_custom_taxonomies_total', 1 ) );
63
  for ( $i = 1; $i <= $this->the_atts['custom_taxonomies_total']; $i++ ) {
64
- $this->the_atts[ 'custom_taxonomy_' . $i . '_enabled' ] = get_option( 'wcj_product_by_user_custom_taxonomy_' . $i . '_enabled', 'no' );
65
- $this->the_atts[ 'custom_taxonomy_' . $i . '_required' ] = get_option( 'wcj_product_by_user_custom_taxonomy_' . $i . '_required', 'no' );
66
- $this->the_atts[ 'custom_taxonomy_' . $i . '_id' ] = get_option( 'wcj_product_by_user_custom_taxonomy_' . $i . '_id', '' );
67
- $this->the_atts[ 'custom_taxonomy_' . $i . '_title' ] = get_option( 'wcj_product_by_user_custom_taxonomy_' . $i . '_title', '' );
68
  }
69
 
70
  parent::__construct();
@@ -97,7 +97,7 @@ class WCJ_Products_Add_Form_Shortcodes extends WCJ_Shortcodes {
97
  // Insert the post into the database
98
  if ( 0 != $product_id ) {
99
 
100
- wp_set_object_terms( $product_id, get_option( 'wcj_product_by_user_product_type', 'simple' ), 'product_type' );
101
  wp_set_object_terms( $product_id, $args['cats'], 'product_cat' );
102
  wp_set_object_terms( $product_id, $args['tags'], 'product_tag' );
103
 
@@ -117,7 +117,7 @@ class WCJ_Products_Add_Form_Shortcodes extends WCJ_Shortcodes {
117
  update_post_meta( $product_id, '_visibility', 'visible' );
118
  update_post_meta( $product_id, '_stock_status', 'instock' );
119
 
120
- if ( 'external' === get_option( 'wcj_product_by_user_product_type', 'simple' ) ) {
121
  update_post_meta( $product_id, '_product_url', $args['external_url'] );
122
  }
123
 
@@ -163,7 +163,7 @@ class WCJ_Products_Add_Form_Shortcodes extends WCJ_Shortcodes {
163
  $errors .= '<li>' . __( 'Title is required!', 'woocommerce-jetpack' ) . '</li>';
164
  }
165
 
166
- if ( 'yes' === get_option( 'wcj_product_by_user_require_unique_title', 'no' ) && 0 == $shortcode_atts['product_id'] ) {
167
  if ( ! function_exists( 'post_exists' ) ) {
168
  require_once( ABSPATH . 'wp-admin/includes/post.php' );
169
  }
@@ -326,7 +326,7 @@ class WCJ_Products_Add_Form_Shortcodes extends WCJ_Shortcodes {
326
 
327
  $required_mark_html_template = '&nbsp;<abbr class="required" title="' . __( 'required', 'woocommerce-jetpack' ) . '">*</abbr>';
328
 
329
- $price_step = sprintf( "%f", ( 1 / pow( 10, get_option( 'wcj_product_by_user_price_step', get_option( 'woocommerce_price_num_decimals', 2 ) ) ) ) );
330
 
331
  $table_data = array();
332
  $input_style = 'width:100%;';
29
 
30
  $this->the_atts = array(
31
  'product_id' => 0,
32
+ 'post_status' => wcj_get_option( 'wcj_product_by_user_status', 'draft' ),
33
+
34
+ 'desc_enabled' => wcj_get_option( 'wcj_product_by_user_desc_enabled', 'no' ),
35
+ 'short_desc_enabled' => wcj_get_option( 'wcj_product_by_user_short_desc_enabled', 'no' ),
36
+ 'regular_price_enabled' => wcj_get_option( 'wcj_product_by_user_regular_price_enabled', 'no' ),
37
+ 'sale_price_enabled' => wcj_get_option( 'wcj_product_by_user_sale_price_enabled', 'no' ),
38
+ 'external_url_enabled' => wcj_get_option( 'wcj_product_by_user_external_url_enabled', 'no' ),
39
+ 'cats_enabled' => wcj_get_option( 'wcj_product_by_user_cats_enabled', 'no' ),
40
+ 'tags_enabled' => wcj_get_option( 'wcj_product_by_user_tags_enabled', 'no' ),
41
+ 'image_enabled' => apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_product_by_user_image_enabled', 'no' ) ),
42
+
43
+ 'desc_required' => wcj_get_option( 'wcj_product_by_user_desc_required', 'no' ),
44
+ 'short_desc_required' => wcj_get_option( 'wcj_product_by_user_short_desc_required', 'no' ),
45
+ 'regular_price_required' => wcj_get_option( 'wcj_product_by_user_regular_price_required', 'no' ),
46
+ 'sale_price_required' => wcj_get_option( 'wcj_product_by_user_sale_price_required', 'no' ),
47
+ 'external_url_required' => wcj_get_option( 'wcj_product_by_user_external_url_required', 'no' ),
48
+ 'cats_required' => wcj_get_option( 'wcj_product_by_user_cats_required', 'no' ),
49
+ 'tags_required' => wcj_get_option( 'wcj_product_by_user_tags_required', 'no' ),
50
+ 'image_required' => apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_product_by_user_image_required', 'no' ) ),
51
+
52
+ 'visibility' => implode( ',', wcj_get_option( 'wcj_product_by_user_user_visibility', array() ) ),
53
  'module' => 'product_by_user',
54
  'module_name' => __( 'Product by User', 'woocommerce-jetpack' ),
55
  );
56
 
57
+ if ( 'external' !== wcj_get_option( 'wcj_product_by_user_product_type', 'simple' ) ) {
58
  $this->the_atts['external_url_enabled'] = 'no';
59
  $this->the_atts['external_url_required'] = 'no';
60
  }
61
 
62
+ $this->the_atts['custom_taxonomies_total'] = apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_product_by_user_custom_taxonomies_total', 1 ) );
63
  for ( $i = 1; $i <= $this->the_atts['custom_taxonomies_total']; $i++ ) {
64
+ $this->the_atts[ 'custom_taxonomy_' . $i . '_enabled' ] = wcj_get_option( 'wcj_product_by_user_custom_taxonomy_' . $i . '_enabled', 'no' );
65
+ $this->the_atts[ 'custom_taxonomy_' . $i . '_required' ] = wcj_get_option( 'wcj_product_by_user_custom_taxonomy_' . $i . '_required', 'no' );
66
+ $this->the_atts[ 'custom_taxonomy_' . $i . '_id' ] = wcj_get_option( 'wcj_product_by_user_custom_taxonomy_' . $i . '_id', '' );
67
+ $this->the_atts[ 'custom_taxonomy_' . $i . '_title' ] = wcj_get_option( 'wcj_product_by_user_custom_taxonomy_' . $i . '_title', '' );
68
  }
69
 
70
  parent::__construct();
97
  // Insert the post into the database
98
  if ( 0 != $product_id ) {
99
 
100
+ wp_set_object_terms( $product_id, wcj_get_option( 'wcj_product_by_user_product_type', 'simple' ), 'product_type' );
101
  wp_set_object_terms( $product_id, $args['cats'], 'product_cat' );
102
  wp_set_object_terms( $product_id, $args['tags'], 'product_tag' );
103
 
117
  update_post_meta( $product_id, '_visibility', 'visible' );
118
  update_post_meta( $product_id, '_stock_status', 'instock' );
119
 
120
+ if ( 'external' === wcj_get_option( 'wcj_product_by_user_product_type', 'simple' ) ) {
121
  update_post_meta( $product_id, '_product_url', $args['external_url'] );
122
  }
123
 
163
  $errors .= '<li>' . __( 'Title is required!', 'woocommerce-jetpack' ) . '</li>';
164
  }
165
 
166
+ if ( 'yes' === wcj_get_option( 'wcj_product_by_user_require_unique_title', 'no' ) && 0 == $shortcode_atts['product_id'] ) {
167
  if ( ! function_exists( 'post_exists' ) ) {
168
  require_once( ABSPATH . 'wp-admin/includes/post.php' );
169
  }
326
 
327
  $required_mark_html_template = '&nbsp;<abbr class="required" title="' . __( 'required', 'woocommerce-jetpack' ) . '">*</abbr>';
328
 
329
+ $price_step = sprintf( "%f", ( 1 / pow( 10, wcj_get_option( 'wcj_product_by_user_price_step', wcj_get_option( 'woocommerce_price_num_decimals', 2 ) ) ) ) );
330
 
331
  $table_data = array();
332
  $input_style = 'width:100%;';
includes/shortcodes/class-wcj-shortcodes-products-crowdfunding.php CHANGED
@@ -187,7 +187,7 @@ class WCJ_Products_Crowdfunding_Shortcodes extends WCJ_Shortcodes {
187
  * @since 2.2.6
188
  */
189
  function wcj_product_crowdfunding_startdate( $atts ) {
190
- return date_i18n( get_option( 'date_format' ), strtotime( get_post_meta( wcj_get_product_id_or_variation_parent_id( $this->the_product ), '_' . 'wcj_crowdfunding_startdate', true ) ) );
191
  }
192
 
193
  /**
@@ -197,7 +197,7 @@ class WCJ_Products_Crowdfunding_Shortcodes extends WCJ_Shortcodes {
197
  * @since 2.2.6
198
  */
199
  function wcj_product_crowdfunding_deadline( $atts ) {
200
- return date_i18n( get_option( 'date_format' ), strtotime( get_post_meta( wcj_get_product_id_or_variation_parent_id( $this->the_product ), '_' . 'wcj_crowdfunding_deadline', true ) ) );
201
  }
202
 
203
  /**
187
  * @since 2.2.6
188
  */
189
  function wcj_product_crowdfunding_startdate( $atts ) {
190
+ return date_i18n( wcj_get_option( 'date_format' ), strtotime( get_post_meta( wcj_get_product_id_or_variation_parent_id( $this->the_product ), '_' . 'wcj_crowdfunding_startdate', true ) ) );
191
  }
192
 
193
  /**
197
  * @since 2.2.6
198
  */
199
  function wcj_product_crowdfunding_deadline( $atts ) {
200
+ return date_i18n( wcj_get_option( 'date_format' ), strtotime( get_post_meta( wcj_get_product_id_or_variation_parent_id( $this->the_product ), '_' . 'wcj_crowdfunding_deadline', true ) ) );
201
  }
202
 
203
  /**
includes/shortcodes/class-wcj-shortcodes-products.php CHANGED
@@ -603,8 +603,8 @@ class WCJ_Products_Shortcodes extends WCJ_Shortcodes {
603
  * @todo explode "from-to"
604
  */
605
  function wcj_product_shipping_time_table( $atts ) {
606
- $do_use_shipping_instances = ( 'yes' === get_option( 'wcj_shipping_time_use_shipping_instance', 'no' ) );
607
- $do_use_shipping_classes = ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_shipping_time_use_shipping_classes', 'no' ) ) );
608
  $option_id_shipping_class = ( $do_use_shipping_classes ? '_class_' . wcj_get_product_shipping_class_term_id( $this->the_product ) : '' );
609
  return wcj_get_shipping_time_table( $do_use_shipping_instances, $option_id_shipping_class );
610
  }
@@ -870,7 +870,7 @@ class WCJ_Products_Shortcodes extends WCJ_Shortcodes {
870
 
871
  // Check for user role options
872
  $role_option_name_addon = '';
873
- $user_roles = get_option( 'wcj_wholesale_price_by_user_role_roles', '' );
874
  if ( ! empty( $user_roles ) ) {
875
  $current_user_role = wcj_get_current_user_first_role();
876
  foreach ( $user_roles as $user_role_key ) {
@@ -894,9 +894,9 @@ class WCJ_Products_Shortcodes extends WCJ_Shortcodes {
894
  $wholesale_price_levels[] = array( 'quantity' => $level_qty, 'discount' => (float) $discount, );
895
  }
896
  } else {
897
- for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_option( 'wcj_wholesale_price_levels_number' . $role_option_name_addon, 1 ) ); $i++ ) {
898
- $level_qty = get_option( 'wcj_wholesale_price_level_min_qty' . $role_option_name_addon . '_' . $i, PHP_INT_MAX );
899
- $discount = get_option( 'wcj_wholesale_price_level_discount_percent' . $role_option_name_addon . '_' . $i, 0 );
900
  $discount = ! empty( $discount ) ? $discount : 0;
901
  $wholesale_price_levels[] = array( 'quantity' => $level_qty, 'discount' => (float) $discount, );
902
  }
@@ -970,7 +970,7 @@ class WCJ_Products_Shortcodes extends WCJ_Shortcodes {
970
  }
971
 
972
  // Heading Format
973
- $atts['heading_format'] = 'from %level_min_qty% pcs.' === $atts['heading_format'] ? get_option( 'wcj_wholesale_price_table_sc_title_format', __( 'from %level_min_qty% pcs.', 'woocommerce-jetpack' ) ) : $atts['heading_format'];
974
 
975
  $level_max_qty = ( isset( $wholesale_price_levels[ $i + 1 ]['quantity'] ) ) ?
976
  $atts['before_level_max_qty'] . ( $wholesale_price_levels[ $i + 1 ]['quantity'] - 1 ) : $atts['last_level_max_qty'];
603
  * @todo explode "from-to"
604
  */
605
  function wcj_product_shipping_time_table( $atts ) {
606
+ $do_use_shipping_instances = ( 'yes' === wcj_get_option( 'wcj_shipping_time_use_shipping_instance', 'no' ) );
607
+ $do_use_shipping_classes = ( 'yes' === apply_filters( 'booster_option', 'no', wcj_get_option( 'wcj_shipping_time_use_shipping_classes', 'no' ) ) );
608
  $option_id_shipping_class = ( $do_use_shipping_classes ? '_class_' . wcj_get_product_shipping_class_term_id( $this->the_product ) : '' );
609
  return wcj_get_shipping_time_table( $do_use_shipping_instances, $option_id_shipping_class );
610
  }
870
 
871
  // Check for user role options
872
  $role_option_name_addon = '';
873
+ $user_roles = wcj_get_option( 'wcj_wholesale_price_by_user_role_roles', '' );
874
  if ( ! empty( $user_roles ) ) {
875
  $current_user_role = wcj_get_current_user_first_role();
876
  foreach ( $user_roles as $user_role_key ) {
894
  $wholesale_price_levels[] = array( 'quantity' => $level_qty, 'discount' => (float) $discount, );
895
  }
896
  } else {
897
+ for ( $i = 1; $i <= apply_filters( 'booster_option', 1, wcj_get_option( 'wcj_wholesale_price_levels_number' . $role_option_name_addon, 1 ) ); $i++ ) {
898
+ $level_qty = wcj_get_option( 'wcj_wholesale_price_level_min_qty' . $role_option_name_addon . '_' . $i, PHP_INT_MAX );
899
+ $discount = wcj_get_option( 'wcj_wholesale_price_level_discount_percent' . $role_option_name_addon . '_' . $i, 0 );
900
  $discount = ! empty( $discount ) ? $discount : 0;
901
  $wholesale_price_levels[] = array( 'quantity' => $level_qty, 'discount' => (float) $discount, );
902
  }
970
  }
971
 
972
  // Heading Format
973
+ $atts['heading_format'] = 'from %level_min_qty% pcs.' === $atts['heading_format'] ? wcj_get_option( 'wcj_wholesale_price_table_sc_title_format', __( 'from %level_min_qty% pcs.', 'woocommerce-jetpack' ) ) : $atts['heading_format'];
974
 
975
  $level_max_qty = ( isset( $wholesale_price_levels[ $i + 1 ]['quantity'] ) ) ?
976
  $atts['before_level_max_qty'] . ( $wholesale_price_levels[ $i + 1 ]['quantity'] - 1 ) : $atts['last_level_max_qty'];
includes/widgets/class-wcj-widget-country-switcher.php CHANGED
@@ -39,7 +39,7 @@ class WCJ_Widget_Country_Switcher extends WCJ_Widget {
39
  function get_content( $instance ) {
40
  if ( ! wcj_is_module_enabled( 'price_by_country' ) ) {
41
  return __( 'Prices and Currencies by Country module not enabled!', 'woocommerce-jetpack' );
42
- } elseif ( 'by_ip' === get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
43
  return __( 'Customer Country Detection Method must include "by user selection"!', 'woocommerce-jetpack' );
44
  } else {
45
  if ( ! isset( $instance['replace_with_currency'] ) ) {
39
  function get_content( $instance ) {
40
  if ( ! wcj_is_module_enabled( 'price_by_country' ) ) {
41
  return __( 'Prices and Currencies by Country module not enabled!', 'woocommerce-jetpack' );
42
+ } elseif ( 'by_ip' === wcj_get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
43
  return __( 'Customer Country Detection Method must include "by user selection"!', 'woocommerce-jetpack' );
44
  } else {
45
  if ( ! isset( $instance['replace_with_currency'] ) ) {
langs/woocommerce-jetpack.pot CHANGED
@@ -42,8 +42,8 @@ msgstr ""
42
  #: includes/class-wcj-orders.php:125 includes/class-wcj-orders.php:154
43
  #: includes/class-wcj-payment-gateways.php:92
44
  #: includes/class-wcj-track-users.php:164 includes/class-wcj-track-users.php:252
45
- #: includes/classes/class-wcj-module.php:558
46
- #: includes/classes/class-wcj-module.php:758
47
  #: includes/settings/wcj-settings-price-by-country.php:238
48
  msgid "Booster"
49
  msgstr ""
@@ -256,7 +256,7 @@ msgstr ""
256
 
257
  #: includes/admin/class-wc-settings-jetpack.php:591
258
  #: includes/class-wcj-admin-bar.php:172
259
- #: includes/classes/class-wcj-module.php:898
260
  msgid "Documentation"
261
  msgstr ""
262
 
@@ -268,88 +268,88 @@ msgstr ""
268
  msgid "Total Modules:"
269
  msgstr ""
270
 
271
- #: includes/admin/class-wc-settings-jetpack.php:643
272
  msgid "Autoload Booster's Options"
273
  msgstr ""
274
 
275
- #: includes/admin/class-wc-settings-jetpack.php:645
276
  msgid ""
277
  "Choose if you want Booster's options to be autoloaded when calling "
278
  "add_option. After saving this option, you need to Reset all Booster's "
279
  "settings. Leave default value (i.e. Enabled) if not sure."
280
  msgstr ""
281
 
282
- #: includes/admin/class-wc-settings-jetpack.php:650
283
  msgid "Load Modules on Init Hook"
284
  msgstr ""
285
 
286
- #: includes/admin/class-wc-settings-jetpack.php:652
287
  msgid "Choose if you want to load Booster Modules on Init hook."
288
  msgstr ""
289
 
290
- #: includes/admin/class-wc-settings-jetpack.php:652
291
  msgid ""
292
  "It will load the locale appropriately if users change it from the profile "
293
  "page."
294
  msgstr ""
295
 
296
- #: includes/admin/class-wc-settings-jetpack.php:657
297
  msgid "Use List Instead of Comma Separated Text for Products in Settings"
298
  msgstr ""
299
 
300
- #: includes/admin/class-wc-settings-jetpack.php:659
301
- #: includes/admin/class-wc-settings-jetpack.php:673
302
  #: includes/admin/class-wc-settings-jetpack.php:682
 
 
303
  #, php-format
304
  msgid "Supported modules: %s."
305
  msgstr ""
306
 
307
- #: includes/admin/class-wc-settings-jetpack.php:660
308
  #: includes/class-wcj-payment-gateways-per-category.php:26
309
  msgid "Gateways per Product or Category"
310
  msgstr ""
311
 
312
- #: includes/admin/class-wc-settings-jetpack.php:661
313
  #: includes/class-wcj-global-discount.php:29
314
  #: includes/settings/wcj-settings-product-addons.php:254
315
  msgid "Global Discount"
316
  msgstr ""
317
 
318
- #: includes/admin/class-wc-settings-jetpack.php:662
319
- #: includes/admin/class-wc-settings-jetpack.php:674
320
- #: includes/admin/class-wc-settings-jetpack.php:683
321
  #: includes/class-wcj-product-custom-info.php:24
322
  #: includes/functions/wcj-functions-general.php:449
323
  msgid "Product Info"
324
  msgstr ""
325
 
326
- #: includes/admin/class-wc-settings-jetpack.php:663
327
  #: includes/class-wcj-product-input-fields.php:24
328
  #: includes/input-fields/class-wcj-product-input-fields-core.php:185
329
  msgid "Product Input Fields"
330
  msgstr ""
331
 
332
- #: includes/admin/class-wc-settings-jetpack.php:664
333
  msgid "Products XML"
334
  msgstr ""
335
 
336
- #: includes/admin/class-wc-settings-jetpack.php:665
337
  #: includes/class-wcj-related-products.php:38
338
  #: includes/settings/meta-box/wcj-settings-meta-box-related-products.php:30
339
  #: includes/settings/wcj-settings-free-price.php:20
340
  msgid "Related Products"
341
  msgstr ""
342
 
343
- #: includes/admin/class-wc-settings-jetpack.php:671
344
  msgid ""
345
  "Use List Instead of Comma Separated Text for Products Categories in Settings"
346
  msgstr ""
347
 
348
- #: includes/admin/class-wc-settings-jetpack.php:680
349
  msgid "Use List Instead of Comma Separated Text for Products Tags in Settings"
350
  msgstr ""
351
 
352
- #: includes/admin/class-wc-settings-jetpack.php:707
353
  #: includes/core/class-wcj-admin.php:100
354
  msgid "Booster for WooCommerce"
355
  msgstr ""
@@ -589,7 +589,7 @@ msgstr ""
589
 
590
  #: includes/class-wcj-admin-bar.php:245 includes/class-wcj-admin-bar.php:288
591
  #: includes/class-wcj-admin-bar.php:632
592
- #: includes/classes/class-wcj-module.php:731
593
  #: includes/settings/wcj-settings-wpml.php:91
594
  msgid "Tools"
595
  msgstr ""
@@ -1606,7 +1606,7 @@ msgid ""
1606
  msgstr ""
1607
 
1608
  #: includes/class-wcj-custom-php.php:32
1609
- #: includes/settings/wcj-settings-multicurrency.php:240
1610
  #: includes/settings/wcj-settings-offer-price.php:84
1611
  #, php-format
1612
  msgid "E.g.: %s"
@@ -2131,10 +2131,10 @@ msgstr ""
2131
  #: includes/settings/wcj-settings-eu-vat-number.php:181
2132
  #: includes/settings/wcj-settings-eu-vat-number.php:217
2133
  #: includes/settings/wcj-settings-export.php:36
2134
- #: includes/settings/wcj-settings-order-custom-statuses.php:29
2135
  #: includes/settings/wcj-settings-order-custom-statuses.php:37
2136
- #: includes/settings/wcj-settings-order-custom-statuses.php:80
2137
- #: includes/settings/wcj-settings-order-custom-statuses.php:107
 
2138
  #: includes/settings/wcj-settings-order-min-amount.php:61
2139
  #: includes/settings/wcj-settings-orders.php:132
2140
  #: includes/settings/wcj-settings-orders.php:159
@@ -2402,7 +2402,7 @@ msgstr ""
2402
  #: includes/class-wcj-product-by-user.php:207
2403
  #: includes/class-wcj-purchase-data.php:95
2404
  #: includes/class-wcj-track-users.php:335
2405
- #: includes/classes/class-wcj-module.php:867
2406
  #: includes/functions/wcj-functions-general.php:189
2407
  #: includes/functions/wcj-functions-html.php:117
2408
  #: includes/reports/wcj-class-reports-monthly-sales.php:351
@@ -2671,32 +2671,32 @@ msgid ""
2671
  "Tool lets you add, edit or delete any custom status for WooCommerce orders."
2672
  msgstr ""
2673
 
2674
- #: includes/class-wcj-order-custom-statuses.php:163
2675
  #, php-format
2676
  msgid "Change order status to %s"
2677
  msgstr ""
2678
 
2679
- #: includes/class-wcj-order-custom-statuses.php:173
2680
  msgid "Change status: "
2681
  msgstr ""
2682
 
2683
- #: includes/class-wcj-order-custom-statuses.php:213
2684
  msgid "Processing"
2685
  msgstr ""
2686
 
2687
- #: includes/class-wcj-order-custom-statuses.php:223
2688
  msgid "Complete"
2689
  msgstr ""
2690
 
2691
- #: includes/class-wcj-order-custom-statuses.php:328
2692
  #, php-format
2693
  msgid " <span class=\"count\">(%s)</span>"
2694
  msgid_plural " <span class=\"count\">(%s)</span>"
2695
  msgstr[0] ""
2696
  msgstr[1] ""
2697
 
2698
- #: includes/class-wcj-order-custom-statuses.php:426
2699
- #: includes/class-wcj-order-custom-statuses.php:428
2700
  msgid "Mark"
2701
  msgstr ""
2702
 
@@ -3175,8 +3175,8 @@ msgstr ""
3175
  #: includes/class-wcj-product-price-by-formula.php:71
3176
  #: includes/class-wcj-shipping-by-products.php:196
3177
  #: includes/class-wcj-shipping-options.php:171
3178
- #: includes/classes/class-wcj-module.php:177
3179
- #: includes/classes/class-wcj-module.php:198
3180
  #: includes/settings/meta-box/wcj-settings-meta-box-product-add-to-cart.php:68
3181
  #: includes/settings/meta-box/wcj-settings-meta-box-product-addons.php:73
3182
  #: includes/settings/meta-box/wcj-settings-meta-box-related-products.php:19
@@ -3258,26 +3258,29 @@ msgstr ""
3258
  #: includes/settings/wcj-settings-multicurrency-base-price.php:102
3259
  #: includes/settings/wcj-settings-multicurrency.php:39
3260
  #: includes/settings/wcj-settings-multicurrency.php:103
3261
- #: includes/settings/wcj-settings-multicurrency.php:129
3262
  #: includes/settings/wcj-settings-multicurrency.php:138
3263
- #: includes/settings/wcj-settings-multicurrency.php:146
3264
- #: includes/settings/wcj-settings-multicurrency.php:153
3265
- #: includes/settings/wcj-settings-multicurrency.php:161
3266
- #: includes/settings/wcj-settings-multicurrency.php:169
3267
- #: includes/settings/wcj-settings-multicurrency.php:177
3268
  #: includes/settings/wcj-settings-multicurrency.php:186
3269
  #: includes/settings/wcj-settings-multicurrency.php:195
3270
  #: includes/settings/wcj-settings-multicurrency.php:204
3271
  #: includes/settings/wcj-settings-multicurrency.php:213
3272
- #: includes/settings/wcj-settings-multicurrency.php:255
3273
  #: includes/settings/wcj-settings-multicurrency.php:264
 
 
3274
  #: includes/settings/wcj-settings-my-account.php:29
3275
  #: includes/settings/wcj-settings-my-account.php:87
3276
  #: includes/settings/wcj-settings-my-account.php:104
3277
  #: includes/settings/wcj-settings-offer-price.php:27
3278
- #: includes/settings/wcj-settings-order-custom-statuses.php:45
3279
- #: includes/settings/wcj-settings-order-custom-statuses.php:55
3280
- #: includes/settings/wcj-settings-order-custom-statuses.php:98
 
3281
  #: includes/settings/wcj-settings-order-min-amount.php:117
3282
  #: includes/settings/wcj-settings-order-numbers.php:97
3283
  #: includes/settings/wcj-settings-order-numbers.php:105
@@ -5067,7 +5070,7 @@ msgid ""
5067
  msgstr ""
5068
 
5069
  #: includes/class-wcj-shipping-by-user-role.php:34
5070
- #: includes/settings/wcj-settings-multicurrency.php:332
5071
  #: includes/settings/wcj-settings-order-min-amount.php:131
5072
  #: includes/settings/wcj-settings-price-by-user-role.php:151
5073
  #, php-format
@@ -5477,23 +5480,23 @@ msgstr ""
5477
  msgid "Invisible"
5478
  msgstr ""
5479
 
5480
- #: includes/classes/class-wcj-module.php:176
5481
  msgid "WPML: Get Terms in All Languages"
5482
  msgstr ""
5483
 
5484
- #: includes/classes/class-wcj-module.php:178
5485
  msgid "Get tags and taxonomies in all languages"
5486
  msgstr ""
5487
 
5488
- #: includes/classes/class-wcj-module.php:197
5489
  msgid "WPML: Get Products in All Languages"
5490
  msgstr ""
5491
 
5492
- #: includes/classes/class-wcj-module.php:199
5493
  msgid "Get products in all languages"
5494
  msgstr ""
5495
 
5496
- #: includes/classes/class-wcj-module.php:330
5497
  #, php-format
5498
  msgid ""
5499
  "Booster: Free plugin's version is limited to only one \"%1$s\" product with "
@@ -5502,30 +5505,30 @@ msgid ""
5502
  "\" products."
5503
  msgstr ""
5504
 
5505
- #: includes/classes/class-wcj-module.php:650
5506
  #, php-format
5507
  msgid "Selected: %s."
5508
  msgstr ""
5509
 
5510
- #: includes/classes/class-wcj-module.php:719
5511
  msgid "Back to Module Settings"
5512
  msgstr ""
5513
 
5514
- #: includes/classes/class-wcj-module.php:737
5515
  #: includes/settings/wcj-settings-wpml.php:96
5516
  msgid "Module Tools"
5517
  msgstr ""
5518
 
5519
- #: includes/classes/class-wcj-module.php:810
5520
  #: includes/settings/wcj-settings-checkout-core-fields.php:77
5521
  msgid "enabled"
5522
  msgstr ""
5523
 
5524
- #: includes/classes/class-wcj-module.php:811
5525
  msgid "disabled"
5526
  msgstr ""
5527
 
5528
- #: includes/classes/class-wcj-module.php:819
5529
  #: includes/settings/wcj-settings-product-tabs.php:172
5530
  #: includes/settings/wcj-settings-product-tabs.php:184
5531
  #: includes/settings/wcj-settings-product-tabs.php:196
@@ -5533,27 +5536,27 @@ msgstr ""
5533
  msgid "Deprecated"
5534
  msgstr ""
5535
 
5536
- #: includes/classes/class-wcj-module.php:857
5537
  msgid "Reset Settings"
5538
  msgstr ""
5539
 
5540
- #: includes/classes/class-wcj-module.php:863
5541
  msgid "Reset Module to Default Settings"
5542
  msgstr ""
5543
 
5544
- #: includes/classes/class-wcj-module.php:864
5545
  msgid "Reset Submodule to Default Settings"
5546
  msgstr ""
5547
 
5548
- #: includes/classes/class-wcj-module.php:868
5549
  msgid "Reset settings"
5550
  msgstr ""
5551
 
5552
- #: includes/classes/class-wcj-module.php:902
5553
  msgid "Module Options"
5554
  msgstr ""
5555
 
5556
- #: includes/classes/class-wcj-module.php:909
5557
  msgid "Enable Module"
5558
  msgstr ""
5559
 
@@ -6262,15 +6265,15 @@ msgid ""
6262
  "version <strong>%s</strong>."
6263
  msgstr ""
6264
 
6265
- #: includes/functions/wcj-functions-admin.php:158
6266
  msgid "Search&hellip;"
6267
  msgstr ""
6268
 
6269
- #: includes/functions/wcj-functions-admin.php:198
6270
  msgid "Enter comma separated list of IDs."
6271
  msgstr ""
6272
 
6273
- #: includes/functions/wcj-functions-admin.php:272
6274
  #: includes/settings/wcj-settings-emails-verification.php:75
6275
  #: includes/settings/wcj-settings-emails-verification.php:83
6276
  #: includes/settings/wcj-settings-emails-verification.php:130
@@ -6278,59 +6281,59 @@ msgstr ""
6278
  msgid "Replaced value: %s"
6279
  msgstr ""
6280
 
6281
- #: includes/functions/wcj-functions-admin.php:272
6282
  #, php-format
6283
  msgid "Replaced values: %s"
6284
  msgstr ""
6285
 
6286
- #: includes/functions/wcj-functions-admin.php:301
6287
  msgid "Install Booster Plus to unlock all features"
6288
  msgstr ""
6289
 
6290
- #: includes/functions/wcj-functions-admin.php:302
6291
  #, php-format
6292
  msgid ""
6293
  "Some settings fields are locked and you will need %s to modify all locked "
6294
  "fields."
6295
  msgstr ""
6296
 
6297
- #: includes/functions/wcj-functions-admin.php:305
6298
  msgid "Buy now"
6299
  msgstr ""
6300
 
6301
- #: includes/functions/wcj-functions-admin.php:306
6302
  msgid "Visit Booster Site"
6303
  msgstr ""
6304
 
6305
- #: includes/functions/wcj-functions-admin.php:311
6306
  #, php-format
6307
  msgid "Get <a href=\"%s\" target=\"_blank\">Booster Plus</a> to change value."
6308
  msgstr ""
6309
 
6310
- #: includes/functions/wcj-functions-admin.php:314
6311
  #, php-format
6312
  msgid ""
6313
  "Get <a href=\"%s\" target=\"_blank\">Booster Plus</a> to enable \"%s\" option."
6314
  msgstr ""
6315
 
6316
- #: includes/functions/wcj-functions-admin.php:317
6317
  #, php-format
6318
  msgid "Get Booster Plus to enable \"%s\" option."
6319
  msgstr ""
6320
 
6321
- #: includes/functions/wcj-functions-admin.php:320
6322
  #, php-format
6323
  msgid ""
6324
  "Get <a href=\"%s\" target=\"_blank\">Booster Plus</a> to change values below."
6325
  msgstr ""
6326
 
6327
- #: includes/functions/wcj-functions-admin.php:323
6328
  #, php-format
6329
  msgid ""
6330
  "Get <a href=\"%s\" target=\"_blank\">Booster Plus</a> to change values above."
6331
  msgstr ""
6332
 
6333
- #: includes/functions/wcj-functions-admin.php:326
6334
  msgid "Get Booster Plus to change value."
6335
  msgstr ""
6336
 
@@ -8029,37 +8032,37 @@ msgid "Datepicker/Weekpicker: First week day"
8029
  msgstr ""
8030
 
8031
  #: includes/input-fields/wcj-product-input-fields-options.php:173
8032
- #: includes/settings/wcj-settings-checkout-custom-fields.php:318
8033
  msgid "Sunday"
8034
  msgstr ""
8035
 
8036
  #: includes/input-fields/wcj-product-input-fields-options.php:174
8037
- #: includes/settings/wcj-settings-checkout-custom-fields.php:319
8038
  msgid "Monday"
8039
  msgstr ""
8040
 
8041
  #: includes/input-fields/wcj-product-input-fields-options.php:175
8042
- #: includes/settings/wcj-settings-checkout-custom-fields.php:320
8043
  msgid "Tuesday"
8044
  msgstr ""
8045
 
8046
  #: includes/input-fields/wcj-product-input-fields-options.php:176
8047
- #: includes/settings/wcj-settings-checkout-custom-fields.php:321
8048
  msgid "Wednesday"
8049
  msgstr ""
8050
 
8051
  #: includes/input-fields/wcj-product-input-fields-options.php:177
8052
- #: includes/settings/wcj-settings-checkout-custom-fields.php:322
8053
  msgid "Thursday"
8054
  msgstr ""
8055
 
8056
  #: includes/input-fields/wcj-product-input-fields-options.php:178
8057
- #: includes/settings/wcj-settings-checkout-custom-fields.php:323
8058
  msgid "Friday"
8059
  msgstr ""
8060
 
8061
  #: includes/input-fields/wcj-product-input-fields-options.php:179
8062
- #: includes/settings/wcj-settings-checkout-custom-fields.php:324
8063
  msgid "Saturday"
8064
  msgstr ""
8065
 
@@ -8101,7 +8104,7 @@ msgid "If timepicker is selected, set interval (in minutes) here"
8101
  msgstr ""
8102
 
8103
  #: includes/input-fields/wcj-product-input-fields-options.php:206
8104
- #: includes/settings/wcj-settings-checkout-custom-fields.php:357
8105
  msgid "Timepicker: Interval"
8106
  msgstr ""
8107
 
@@ -8235,7 +8238,7 @@ msgstr ""
8235
  #: includes/settings/wcj-settings-add-to-cart-button-visibility.php:36
8236
  #: includes/settings/wcj-settings-add-to-cart-button-visibility.php:62
8237
  #: includes/settings/wcj-settings-multicurrency-base-price.php:63
8238
- #: includes/settings/wcj-settings-multicurrency.php:233
8239
  #: includes/settings/wcj-settings-order-min-amount.php:77
8240
  #: includes/settings/wcj-settings-price-by-country.php:220
8241
  #: includes/settings/wcj-settings-price-by-user-role.php:106
@@ -8801,7 +8804,7 @@ msgstr ""
8801
  #: includes/settings/wcj-settings-currency.php:22
8802
  #: includes/settings/wcj-settings-my-account.php:210
8803
  #: includes/settings/wcj-settings-my-account.php:217
8804
- #: includes/settings/wcj-settings-order-custom-statuses.php:73
8805
  #: includes/settings/wcj-settings-pdf-invoicing-advanced.php:48
8806
  #: includes/settings/wcj-settings-product-addons.php:291
8807
  #: includes/settings/wcj-settings-product-bookings.php:100
@@ -9791,7 +9794,7 @@ msgid "You can use shortcodes and/or HTML here."
9791
  msgstr ""
9792
 
9793
  #: includes/settings/wcj-settings-admin-orders-list.php:79
9794
- msgid "Sortable"
9795
  msgstr ""
9796
 
9797
  #: includes/settings/wcj-settings-admin-orders-list.php:85
@@ -9803,7 +9806,10 @@ msgid "By meta (as numbers)"
9803
  msgstr ""
9804
 
9805
  #: includes/settings/wcj-settings-admin-orders-list.php:90
9806
- msgid "Key (if sortable)"
 
 
 
9807
  msgstr ""
9808
 
9809
  #: includes/settings/wcj-settings-admin-orders-list.php:103
@@ -10494,28 +10500,42 @@ msgid ""
10494
  "formats"
10495
  msgstr ""
10496
 
 
 
 
 
10497
  #: includes/settings/wcj-settings-checkout-custom-fields.php:286
10498
  msgid "Datepicker/Weekpicker: Min Date"
10499
  msgstr ""
10500
 
10501
  #: includes/settings/wcj-settings-checkout-custom-fields.php:287
10502
- #: includes/settings/wcj-settings-checkout-custom-fields.php:294
10503
  msgid "days"
10504
  msgstr ""
10505
 
10506
  #: includes/settings/wcj-settings-checkout-custom-fields.php:293
 
 
 
 
 
 
 
 
 
 
10507
  msgid "Datepicker/Weekpicker: Max Date"
10508
  msgstr ""
10509
 
10510
- #: includes/settings/wcj-settings-checkout-custom-fields.php:300
10511
  msgid "Datepicker/Weekpicker: Add Year Selector"
10512
  msgstr ""
10513
 
10514
- #: includes/settings/wcj-settings-checkout-custom-fields.php:306
10515
  msgid "Datepicker/Weekpicker: Year Selector: Year Range"
10516
  msgstr ""
10517
 
10518
- #: includes/settings/wcj-settings-checkout-custom-fields.php:307
10519
  msgid ""
10520
  "The range of years displayed in the year drop-down: either relative to "
10521
  "today's year (\"-nn:+nn\"), relative to the currently selected year (\"c-nn:c"
@@ -10524,66 +10544,66 @@ msgid ""
10524
  "restrict which dates may be selected use the minDate and/or maxDate options."
10525
  msgstr ""
10526
 
10527
- #: includes/settings/wcj-settings-checkout-custom-fields.php:313
10528
  msgid "Datepicker/Weekpicker: First Week Day"
10529
  msgstr ""
10530
 
10531
- #: includes/settings/wcj-settings-checkout-custom-fields.php:330
10532
  msgid "Datepicker/Weekpicker: Block Dates Format"
10533
  msgstr ""
10534
 
10535
- #: includes/settings/wcj-settings-checkout-custom-fields.php:333
10536
  msgid "Date format used to block dates."
10537
  msgstr ""
10538
 
10539
- #: includes/settings/wcj-settings-checkout-custom-fields.php:333
10540
  msgid "Use yy-mm-dd if you want to include the year."
10541
  msgstr ""
10542
 
10543
- #: includes/settings/wcj-settings-checkout-custom-fields.php:339
10544
  msgid "Datepicker/Weekpicker: Block Dates"
10545
  msgstr ""
10546
 
10547
- #: includes/settings/wcj-settings-checkout-custom-fields.php:342
10548
  msgid "Use one date per line."
10549
  msgstr ""
10550
 
10551
- #: includes/settings/wcj-settings-checkout-custom-fields.php:342
10552
  msgid "E.g 12-25 for Christmas, if block dates format is mm-dd"
10553
  msgstr ""
10554
 
10555
- #: includes/settings/wcj-settings-checkout-custom-fields.php:350
10556
  msgid "Timepicker: Time Format"
10557
  msgstr ""
10558
 
10559
- #: includes/settings/wcj-settings-checkout-custom-fields.php:351
10560
  msgid ""
10561
  "Visit <a href=\"http://timepicker.co/options/\" target=\"_blank\">timepicker "
10562
  "options page</a> for valid time formats"
10563
  msgstr ""
10564
 
10565
- #: includes/settings/wcj-settings-checkout-custom-fields.php:358
10566
  msgid "minutes"
10567
  msgstr ""
10568
 
10569
- #: includes/settings/wcj-settings-checkout-custom-fields.php:364
10570
  #: includes/settings/wcj-settings-product-listings.php:47
10571
  msgid "Exclude Categories"
10572
  msgstr ""
10573
 
10574
- #: includes/settings/wcj-settings-checkout-custom-fields.php:365
10575
  msgid "Hide this field if there is a product of selected category in cart."
10576
  msgstr ""
10577
 
10578
- #: includes/settings/wcj-settings-checkout-custom-fields.php:373
10579
  msgid "Include Categories"
10580
  msgstr ""
10581
 
10582
- #: includes/settings/wcj-settings-checkout-custom-fields.php:374
10583
  msgid "Show this field only if there is a product of selected category in cart."
10584
  msgstr ""
10585
 
10586
- #: includes/settings/wcj-settings-checkout-custom-fields.php:382
10587
  #: includes/settings/wcj-settings-global-discount.php:163
10588
  #: includes/settings/wcj-settings-payment-gateways-fees.php:144
10589
  #: includes/settings/wcj-settings-product-addons.php:149
@@ -10591,35 +10611,35 @@ msgstr ""
10591
  msgid "Exclude Products"
10592
  msgstr ""
10593
 
10594
- #: includes/settings/wcj-settings-checkout-custom-fields.php:383
10595
  msgid "Hide this field if there is a selected product in cart."
10596
  msgstr ""
10597
 
10598
- #: includes/settings/wcj-settings-checkout-custom-fields.php:391
10599
  #: includes/settings/wcj-settings-global-discount.php:152
10600
  #: includes/settings/wcj-settings-related-products.php:233
10601
  msgid "Include Products"
10602
  msgstr ""
10603
 
10604
- #: includes/settings/wcj-settings-checkout-custom-fields.php:392
10605
  msgid "Show this field only if there is a selected product in cart."
10606
  msgstr ""
10607
 
10608
- #: includes/settings/wcj-settings-checkout-custom-fields.php:400
10609
  msgid "Min Cart Amount"
10610
  msgstr ""
10611
 
10612
- #: includes/settings/wcj-settings-checkout-custom-fields.php:401
10613
  msgid ""
10614
  "Show this field only if cart total is at least this amount. Set zero to "
10615
  "disable."
10616
  msgstr ""
10617
 
10618
- #: includes/settings/wcj-settings-checkout-custom-fields.php:408
10619
  msgid "Max Cart Amount"
10620
  msgstr ""
10621
 
10622
- #: includes/settings/wcj-settings-checkout-custom-fields.php:409
10623
  msgid ""
10624
  "Show this field only if cart total is not more than this amount. Set zero to "
10625
  "disable."
@@ -11712,7 +11732,8 @@ msgstr ""
11712
  #: includes/settings/wcj-settings-currency-external-products.php:20
11713
  #: includes/settings/wcj-settings-currency-per-product.php:180
11714
  #: includes/settings/wcj-settings-multicurrency-base-price.php:142
11715
- #: includes/settings/wcj-settings-multicurrency.php:305
 
11716
  #: includes/settings/wcj-settings-price-by-country.php:353
11717
  #: includes/settings/wcj-settings-price-formats.php:59
11718
  msgid "Currency"
@@ -11816,7 +11837,7 @@ msgstr ""
11816
 
11817
  #: includes/settings/wcj-settings-currency-per-product.php:138
11818
  #: includes/settings/wcj-settings-multicurrency-base-price.php:113
11819
- #: includes/settings/wcj-settings-multicurrency.php:274
11820
  msgid "Currencies Options"
11821
  msgstr ""
11822
 
@@ -11829,7 +11850,7 @@ msgstr ""
11829
 
11830
  #: includes/settings/wcj-settings-currency-per-product.php:144
11831
  #: includes/settings/wcj-settings-multicurrency-base-price.php:118
11832
- #: includes/settings/wcj-settings-multicurrency.php:280
11833
  msgid "Total Currencies"
11834
  msgstr ""
11835
 
@@ -11847,7 +11868,7 @@ msgstr ""
11847
 
11848
  #: includes/settings/wcj-settings-currency-per-product.php:257
11849
  #: includes/settings/wcj-settings-multicurrency-base-price.php:69
11850
- #: includes/settings/wcj-settings-multicurrency.php:263
11851
  #: includes/settings/wcj-settings-price-by-country.php:254
11852
  #: includes/settings/wcj-settings-product-price-by-formula.php:108
11853
  msgid ""
@@ -12910,7 +12931,7 @@ msgstr ""
12910
 
12911
  #: includes/settings/wcj-settings-global-discount.php:201
12912
  #: includes/settings/wcj-settings-multicurrency-base-price.php:76
12913
- #: includes/settings/wcj-settings-multicurrency.php:247
12914
  #: includes/settings/wcj-settings-price-by-country.php:225
12915
  #: includes/settings/wcj-settings-price-by-user-role.php:111
12916
  #: includes/settings/wcj-settings-product-addons.php:258
@@ -12920,7 +12941,7 @@ msgstr ""
12920
 
12921
  #: includes/settings/wcj-settings-global-discount.php:202
12922
  #: includes/settings/wcj-settings-multicurrency-base-price.php:77
12923
- #: includes/settings/wcj-settings-multicurrency.php:248
12924
  #: includes/settings/wcj-settings-price-by-country.php:226
12925
  #: includes/settings/wcj-settings-price-by-user-role.php:112
12926
  #: includes/settings/wcj-settings-product-addons.php:259
@@ -13138,7 +13159,7 @@ msgid "Convert Product Prices in Admin Products List"
13138
  msgstr ""
13139
 
13140
  #: includes/settings/wcj-settings-multicurrency-base-price.php:68
13141
- #: includes/settings/wcj-settings-multicurrency.php:262
13142
  #: includes/settings/wcj-settings-price-by-country.php:253
13143
  #: includes/settings/wcj-settings-product-price-by-formula.php:107
13144
  msgid "Save Calculated Products Prices"
@@ -13284,166 +13305,200 @@ msgid ""
13284
  "Disable it if you have some other plugin already converting it like WPML."
13285
  msgstr ""
13286
 
13287
- #: includes/settings/wcj-settings-multicurrency.php:128
 
 
 
 
 
 
 
 
 
 
13288
  msgid "WooCommerce Fixed Coupons"
13289
  msgstr ""
13290
 
13291
- #: includes/settings/wcj-settings-multicurrency.php:130
13292
  #: includes/settings/wcj-settings-price-by-country.php:192
13293
  msgid ""
13294
  "When a fixed coupon is used its value changes according to the current "
13295
  "currency."
13296
  msgstr ""
13297
 
13298
- #: includes/settings/wcj-settings-multicurrency.php:136
13299
  msgid "WooCommerce Coupons - Min & Max amount"
13300
  msgstr ""
13301
 
13302
- #: includes/settings/wcj-settings-multicurrency.php:139
13303
  msgid "Converts min and max amount values from WooCommerce coupons."
13304
  msgstr ""
13305
 
13306
- #: includes/settings/wcj-settings-multicurrency.php:145
13307
  msgid "WooCommerce Smart Coupons"
13308
  msgstr ""
13309
 
13310
- #: includes/settings/wcj-settings-multicurrency.php:152
13311
  msgid "WooCommerce Price Filter"
13312
  msgstr ""
13313
 
13314
- #: includes/settings/wcj-settings-multicurrency.php:154
13315
  msgid "Adds Compatibility with Price Filter widget."
13316
  msgstr ""
13317
 
13318
- #: includes/settings/wcj-settings-multicurrency.php:160
13319
  msgid "Price Sorting with Per Product"
13320
  msgstr ""
13321
 
13322
- #: includes/settings/wcj-settings-multicurrency.php:162
13323
  msgid "Fixes Price Sorting if Per Product option is enabled."
13324
  msgstr ""
13325
 
13326
- #: includes/settings/wcj-settings-multicurrency.php:168
13327
  msgid "WooCommerce Import"
13328
  msgstr ""
13329
 
13330
- #: includes/settings/wcj-settings-multicurrency.php:170
13331
  msgid ""
13332
  "Fixes WooCommerce Import Tool preventing it from converting some uppercase "
13333
  "meta to lowercase."
13334
  msgstr ""
13335
 
13336
- #: includes/settings/wcj-settings-multicurrency.php:176
13337
  msgid "WPC Product Bundles"
13338
  msgstr ""
13339
 
13340
- #: includes/settings/wcj-settings-multicurrency.php:178
13341
  #, php-format
13342
  msgid ""
13343
  "Adds compatibility with <a href=\"%s\" target=\"_blank\">WPC Product Bundles</"
13344
  "a> plugin."
13345
  msgstr ""
13346
 
13347
- #: includes/settings/wcj-settings-multicurrency.php:184
13348
  msgid "WooCommerce Tree Table Rate Shipping"
13349
  msgstr ""
13350
 
13351
- #: includes/settings/wcj-settings-multicurrency.php:187
13352
  #, php-format
13353
  msgid ""
13354
  "Adds compatibility with <a href=\"%s\" target=\"_blank\">WooCommerce Tree "
13355
  "Table Rate Shipping</a> plugin."
13356
  msgstr ""
13357
 
13358
- #: includes/settings/wcj-settings-multicurrency.php:193
13359
  msgid "Flexible Shipping"
13360
  msgstr ""
13361
 
13362
- #: includes/settings/wcj-settings-multicurrency.php:196
13363
  #, php-format
13364
  msgid ""
13365
  "Adds compatibility with <a href=\"%s\" target=\"_blank\">Flexible Shipping</"
13366
  "a> plugin."
13367
  msgstr ""
13368
 
13369
- #: includes/settings/wcj-settings-multicurrency.php:202
13370
  msgid "Pricing Deals Plugin"
13371
  msgstr ""
13372
 
13373
- #: includes/settings/wcj-settings-multicurrency.php:205
13374
  #, php-format
13375
  msgid ""
13376
  "Adds compatibility with <a href=\"%s\" target=\"_blank\">Pricing Deals</a> "
13377
  "plugin."
13378
  msgstr ""
13379
 
13380
- #: includes/settings/wcj-settings-multicurrency.php:211
13381
  msgid "Product Add-Ons Plugin"
13382
  msgstr ""
13383
 
13384
- #: includes/settings/wcj-settings-multicurrency.php:214
13385
  #, php-format
13386
  msgid ""
13387
  "Adds compatibility with <a href=\"%s\" target=\"_blank\">Product Add-Ons</a> "
13388
  "plugin."
13389
  msgstr ""
13390
 
13391
- #: includes/settings/wcj-settings-multicurrency.php:214
13392
  msgid ""
13393
  "Only works with <code>Multicurrency on per Product Basis</code> option "
13394
  "disabled."
13395
  msgstr ""
13396
 
13397
- #: includes/settings/wcj-settings-multicurrency.php:238
13398
  msgid "Additional Price Filters"
13399
  msgstr ""
13400
 
13401
- #: includes/settings/wcj-settings-multicurrency.php:239
13402
  msgid ""
13403
  "Add additional price filters here. One per line. Leave blank if not sure."
13404
  msgstr ""
13405
 
13406
- #: includes/settings/wcj-settings-multicurrency.php:254
13407
  msgid "Save Prices on Exchange Update"
13408
  msgstr ""
13409
 
13410
- #: includes/settings/wcj-settings-multicurrency.php:256
13411
  msgid ""
13412
  "Save min and max prices on exchange rate update, via background processing."
13413
  msgstr ""
13414
 
13415
- #: includes/settings/wcj-settings-multicurrency.php:256
13416
  msgid ""
13417
  "All products with \"per product\" options registered related to the currency "
13418
  "will be affected."
13419
  msgstr ""
13420
 
13421
- #: includes/settings/wcj-settings-multicurrency.php:276
13422
  msgid ""
13423
  "One currency probably should be set to current (original) shop currency with "
13424
  "an exchange rate of 1."
13425
  msgstr ""
13426
 
13427
- #: includes/settings/wcj-settings-multicurrency.php:281
13428
  msgid ""
13429
  "Press Save changes after setting this option, so new settings fields will be "
13430
  "added."
13431
  msgstr ""
13432
 
13433
- #: includes/settings/wcj-settings-multicurrency.php:330
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13434
  msgid "Role Defaults"
13435
  msgstr ""
13436
 
13437
- #: includes/settings/wcj-settings-multicurrency.php:337
13438
  msgid "Roles"
13439
  msgstr ""
13440
 
13441
- #: includes/settings/wcj-settings-multicurrency.php:338
13442
  #: includes/settings/wcj-settings-wholesale-price.php:237
13443
  msgid "Save settings after you change this option. Leave blank to disable."
13444
  msgstr ""
13445
 
13446
- #: includes/settings/wcj-settings-multicurrency.php:361
13447
  msgid "No default currency"
13448
  msgstr ""
13449
 
@@ -13952,101 +14007,111 @@ msgid "No changes"
13952
  msgstr ""
13953
 
13954
  #: includes/settings/wcj-settings-order-custom-statuses.php:28
13955
- msgid "Add All Statuses to Admin Order Bulk Actions"
13956
  msgstr ""
13957
 
13958
  #: includes/settings/wcj-settings-order-custom-statuses.php:30
13959
  msgid ""
 
 
 
 
 
 
 
 
 
 
13960
  "If you wish to add custom statuses to admin Orders page bulk actions, enable "
13961
  "the checkbox here."
13962
  msgstr ""
13963
 
13964
- #: includes/settings/wcj-settings-order-custom-statuses.php:36
13965
  msgid "Add Custom Statuses to Admin Reports"
13966
  msgstr ""
13967
 
13968
- #: includes/settings/wcj-settings-order-custom-statuses.php:38
13969
  msgid ""
13970
  "If you wish to add custom statuses to admin reports, enable the checkbox here."
13971
  msgstr ""
13972
 
13973
- #: includes/settings/wcj-settings-order-custom-statuses.php:44
13974
  msgid "Make Custom Status Orders Editable"
13975
  msgstr ""
13976
 
13977
- #: includes/settings/wcj-settings-order-custom-statuses.php:46
13978
  msgid ""
13979
  "By default orders with custom statuses are not editable (same like with "
13980
  "standard WooCommerce Completed status). If you wish to make custom status "
13981
  "orders editable, enable the checkbox here."
13982
  msgstr ""
13983
 
13984
- #: includes/settings/wcj-settings-order-custom-statuses.php:54
13985
  msgid "Remove Status Prefix"
13986
  msgstr ""
13987
 
13988
- #: includes/settings/wcj-settings-order-custom-statuses.php:56
13989
  msgid "Removes the <code>wc-</code> prefix from custom statuses."
13990
  msgstr ""
13991
 
13992
- #: includes/settings/wcj-settings-order-custom-statuses.php:56
13993
  msgid "Enable it if you can't see the orders or the statuses."
13994
  msgstr ""
13995
 
13996
- #: includes/settings/wcj-settings-order-custom-statuses.php:64
13997
  msgid "\"Processing\" and \"Complete\" Action Buttons"
13998
  msgstr ""
13999
 
14000
- #: includes/settings/wcj-settings-order-custom-statuses.php:65
14001
  msgid ""
14002
  "By default, when order has custom status, \"Processing\" and \"Complete\" "
14003
  "action buttons are hidden. You can enable it here. Possible values are: Show "
14004
  "both; Show \"Processing\" only; Show \"Complete\" only; Hide (default)."
14005
  msgstr ""
14006
 
14007
- #: includes/settings/wcj-settings-order-custom-statuses.php:70
14008
  msgid "Show both"
14009
  msgstr ""
14010
 
14011
- #: includes/settings/wcj-settings-order-custom-statuses.php:71
14012
  msgid "Show \"Processing\" only"
14013
  msgstr ""
14014
 
14015
- #: includes/settings/wcj-settings-order-custom-statuses.php:72
14016
  msgid "Show \"Complete\" only"
14017
  msgstr ""
14018
 
14019
- #: includes/settings/wcj-settings-order-custom-statuses.php:79
14020
  msgid "Add Custom Statuses to Admin Order List Action Buttons"
14021
  msgstr ""
14022
 
14023
- #: includes/settings/wcj-settings-order-custom-statuses.php:81
14024
  msgid ""
14025
  "If you wish to add custom statuses buttons to the admin Orders page action "
14026
  "buttons (Actions column), enable the checkbox here."
14027
  msgstr ""
14028
 
14029
- #: includes/settings/wcj-settings-order-custom-statuses.php:89
14030
  msgid "Enable Colors"
14031
  msgstr ""
14032
 
14033
- #: includes/settings/wcj-settings-order-custom-statuses.php:90
14034
  msgid "Choose if you want the buttons to have colors."
14035
  msgstr ""
14036
 
14037
- #: includes/settings/wcj-settings-order-custom-statuses.php:97
14038
  msgid "Enable Colors in Status Column"
14039
  msgstr ""
14040
 
14041
- #: includes/settings/wcj-settings-order-custom-statuses.php:99
14042
  msgid "Enable this if you want the statuses in Status column to have colors."
14043
  msgstr ""
14044
 
14045
- #: includes/settings/wcj-settings-order-custom-statuses.php:106
14046
  msgid "Add Custom Statuses Buttons to Admin Order Preview Actions"
14047
  msgstr ""
14048
 
14049
- #: includes/settings/wcj-settings-order-custom-statuses.php:108
14050
  msgid ""
14051
  "If you wish to add custom statuses buttons to the admin orders preview page, "
14052
  "enable the checkbox here."
@@ -15724,14 +15789,6 @@ msgstr ""
15724
  msgid "Recalculate price filter widget and sorting by price product prices."
15725
  msgstr ""
15726
 
15727
- #: includes/settings/wcj-settings-price-by-country.php:181
15728
- msgid "Free Shipping"
15729
- msgstr ""
15730
-
15731
- #: includes/settings/wcj-settings-price-by-country.php:184
15732
- msgid "Converts minimum amount from WooCommerce Free Shipping native method."
15733
- msgstr ""
15734
-
15735
  #: includes/settings/wcj-settings-price-by-country.php:190
15736
  msgid "WooCommerce Coupons"
15737
  msgstr ""
42
  #: includes/class-wcj-orders.php:125 includes/class-wcj-orders.php:154
43
  #: includes/class-wcj-payment-gateways.php:92
44
  #: includes/class-wcj-track-users.php:164 includes/class-wcj-track-users.php:252
45
+ #: includes/classes/class-wcj-module.php:561
46
+ #: includes/classes/class-wcj-module.php:761
47
  #: includes/settings/wcj-settings-price-by-country.php:238
48
  msgid "Booster"
49
  msgstr ""
256
 
257
  #: includes/admin/class-wc-settings-jetpack.php:591
258
  #: includes/class-wcj-admin-bar.php:172
259
+ #: includes/classes/class-wcj-module.php:901
260
  msgid "Documentation"
261
  msgstr ""
262
 
268
  msgid "Total Modules:"
269
  msgstr ""
270
 
271
+ #: includes/admin/class-wc-settings-jetpack.php:666
272
  msgid "Autoload Booster's Options"
273
  msgstr ""
274
 
275
+ #: includes/admin/class-wc-settings-jetpack.php:668
276
  msgid ""
277
  "Choose if you want Booster's options to be autoloaded when calling "
278
  "add_option. After saving this option, you need to Reset all Booster's "
279
  "settings. Leave default value (i.e. Enabled) if not sure."
280
  msgstr ""
281
 
282
+ #: includes/admin/class-wc-settings-jetpack.php:673
283
  msgid "Load Modules on Init Hook"
284
  msgstr ""
285
 
286
+ #: includes/admin/class-wc-settings-jetpack.php:675
287
  msgid "Choose if you want to load Booster Modules on Init hook."
288
  msgstr ""
289
 
290
+ #: includes/admin/class-wc-settings-jetpack.php:675
291
  msgid ""
292
  "It will load the locale appropriately if users change it from the profile "
293
  "page."
294
  msgstr ""
295
 
296
+ #: includes/admin/class-wc-settings-jetpack.php:680
297
  msgid "Use List Instead of Comma Separated Text for Products in Settings"
298
  msgstr ""
299
 
 
 
300
  #: includes/admin/class-wc-settings-jetpack.php:682
301
+ #: includes/admin/class-wc-settings-jetpack.php:696
302
+ #: includes/admin/class-wc-settings-jetpack.php:705
303
  #, php-format
304
  msgid "Supported modules: %s."
305
  msgstr ""
306
 
307
+ #: includes/admin/class-wc-settings-jetpack.php:683
308
  #: includes/class-wcj-payment-gateways-per-category.php:26
309
  msgid "Gateways per Product or Category"
310
  msgstr ""
311
 
312
+ #: includes/admin/class-wc-settings-jetpack.php:684
313
  #: includes/class-wcj-global-discount.php:29
314
  #: includes/settings/wcj-settings-product-addons.php:254
315
  msgid "Global Discount"
316
  msgstr ""
317
 
318
+ #: includes/admin/class-wc-settings-jetpack.php:685
319
+ #: includes/admin/class-wc-settings-jetpack.php:697
320
+ #: includes/admin/class-wc-settings-jetpack.php:706
321
  #: includes/class-wcj-product-custom-info.php:24
322
  #: includes/functions/wcj-functions-general.php:449
323
  msgid "Product Info"
324
  msgstr ""
325
 
326
+ #: includes/admin/class-wc-settings-jetpack.php:686
327
  #: includes/class-wcj-product-input-fields.php:24
328
  #: includes/input-fields/class-wcj-product-input-fields-core.php:185
329
  msgid "Product Input Fields"
330
  msgstr ""
331
 
332
+ #: includes/admin/class-wc-settings-jetpack.php:687
333
  msgid "Products XML"
334
  msgstr ""
335
 
336
+ #: includes/admin/class-wc-settings-jetpack.php:688
337
  #: includes/class-wcj-related-products.php:38
338
  #: includes/settings/meta-box/wcj-settings-meta-box-related-products.php:30
339
  #: includes/settings/wcj-settings-free-price.php:20
340
  msgid "Related Products"
341
  msgstr ""
342
 
343
+ #: includes/admin/class-wc-settings-jetpack.php:694
344
  msgid ""
345
  "Use List Instead of Comma Separated Text for Products Categories in Settings"
346
  msgstr ""
347
 
348
+ #: includes/admin/class-wc-settings-jetpack.php:703
349
  msgid "Use List Instead of Comma Separated Text for Products Tags in Settings"
350
  msgstr ""
351
 
352
+ #: includes/admin/class-wc-settings-jetpack.php:730
353
  #: includes/core/class-wcj-admin.php:100
354
  msgid "Booster for WooCommerce"
355
  msgstr ""
589
 
590
  #: includes/class-wcj-admin-bar.php:245 includes/class-wcj-admin-bar.php:288
591
  #: includes/class-wcj-admin-bar.php:632
592
+ #: includes/classes/class-wcj-module.php:734
593
  #: includes/settings/wcj-settings-wpml.php:91
594
  msgid "Tools"
595
  msgstr ""
1606
  msgstr ""
1607
 
1608
  #: includes/class-wcj-custom-php.php:32
1609
+ #: includes/settings/wcj-settings-multicurrency.php:249
1610
  #: includes/settings/wcj-settings-offer-price.php:84
1611
  #, php-format
1612
  msgid "E.g.: %s"
2131
  #: includes/settings/wcj-settings-eu-vat-number.php:181
2132
  #: includes/settings/wcj-settings-eu-vat-number.php:217
2133
  #: includes/settings/wcj-settings-export.php:36
 
2134
  #: includes/settings/wcj-settings-order-custom-statuses.php:37
2135
+ #: includes/settings/wcj-settings-order-custom-statuses.php:45
2136
+ #: includes/settings/wcj-settings-order-custom-statuses.php:88
2137
+ #: includes/settings/wcj-settings-order-custom-statuses.php:115
2138
  #: includes/settings/wcj-settings-order-min-amount.php:61
2139
  #: includes/settings/wcj-settings-orders.php:132
2140
  #: includes/settings/wcj-settings-orders.php:159
2402
  #: includes/class-wcj-product-by-user.php:207
2403
  #: includes/class-wcj-purchase-data.php:95
2404
  #: includes/class-wcj-track-users.php:335
2405
+ #: includes/classes/class-wcj-module.php:870
2406
  #: includes/functions/wcj-functions-general.php:189
2407
  #: includes/functions/wcj-functions-html.php:117
2408
  #: includes/reports/wcj-class-reports-monthly-sales.php:351
2671
  "Tool lets you add, edit or delete any custom status for WooCommerce orders."
2672
  msgstr ""
2673
 
2674
+ #: includes/class-wcj-order-custom-statuses.php:167
2675
  #, php-format
2676
  msgid "Change order status to %s"
2677
  msgstr ""
2678
 
2679
+ #: includes/class-wcj-order-custom-statuses.php:177
2680
  msgid "Change status: "
2681
  msgstr ""
2682
 
2683
+ #: includes/class-wcj-order-custom-statuses.php:217
2684
  msgid "Processing"
2685
  msgstr ""
2686
 
2687
+ #: includes/class-wcj-order-custom-statuses.php:227
2688
  msgid "Complete"
2689
  msgstr ""
2690
 
2691
+ #: includes/class-wcj-order-custom-statuses.php:344
2692
  #, php-format
2693
  msgid " <span class=\"count\">(%s)</span>"
2694
  msgid_plural " <span class=\"count\">(%s)</span>"
2695
  msgstr[0] ""
2696
  msgstr[1] ""
2697
 
2698
+ #: includes/class-wcj-order-custom-statuses.php:442
2699
+ #: includes/class-wcj-order-custom-statuses.php:444
2700
  msgid "Mark"
2701
  msgstr ""
2702
 
3175
  #: includes/class-wcj-product-price-by-formula.php:71
3176
  #: includes/class-wcj-shipping-by-products.php:196
3177
  #: includes/class-wcj-shipping-options.php:171
3178
+ #: includes/classes/class-wcj-module.php:159
3179
+ #: includes/classes/class-wcj-module.php:180
3180
  #: includes/settings/meta-box/wcj-settings-meta-box-product-add-to-cart.php:68
3181
  #: includes/settings/meta-box/wcj-settings-meta-box-product-addons.php:73
3182
  #: includes/settings/meta-box/wcj-settings-meta-box-related-products.php:19
3258
  #: includes/settings/wcj-settings-multicurrency-base-price.php:102
3259
  #: includes/settings/wcj-settings-multicurrency.php:39
3260
  #: includes/settings/wcj-settings-multicurrency.php:103
3261
+ #: includes/settings/wcj-settings-multicurrency.php:121
3262
  #: includes/settings/wcj-settings-multicurrency.php:138
3263
+ #: includes/settings/wcj-settings-multicurrency.php:147
3264
+ #: includes/settings/wcj-settings-multicurrency.php:155
3265
+ #: includes/settings/wcj-settings-multicurrency.php:162
3266
+ #: includes/settings/wcj-settings-multicurrency.php:170
3267
+ #: includes/settings/wcj-settings-multicurrency.php:178
3268
  #: includes/settings/wcj-settings-multicurrency.php:186
3269
  #: includes/settings/wcj-settings-multicurrency.php:195
3270
  #: includes/settings/wcj-settings-multicurrency.php:204
3271
  #: includes/settings/wcj-settings-multicurrency.php:213
3272
+ #: includes/settings/wcj-settings-multicurrency.php:222
3273
  #: includes/settings/wcj-settings-multicurrency.php:264
3274
+ #: includes/settings/wcj-settings-multicurrency.php:273
3275
+ #: includes/settings/wcj-settings-multicurrency.php:365
3276
  #: includes/settings/wcj-settings-my-account.php:29
3277
  #: includes/settings/wcj-settings-my-account.php:87
3278
  #: includes/settings/wcj-settings-my-account.php:104
3279
  #: includes/settings/wcj-settings-offer-price.php:27
3280
+ #: includes/settings/wcj-settings-order-custom-statuses.php:29
3281
+ #: includes/settings/wcj-settings-order-custom-statuses.php:53
3282
+ #: includes/settings/wcj-settings-order-custom-statuses.php:63
3283
+ #: includes/settings/wcj-settings-order-custom-statuses.php:106
3284
  #: includes/settings/wcj-settings-order-min-amount.php:117
3285
  #: includes/settings/wcj-settings-order-numbers.php:97
3286
  #: includes/settings/wcj-settings-order-numbers.php:105
5070
  msgstr ""
5071
 
5072
  #: includes/class-wcj-shipping-by-user-role.php:34
5073
+ #: includes/settings/wcj-settings-multicurrency.php:378
5074
  #: includes/settings/wcj-settings-order-min-amount.php:131
5075
  #: includes/settings/wcj-settings-price-by-user-role.php:151
5076
  #, php-format
5480
  msgid "Invisible"
5481
  msgstr ""
5482
 
5483
+ #: includes/classes/class-wcj-module.php:158
5484
  msgid "WPML: Get Terms in All Languages"
5485
  msgstr ""
5486
 
5487
+ #: includes/classes/class-wcj-module.php:160
5488
  msgid "Get tags and taxonomies in all languages"
5489
  msgstr ""
5490
 
5491
+ #: includes/classes/class-wcj-module.php:179
5492
  msgid "WPML: Get Products in All Languages"
5493
  msgstr ""
5494
 
5495
+ #: includes/classes/class-wcj-module.php:181
5496
  msgid "Get products in all languages"
5497
  msgstr ""
5498
 
5499
+ #: includes/classes/class-wcj-module.php:312
5500
  #, php-format
5501
  msgid ""
5502
  "Booster: Free plugin's version is limited to only one \"%1$s\" product with "
5505
  "\" products."
5506
  msgstr ""
5507
 
5508
+ #: includes/classes/class-wcj-module.php:653
5509
  #, php-format
5510
  msgid "Selected: %s."
5511
  msgstr ""
5512
 
5513
+ #: includes/classes/class-wcj-module.php:722
5514
  msgid "Back to Module Settings"
5515
  msgstr ""
5516
 
5517
+ #: includes/classes/class-wcj-module.php:740
5518
  #: includes/settings/wcj-settings-wpml.php:96
5519
  msgid "Module Tools"
5520
  msgstr ""
5521
 
5522
+ #: includes/classes/class-wcj-module.php:813
5523
  #: includes/settings/wcj-settings-checkout-core-fields.php:77
5524
  msgid "enabled"
5525
  msgstr ""
5526
 
5527
+ #: includes/classes/class-wcj-module.php:814
5528
  msgid "disabled"
5529
  msgstr ""
5530
 
5531
+ #: includes/classes/class-wcj-module.php:822
5532
  #: includes/settings/wcj-settings-product-tabs.php:172
5533
  #: includes/settings/wcj-settings-product-tabs.php:184
5534
  #: includes/settings/wcj-settings-product-tabs.php:196
5536
  msgid "Deprecated"
5537
  msgstr ""
5538
 
5539
+ #: includes/classes/class-wcj-module.php:860
5540
  msgid "Reset Settings"
5541
  msgstr ""
5542
 
5543
+ #: includes/classes/class-wcj-module.php:866
5544
  msgid "Reset Module to Default Settings"
5545
  msgstr ""
5546
 
5547
+ #: includes/classes/class-wcj-module.php:867
5548
  msgid "Reset Submodule to Default Settings"
5549
  msgstr ""
5550
 
5551
+ #: includes/classes/class-wcj-module.php:871
5552
  msgid "Reset settings"
5553
  msgstr ""
5554
 
5555
+ #: includes/classes/class-wcj-module.php:905
5556
  msgid "Module Options"
5557
  msgstr ""
5558
 
5559
+ #: includes/classes/class-wcj-module.php:912
5560
  msgid "Enable Module"
5561
  msgstr ""
5562
 
6265
  "version <strong>%s</strong>."
6266
  msgstr ""
6267
 
6268
+ #: includes/functions/wcj-functions-admin.php:161
6269
  msgid "Search&hellip;"
6270
  msgstr ""
6271
 
6272
+ #: includes/functions/wcj-functions-admin.php:201
6273
  msgid "Enter comma separated list of IDs."
6274
  msgstr ""
6275
 
6276
+ #: includes/functions/wcj-functions-admin.php:275
6277
  #: includes/settings/wcj-settings-emails-verification.php:75
6278
  #: includes/settings/wcj-settings-emails-verification.php:83
6279
  #: includes/settings/wcj-settings-emails-verification.php:130
6281
  msgid "Replaced value: %s"
6282
  msgstr ""
6283
 
6284
+ #: includes/functions/wcj-functions-admin.php:275
6285
  #, php-format
6286
  msgid "Replaced values: %s"
6287
  msgstr ""
6288
 
6289
+ #: includes/functions/wcj-functions-admin.php:304
6290
  msgid "Install Booster Plus to unlock all features"
6291
  msgstr ""
6292
 
6293
+ #: includes/functions/wcj-functions-admin.php:305
6294
  #, php-format
6295
  msgid ""
6296
  "Some settings fields are locked and you will need %s to modify all locked "
6297
  "fields."
6298
  msgstr ""
6299
 
6300
+ #: includes/functions/wcj-functions-admin.php:308
6301
  msgid "Buy now"
6302
  msgstr ""
6303
 
6304
+ #: includes/functions/wcj-functions-admin.php:309
6305
  msgid "Visit Booster Site"
6306
  msgstr ""
6307
 
6308
+ #: includes/functions/wcj-functions-admin.php:314
6309
  #, php-format
6310
  msgid "Get <a href=\"%s\" target=\"_blank\">Booster Plus</a> to change value."
6311
  msgstr ""
6312
 
6313
+ #: includes/functions/wcj-functions-admin.php:317
6314
  #, php-format
6315
  msgid ""
6316
  "Get <a href=\"%s\" target=\"_blank\">Booster Plus</a> to enable \"%s\" option."
6317
  msgstr ""
6318
 
6319
+ #: includes/functions/wcj-functions-admin.php:320
6320
  #, php-format
6321
  msgid "Get Booster Plus to enable \"%s\" option."
6322
  msgstr ""
6323
 
6324
+ #: includes/functions/wcj-functions-admin.php:323
6325
  #, php-format
6326
  msgid ""
6327
  "Get <a href=\"%s\" target=\"_blank\">Booster Plus</a> to change values below."
6328
  msgstr ""
6329
 
6330
+ #: includes/functions/wcj-functions-admin.php:326
6331
  #, php-format
6332
  msgid ""
6333
  "Get <a href=\"%s\" target=\"_blank\">Booster Plus</a> to change values above."
6334
  msgstr ""
6335
 
6336
+ #: includes/functions/wcj-functions-admin.php:329
6337
  msgid "Get Booster Plus to change value."
6338
  msgstr ""
6339
 
8032
  msgstr ""
8033
 
8034
  #: includes/input-fields/wcj-product-input-fields-options.php:173
8035
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:326
8036
  msgid "Sunday"
8037
  msgstr ""
8038
 
8039
  #: includes/input-fields/wcj-product-input-fields-options.php:174
8040
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:327
8041
  msgid "Monday"
8042
  msgstr ""
8043
 
8044
  #: includes/input-fields/wcj-product-input-fields-options.php:175
8045
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:328
8046
  msgid "Tuesday"
8047
  msgstr ""
8048
 
8049
  #: includes/input-fields/wcj-product-input-fields-options.php:176
8050
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:329
8051
  msgid "Wednesday"
8052
  msgstr ""
8053
 
8054
  #: includes/input-fields/wcj-product-input-fields-options.php:177
8055
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:330
8056
  msgid "Thursday"
8057
  msgstr ""
8058
 
8059
  #: includes/input-fields/wcj-product-input-fields-options.php:178
8060
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:331
8061
  msgid "Friday"
8062
  msgstr ""
8063
 
8064
  #: includes/input-fields/wcj-product-input-fields-options.php:179
8065
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:332
8066
  msgid "Saturday"
8067
  msgstr ""
8068
 
8104
  msgstr ""
8105
 
8106
  #: includes/input-fields/wcj-product-input-fields-options.php:206
8107
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:365
8108
  msgid "Timepicker: Interval"
8109
  msgstr ""
8110
 
8238
  #: includes/settings/wcj-settings-add-to-cart-button-visibility.php:36
8239
  #: includes/settings/wcj-settings-add-to-cart-button-visibility.php:62
8240
  #: includes/settings/wcj-settings-multicurrency-base-price.php:63
8241
+ #: includes/settings/wcj-settings-multicurrency.php:242
8242
  #: includes/settings/wcj-settings-order-min-amount.php:77
8243
  #: includes/settings/wcj-settings-price-by-country.php:220
8244
  #: includes/settings/wcj-settings-price-by-user-role.php:106
8804
  #: includes/settings/wcj-settings-currency.php:22
8805
  #: includes/settings/wcj-settings-my-account.php:210
8806
  #: includes/settings/wcj-settings-my-account.php:217
8807
+ #: includes/settings/wcj-settings-order-custom-statuses.php:81
8808
  #: includes/settings/wcj-settings-pdf-invoicing-advanced.php:48
8809
  #: includes/settings/wcj-settings-product-addons.php:291
8810
  #: includes/settings/wcj-settings-product-bookings.php:100
9794
  msgstr ""
9795
 
9796
  #: includes/settings/wcj-settings-admin-orders-list.php:79
9797
+ msgid "Sortable , Select \"By meta (as text)\" for date sorting"
9798
  msgstr ""
9799
 
9800
  #: includes/settings/wcj-settings-admin-orders-list.php:85
9806
  msgstr ""
9807
 
9808
  #: includes/settings/wcj-settings-admin-orders-list.php:90
9809
+ #, php-format
9810
+ msgid ""
9811
+ "Key (if sortable) %s Add \"_\" (underscore) before key if the key is from "
9812
+ "\"Checkout Custom Fields module\""
9813
  msgstr ""
9814
 
9815
  #: includes/settings/wcj-settings-admin-orders-list.php:103
10500
  "formats"
10501
  msgstr ""
10502
 
10503
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:280
10504
+ msgid "Use Y-m-d format if you want to use this field for sorting"
10505
+ msgstr ""
10506
+
10507
  #: includes/settings/wcj-settings-checkout-custom-fields.php:286
10508
  msgid "Datepicker/Weekpicker: Min Date"
10509
  msgstr ""
10510
 
10511
  #: includes/settings/wcj-settings-checkout-custom-fields.php:287
10512
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:302
10513
  msgid "days"
10514
  msgstr ""
10515
 
10516
  #: includes/settings/wcj-settings-checkout-custom-fields.php:293
10517
+ msgid "Datepicker/Weekpicker: Current day time limit"
10518
+ msgstr ""
10519
+
10520
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:294
10521
+ msgid ""
10522
+ "If the Min Date is 0, Today's date will be no longer available after selected "
10523
+ "time limit."
10524
+ msgstr ""
10525
+
10526
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:301
10527
  msgid "Datepicker/Weekpicker: Max Date"
10528
  msgstr ""
10529
 
10530
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:308
10531
  msgid "Datepicker/Weekpicker: Add Year Selector"
10532
  msgstr ""
10533
 
10534
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:314
10535
  msgid "Datepicker/Weekpicker: Year Selector: Year Range"
10536
  msgstr ""
10537
 
10538
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:315
10539
  msgid ""
10540
  "The range of years displayed in the year drop-down: either relative to "
10541
  "today's year (\"-nn:+nn\"), relative to the currently selected year (\"c-nn:c"
10544
  "restrict which dates may be selected use the minDate and/or maxDate options."
10545
  msgstr ""
10546
 
10547
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:321
10548
  msgid "Datepicker/Weekpicker: First Week Day"
10549
  msgstr ""
10550
 
10551
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:338
10552
  msgid "Datepicker/Weekpicker: Block Dates Format"
10553
  msgstr ""
10554
 
10555
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:341
10556
  msgid "Date format used to block dates."
10557
  msgstr ""
10558
 
10559
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:341
10560
  msgid "Use yy-mm-dd if you want to include the year."
10561
  msgstr ""
10562
 
10563
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:347
10564
  msgid "Datepicker/Weekpicker: Block Dates"
10565
  msgstr ""
10566
 
10567
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:350
10568
  msgid "Use one date per line."
10569
  msgstr ""
10570
 
10571
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:350
10572
  msgid "E.g 12-25 for Christmas, if block dates format is mm-dd"
10573
  msgstr ""
10574
 
10575
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:358
10576
  msgid "Timepicker: Time Format"
10577
  msgstr ""
10578
 
10579
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:359
10580
  msgid ""
10581
  "Visit <a href=\"http://timepicker.co/options/\" target=\"_blank\">timepicker "
10582
  "options page</a> for valid time formats"
10583
  msgstr ""
10584
 
10585
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:366
10586
  msgid "minutes"
10587
  msgstr ""
10588
 
10589
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:372
10590
  #: includes/settings/wcj-settings-product-listings.php:47
10591
  msgid "Exclude Categories"
10592
  msgstr ""
10593
 
10594
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:373
10595
  msgid "Hide this field if there is a product of selected category in cart."
10596
  msgstr ""
10597
 
10598
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:381
10599
  msgid "Include Categories"
10600
  msgstr ""
10601
 
10602
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:382
10603
  msgid "Show this field only if there is a product of selected category in cart."
10604
  msgstr ""
10605
 
10606
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:390
10607
  #: includes/settings/wcj-settings-global-discount.php:163
10608
  #: includes/settings/wcj-settings-payment-gateways-fees.php:144
10609
  #: includes/settings/wcj-settings-product-addons.php:149
10611
  msgid "Exclude Products"
10612
  msgstr ""
10613
 
10614
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:391
10615
  msgid "Hide this field if there is a selected product in cart."
10616
  msgstr ""
10617
 
10618
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:399
10619
  #: includes/settings/wcj-settings-global-discount.php:152
10620
  #: includes/settings/wcj-settings-related-products.php:233
10621
  msgid "Include Products"
10622
  msgstr ""
10623
 
10624
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:400
10625
  msgid "Show this field only if there is a selected product in cart."
10626
  msgstr ""
10627
 
10628
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:408
10629
  msgid "Min Cart Amount"
10630
  msgstr ""
10631
 
10632
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:409
10633
  msgid ""
10634
  "Show this field only if cart total is at least this amount. Set zero to "
10635
  "disable."
10636
  msgstr ""
10637
 
10638
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:416
10639
  msgid "Max Cart Amount"
10640
  msgstr ""
10641
 
10642
+ #: includes/settings/wcj-settings-checkout-custom-fields.php:417
10643
  msgid ""
10644
  "Show this field only if cart total is not more than this amount. Set zero to "
10645
  "disable."
11732
  #: includes/settings/wcj-settings-currency-external-products.php:20
11733
  #: includes/settings/wcj-settings-currency-per-product.php:180
11734
  #: includes/settings/wcj-settings-multicurrency-base-price.php:142
11735
+ #: includes/settings/wcj-settings-multicurrency.php:314
11736
+ #: includes/settings/wcj-settings-multicurrency.php:352
11737
  #: includes/settings/wcj-settings-price-by-country.php:353
11738
  #: includes/settings/wcj-settings-price-formats.php:59
11739
  msgid "Currency"
11837
 
11838
  #: includes/settings/wcj-settings-currency-per-product.php:138
11839
  #: includes/settings/wcj-settings-multicurrency-base-price.php:113
11840
+ #: includes/settings/wcj-settings-multicurrency.php:283
11841
  msgid "Currencies Options"
11842
  msgstr ""
11843
 
11850
 
11851
  #: includes/settings/wcj-settings-currency-per-product.php:144
11852
  #: includes/settings/wcj-settings-multicurrency-base-price.php:118
11853
+ #: includes/settings/wcj-settings-multicurrency.php:289
11854
  msgid "Total Currencies"
11855
  msgstr ""
11856
 
11868
 
11869
  #: includes/settings/wcj-settings-currency-per-product.php:257
11870
  #: includes/settings/wcj-settings-multicurrency-base-price.php:69
11871
+ #: includes/settings/wcj-settings-multicurrency.php:272
11872
  #: includes/settings/wcj-settings-price-by-country.php:254
11873
  #: includes/settings/wcj-settings-product-price-by-formula.php:108
11874
  msgid ""
12931
 
12932
  #: includes/settings/wcj-settings-global-discount.php:201
12933
  #: includes/settings/wcj-settings-multicurrency-base-price.php:76
12934
+ #: includes/settings/wcj-settings-multicurrency.php:256
12935
  #: includes/settings/wcj-settings-price-by-country.php:225
12936
  #: includes/settings/wcj-settings-price-by-user-role.php:111
12937
  #: includes/settings/wcj-settings-product-addons.php:258
12941
 
12942
  #: includes/settings/wcj-settings-global-discount.php:202
12943
  #: includes/settings/wcj-settings-multicurrency-base-price.php:77
12944
+ #: includes/settings/wcj-settings-multicurrency.php:257
12945
  #: includes/settings/wcj-settings-price-by-country.php:226
12946
  #: includes/settings/wcj-settings-price-by-user-role.php:112
12947
  #: includes/settings/wcj-settings-product-addons.php:259
13159
  msgstr ""
13160
 
13161
  #: includes/settings/wcj-settings-multicurrency-base-price.php:68
13162
+ #: includes/settings/wcj-settings-multicurrency.php:271
13163
  #: includes/settings/wcj-settings-price-by-country.php:253
13164
  #: includes/settings/wcj-settings-product-price-by-formula.php:107
13165
  msgid "Save Calculated Products Prices"
13305
  "Disable it if you have some other plugin already converting it like WPML."
13306
  msgstr ""
13307
 
13308
+ #: includes/settings/wcj-settings-multicurrency.php:120
13309
+ #: includes/settings/wcj-settings-price-by-country.php:181
13310
+ msgid "Free Shipping"
13311
+ msgstr ""
13312
+
13313
+ #: includes/settings/wcj-settings-multicurrency.php:123
13314
+ #: includes/settings/wcj-settings-price-by-country.php:184
13315
+ msgid "Converts minimum amount from WooCommerce Free Shipping native method."
13316
+ msgstr ""
13317
+
13318
+ #: includes/settings/wcj-settings-multicurrency.php:137
13319
  msgid "WooCommerce Fixed Coupons"
13320
  msgstr ""
13321
 
13322
+ #: includes/settings/wcj-settings-multicurrency.php:139
13323
  #: includes/settings/wcj-settings-price-by-country.php:192
13324
  msgid ""
13325
  "When a fixed coupon is used its value changes according to the current "
13326
  "currency."
13327
  msgstr ""
13328
 
13329
+ #: includes/settings/wcj-settings-multicurrency.php:145
13330
  msgid "WooCommerce Coupons - Min & Max amount"
13331
  msgstr ""
13332
 
13333
+ #: includes/settings/wcj-settings-multicurrency.php:148
13334
  msgid "Converts min and max amount values from WooCommerce coupons."
13335
  msgstr ""
13336
 
13337
+ #: includes/settings/wcj-settings-multicurrency.php:154
13338
  msgid "WooCommerce Smart Coupons"
13339
  msgstr ""
13340
 
13341
+ #: includes/settings/wcj-settings-multicurrency.php:161
13342
  msgid "WooCommerce Price Filter"
13343
  msgstr ""
13344
 
13345
+ #: includes/settings/wcj-settings-multicurrency.php:163
13346
  msgid "Adds Compatibility with Price Filter widget."
13347
  msgstr ""
13348
 
13349
+ #: includes/settings/wcj-settings-multicurrency.php:169
13350
  msgid "Price Sorting with Per Product"
13351
  msgstr ""
13352
 
13353
+ #: includes/settings/wcj-settings-multicurrency.php:171
13354
  msgid "Fixes Price Sorting if Per Product option is enabled."
13355
  msgstr ""
13356
 
13357
+ #: includes/settings/wcj-settings-multicurrency.php:177
13358
  msgid "WooCommerce Import"
13359
  msgstr ""
13360
 
13361
+ #: includes/settings/wcj-settings-multicurrency.php:179
13362
  msgid ""
13363
  "Fixes WooCommerce Import Tool preventing it from converting some uppercase "
13364
  "meta to lowercase."
13365
  msgstr ""
13366
 
13367
+ #: includes/settings/wcj-settings-multicurrency.php:185
13368
  msgid "WPC Product Bundles"
13369
  msgstr ""
13370
 
13371
+ #: includes/settings/wcj-settings-multicurrency.php:187
13372
  #, php-format
13373
  msgid ""
13374
  "Adds compatibility with <a href=\"%s\" target=\"_blank\">WPC Product Bundles</"
13375
  "a> plugin."
13376
  msgstr ""
13377
 
13378
+ #: includes/settings/wcj-settings-multicurrency.php:193
13379
  msgid "WooCommerce Tree Table Rate Shipping"
13380
  msgstr ""
13381
 
13382
+ #: includes/settings/wcj-settings-multicurrency.php:196
13383
  #, php-format
13384
  msgid ""
13385
  "Adds compatibility with <a href=\"%s\" target=\"_blank\">WooCommerce Tree "
13386
  "Table Rate Shipping</a> plugin."
13387
  msgstr ""
13388
 
13389
+ #: includes/settings/wcj-settings-multicurrency.php:202
13390
  msgid "Flexible Shipping"
13391
  msgstr ""
13392
 
13393
+ #: includes/settings/wcj-settings-multicurrency.php:205
13394
  #, php-format
13395
  msgid ""
13396
  "Adds compatibility with <a href=\"%s\" target=\"_blank\">Flexible Shipping</"
13397
  "a> plugin."
13398
  msgstr ""
13399
 
13400
+ #: includes/settings/wcj-settings-multicurrency.php:211
13401
  msgid "Pricing Deals Plugin"
13402
  msgstr ""
13403
 
13404
+ #: includes/settings/wcj-settings-multicurrency.php:214
13405
  #, php-format
13406
  msgid ""
13407
  "Adds compatibility with <a href=\"%s\" target=\"_blank\">Pricing Deals</a> "
13408
  "plugin."
13409
  msgstr ""
13410
 
13411
+ #: includes/settings/wcj-settings-multicurrency.php:220
13412
  msgid "Product Add-Ons Plugin"
13413
  msgstr ""
13414
 
13415
+ #: includes/settings/wcj-settings-multicurrency.php:223
13416
  #, php-format
13417
  msgid ""
13418
  "Adds compatibility with <a href=\"%s\" target=\"_blank\">Product Add-Ons</a> "
13419
  "plugin."
13420
  msgstr ""
13421
 
13422
+ #: includes/settings/wcj-settings-multicurrency.php:223
13423
  msgid ""
13424
  "Only works with <code>Multicurrency on per Product Basis</code> option "
13425
  "disabled."
13426
  msgstr ""
13427
 
13428
+ #: includes/settings/wcj-settings-multicurrency.php:247
13429
  msgid "Additional Price Filters"
13430
  msgstr ""
13431
 
13432
+ #: includes/settings/wcj-settings-multicurrency.php:248
13433
  msgid ""
13434
  "Add additional price filters here. One per line. Leave blank if not sure."
13435
  msgstr ""
13436
 
13437
+ #: includes/settings/wcj-settings-multicurrency.php:263
13438
  msgid "Save Prices on Exchange Update"
13439
  msgstr ""
13440
 
13441
+ #: includes/settings/wcj-settings-multicurrency.php:265
13442
  msgid ""
13443
  "Save min and max prices on exchange rate update, via background processing."
13444
  msgstr ""
13445
 
13446
+ #: includes/settings/wcj-settings-multicurrency.php:265
13447
  msgid ""
13448
  "All products with \"per product\" options registered related to the currency "
13449
  "will be affected."
13450
  msgstr ""
13451
 
13452
+ #: includes/settings/wcj-settings-multicurrency.php:285
13453
  msgid ""
13454
  "One currency probably should be set to current (original) shop currency with "
13455
  "an exchange rate of 1."
13456
  msgstr ""
13457
 
13458
+ #: includes/settings/wcj-settings-multicurrency.php:290
13459
  msgid ""
13460
  "Press Save changes after setting this option, so new settings fields will be "
13461
  "added."
13462
  msgstr ""
13463
 
13464
+ #: includes/settings/wcj-settings-multicurrency.php:346
13465
+ msgid "Default Currency"
13466
+ msgstr ""
13467
+
13468
+ #: includes/settings/wcj-settings-multicurrency.php:348
13469
+ msgid "The default currency displayed on frontend."
13470
+ msgstr ""
13471
+
13472
+ #: includes/settings/wcj-settings-multicurrency.php:358
13473
+ msgid ""
13474
+ "The default currency will only be set if the current user hasn't selected it "
13475
+ "yet."
13476
+ msgstr ""
13477
+
13478
+ #: includes/settings/wcj-settings-multicurrency.php:361
13479
+ msgid "Force"
13480
+ msgstr ""
13481
+
13482
+ #: includes/settings/wcj-settings-multicurrency.php:366
13483
+ msgid ""
13484
+ "If enabled, the default currency will be fixed and users won't be able to "
13485
+ "change it."
13486
+ msgstr ""
13487
+
13488
+ #: includes/settings/wcj-settings-multicurrency.php:376
13489
  msgid "Role Defaults"
13490
  msgstr ""
13491
 
13492
+ #: includes/settings/wcj-settings-multicurrency.php:383
13493
  msgid "Roles"
13494
  msgstr ""
13495
 
13496
+ #: includes/settings/wcj-settings-multicurrency.php:384
13497
  #: includes/settings/wcj-settings-wholesale-price.php:237
13498
  msgid "Save settings after you change this option. Leave blank to disable."
13499
  msgstr ""
13500
 
13501
+ #: includes/settings/wcj-settings-multicurrency.php:407
13502
  msgid "No default currency"
13503
  msgstr ""
13504
 
14007
  msgstr ""
14008
 
14009
  #: includes/settings/wcj-settings-order-custom-statuses.php:28
14010
+ msgid "Set Default Order Status Forcefully"
14011
  msgstr ""
14012
 
14013
  #: includes/settings/wcj-settings-order-custom-statuses.php:30
14014
  msgid ""
14015
+ "You can set the default order status forcefully from here. Forcing the status "
14016
+ "can result in unpredictable consequences, enable the checkbox here."
14017
+ msgstr ""
14018
+
14019
+ #: includes/settings/wcj-settings-order-custom-statuses.php:36
14020
+ msgid "Add All Statuses to Admin Order Bulk Actions"
14021
+ msgstr ""
14022
+
14023
+ #: includes/settings/wcj-settings-order-custom-statuses.php:38
14024
+ msgid ""
14025
  "If you wish to add custom statuses to admin Orders page bulk actions, enable "
14026
  "the checkbox here."
14027
  msgstr ""
14028
 
14029
+ #: includes/settings/wcj-settings-order-custom-statuses.php:44
14030
  msgid "Add Custom Statuses to Admin Reports"
14031
  msgstr ""
14032
 
14033
+ #: includes/settings/wcj-settings-order-custom-statuses.php:46
14034
  msgid ""
14035
  "If you wish to add custom statuses to admin reports, enable the checkbox here."
14036
  msgstr ""
14037
 
14038
+ #: includes/settings/wcj-settings-order-custom-statuses.php:52
14039
  msgid "Make Custom Status Orders Editable"
14040
  msgstr ""
14041
 
14042
+ #: includes/settings/wcj-settings-order-custom-statuses.php:54
14043
  msgid ""
14044
  "By default orders with custom statuses are not editable (same like with "
14045
  "standard WooCommerce Completed status). If you wish to make custom status "
14046
  "orders editable, enable the checkbox here."
14047
  msgstr ""
14048
 
14049
+ #: includes/settings/wcj-settings-order-custom-statuses.php:62
14050
  msgid "Remove Status Prefix"
14051
  msgstr ""
14052
 
14053
+ #: includes/settings/wcj-settings-order-custom-statuses.php:64
14054
  msgid "Removes the <code>wc-</code> prefix from custom statuses."
14055
  msgstr ""
14056
 
14057
+ #: includes/settings/wcj-settings-order-custom-statuses.php:64
14058
  msgid "Enable it if you can't see the orders or the statuses."
14059
  msgstr ""
14060
 
14061
+ #: includes/settings/wcj-settings-order-custom-statuses.php:72
14062
  msgid "\"Processing\" and \"Complete\" Action Buttons"
14063
  msgstr ""
14064
 
14065
+ #: includes/settings/wcj-settings-order-custom-statuses.php:73
14066
  msgid ""
14067
  "By default, when order has custom status, \"Processing\" and \"Complete\" "
14068
  "action buttons are hidden. You can enable it here. Possible values are: Show "
14069
  "both; Show \"Processing\" only; Show \"Complete\" only; Hide (default)."
14070
  msgstr ""
14071
 
14072
+ #: includes/settings/wcj-settings-order-custom-statuses.php:78
14073
  msgid "Show both"
14074
  msgstr ""
14075
 
14076
+ #: includes/settings/wcj-settings-order-custom-statuses.php:79
14077
  msgid "Show \"Processing\" only"
14078
  msgstr ""
14079
 
14080
+ #: includes/settings/wcj-settings-order-custom-statuses.php:80
14081
  msgid "Show \"Complete\" only"
14082
  msgstr ""
14083
 
14084
+ #: includes/settings/wcj-settings-order-custom-statuses.php:87
14085
  msgid "Add Custom Statuses to Admin Order List Action Buttons"
14086
  msgstr ""
14087
 
14088
+ #: includes/settings/wcj-settings-order-custom-statuses.php:89
14089
  msgid ""
14090
  "If you wish to add custom statuses buttons to the admin Orders page action "
14091
  "buttons (Actions column), enable the checkbox here."
14092
  msgstr ""
14093
 
14094
+ #: includes/settings/wcj-settings-order-custom-statuses.php:97
14095
  msgid "Enable Colors"
14096
  msgstr ""
14097
 
14098
+ #: includes/settings/wcj-settings-order-custom-statuses.php:98
14099
  msgid "Choose if you want the buttons to have colors."
14100
  msgstr ""
14101
 
14102
+ #: includes/settings/wcj-settings-order-custom-statuses.php:105
14103
  msgid "Enable Colors in Status Column"
14104
  msgstr ""
14105
 
14106
+ #: includes/settings/wcj-settings-order-custom-statuses.php:107
14107
  msgid "Enable this if you want the statuses in Status column to have colors."
14108
  msgstr ""
14109
 
14110
+ #: includes/settings/wcj-settings-order-custom-statuses.php:114
14111
  msgid "Add Custom Statuses Buttons to Admin Order Preview Actions"
14112
  msgstr ""
14113
 
14114
+ #: includes/settings/wcj-settings-order-custom-statuses.php:116
14115
  msgid ""
14116
  "If you wish to add custom statuses buttons to the admin orders preview page, "
14117
  "enable the checkbox here."
15789
  msgid "Recalculate price filter widget and sorting by price product prices."
15790
  msgstr ""
15791
 
 
 
 
 
 
 
 
 
15792
  #: includes/settings/wcj-settings-price-by-country.php:190
15793
  msgid "WooCommerce Coupons"
15794
  msgstr ""
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: anbinder, karzin, pluggabl
3
  Tags: woocommerce, booster for woocommerce, woocommerce jetpack
4
  Requires at least: 4.4
5
  Tested up to: 5.5
6
- Stable tag: 5.3.2
7
  License: GNU General Public License v3.0
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -193,6 +193,30 @@ You can see the differences between versions in this [table](https://booster.io/
193
 
194
  == Changelog ==
195
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  = 5.3.2 - 16/09/2020 =
197
  * Fix - `Uncaught Error: Call to a member function add_enable_module_setting() on int` error message in `wcj-options.php:18`.
198
 
3
  Tags: woocommerce, booster for woocommerce, woocommerce jetpack
4
  Requires at least: 4.4
5
  Tested up to: 5.5
6
+ Stable tag: 5.3.4
7
  License: GNU General Public License v3.0
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
193
 
194
  == Changelog ==
195
 
196
+ = 5.3.4 - 06/10/2020 =
197
+ * Fix - Improper replacement of `get_option()` by `wcj_option()`.
198
+ * Fix - SHIPPING & ORDERS - Custom Shipping - Created custom shipping name as `null`.
199
+ * Fix - Undefined index: weight_table_total_rows.
200
+ * Dev - PRICES & CURRENCIES - Multicurrency (Currency Switcher) - Default currency - Add 'Currency' and 'Force' options.
201
+
202
+ = 5.3.3 - 01/10/2020 =
203
+ * Fix - CART & CHECKOUT - Checkout Fees - "Notice: Undefined offset: 1 " bug fixed (message if debug enabled).
204
+ * Fix - PRICES & CURRENCIES - Wholesale Price - "Warning: Invalid argument supplied for foreach() in..." bug fixed (message if debug enabled).
205
+ * Fix - PRODUCTS - Product Addons - Fix incompatibility problem with 'Save Calculated Products Prices' from Multicurrency module by disabling price saving.
206
+ * Fix - PRICES & CURRENCIES - Wholesale Price - Discount doesn't apply if 'Product Categories to Include' option is empty.
207
+ * Dev - CART & CHECKOUT - Checkout Custom Fields - Changed instructions in tip for Datepicker/Weekpicker: Date Format about date formatting for sorting.
208
+ * Dev - CART & CHECKOUT - Checkout Custom Fields - Created a time limit option "Datepicker/Weekpicker: Current day time limit" for today’s date availability.
209
+ * Dev - Disable autoload by default on all settings.
210
+ * Dev - Functions - General - Create `wcj_get_option()` function in order to improve performance getting options from the database once the autoload option is now disabled by default.
211
+ * Dev - PRICES & CURRENCIES - Multicurrency (Currency Switcher) - Add `$args` parameter on `change_price()` function allowing to disable/enable price saving.
212
+ * Dev - PRICES & CURRENCIES - Multicurrency (Currency Switcher) - Add compatibility option with WooCommerce Free Shipping method.
213
+ * Dev - Replace all `get_option()` calls to `wcj_get_option()`.
214
+ * Dev - SHIPPING & ORDERS - Admin Orders List - Changed instructions for Custom Column's sortable dropdown.
215
+ * Dev - SHIPPING & ORDERS - Admin Orders List - Changed instructions for Custom Column's key field of sortable.
216
+ * Dev - SHIPPING & ORDERS - Order Custom Statuses - Forcefully change custom order status feature "Set Default Order Status Forcefully" added.
217
+ * Dev - Saving a section on admin will disable autoload on corresponding settings.
218
+ * WC tested up to: 4.5
219
+
220
  = 5.3.2 - 16/09/2020 =
221
  * Fix - `Uncaught Error: Call to a member function add_enable_module_setting() on int` error message in `wcj-options.php:18`.
222
 
woocommerce-jetpack.php CHANGED
@@ -3,13 +3,13 @@
3
  Plugin Name: Booster for WooCommerce
4
  Plugin URI: https://booster.io
5
  Description: Supercharge your WooCommerce site with these awesome powerful features. More than 100 modules. All in one WooCommerce plugin.
6
- Version: 5.3.2
7
  Author: Pluggabl LLC
8
  Author URI: https://booster.io
9
  Text Domain: woocommerce-jetpack
10
  Domain Path: /langs
11
  Copyright: © 2020 Pluggabl LLC.
12
- WC tested up to: 4.4
13
  License: GNU General Public License v3.0
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
  */
@@ -57,13 +57,21 @@ final class WC_Jetpack {
57
  * @var string
58
  * @since 2.4.7
59
  */
60
- public $version = '5.3.2';
61
 
62
  /**
63
  * @var WC_Jetpack The single instance of the class
64
  */
65
  protected static $_instance = null;
66
 
 
 
 
 
 
 
 
 
67
  /**
68
  * Main WC_Jetpack Instance.
69
  *
3
  Plugin Name: Booster for WooCommerce
4
  Plugin URI: https://booster.io
5
  Description: Supercharge your WooCommerce site with these awesome powerful features. More than 100 modules. All in one WooCommerce plugin.
6
+ Version: 5.3.4
7
  Author: Pluggabl LLC
8
  Author URI: https://booster.io
9
  Text Domain: woocommerce-jetpack
10
  Domain Path: /langs
11
  Copyright: © 2020 Pluggabl LLC.
12
+ WC tested up to: 4.5
13
  License: GNU General Public License v3.0
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
  */
57
  * @var string
58
  * @since 2.4.7
59
  */
60
+ public $version = '5.3.4';
61
 
62
  /**
63
  * @var WC_Jetpack The single instance of the class
64
  */
65
  protected static $_instance = null;
66
 
67
+ /**
68
+ * @version 5.3.3
69
+ * @since 5.3.3
70
+ *
71
+ * @var array
72
+ */
73
+ public $options = array();
74
+
75
  /**
76
  * Main WC_Jetpack Instance.
77
  *