age::SLUG; } public function isWoocommerceCouponsEnabled() { return wc_coupons_enabled(); } /** * @return WP_User */ public function getCurrentUser() { return $this->currentUser; } /** * @param WP_User $user */ public function setCurrentUser($user) { if ($user instanceof WP_User) { $this->currentUser = $user; } } public function getIsTaxEnabled() { return wc_tax_enabled(); } public function getIsPricesIncludeTax() { return wc_prices_include_tax(); } public function getTaxDisplayShopMode() { return get_option('woocommerce_tax_display_shop'); } public function getTaxDisplayCartMode() { return get_option('woocommerce_tax_display_cart'); } public function getPriceDecimals() { return $this->priceSettings->getDecimals(); } public function getCurrencyCode() { return $this->currencyController->getCurrentCurrency()->getCode(); } /** * @return array */ public function getAvailableTaxClassSlugs() { return $this->availableTaxClassSlugs; } public function setMode($mode) { if (self::MODE_PRODUCTION === $mode || self::MODE_DEBUG === $mode) { $this->mode = $mode; } } /** * @param string $mode * * @return bool */ public function isMode($mode) { return $this->mode === $mode; } /** * @return bool */ public function isProductionMode() { return $this->mode === self::MODE_PRODUCTION; } /** * @return bool */ public function isDebugMode() { return $this->mode === self::MODE_DEBUG; } /** * TODO implement * * @param Exception $exception */ public function handleError($exception) { return; } /** * @return bool */ public function isUserLoggedIn() { return $this->userLoggedIn; } public function isUsingGlobalPriceSettings() { return apply_filters('adp_feature_flag_use_global_price_settings', true); } public function isAllowExactApplicationOfReplacementCoupon() { return apply_filters('adp_feature_flag_allow_exact_application_of_replacement_coupon', true); } public function isHideRulesWithoutDiscountInOrderEditPage() { return apply_filters('adp_feature_flag_hide_rules_without_discount_in_order_edit_page', false); } public function isUnpackVariationsWithAnyAttributes() { return apply_filters('adp_unpack_variations_with_any_attributes', false); } public function isReplaceProductVariationDataStore() { return apply_filters('adp_replace_variation_data_store', true); } public function isExclusivityRequiresHistoryChange() { $default = ! $this->getOption("exclusivity_locks_all_matched_products", false); return apply_filters('adp_exclusivity_requires_history_change', $default); } public function isShowBulkTablePricesIncludingCoupons() { return apply_filters('adp_show_bulk_table_prices_including_coupons', true); } public function isToCompensateTrdPartAdjustmentForFixedPrice() { return apply_filters('adp_is_to_compensate_trd_party_adj_for_fixed_price', true); } public function isCheckParentsWhenFindingProductOnlyRule() { return apply_filters('adp_is_check_parents_when_finding_product_only_rule', true); } public function isRegisterUpdateCheckoutScript() { return apply_filters('adp_is_register_update_checkout_script', true); } public function isRuleSuppressed() { return apply_filters('adp_rules_suppression', false); } public function isUseMergedCoupons() { return apply_filters('adp_use_merged_coupons', true); } public function isUseSelectedShippingMethodsEverywhere() { return apply_filters('adp_use_shipping_methods_everywhere', false); } public function isUseSelectedPaymentMethodEverywhere() { return apply_filters('adp_use_payment_method_everywhere', false); } public function isTranslateRules() { return apply_filters('adp_translate_rules', true); } public function isShowPriceRangeInBulkTableForVariableProducts() { return apply_filters('adp_show_price_range_in_bulk_table_for_variable_products', false); } public function isGenerateSqlPerRule() { return apply_filters('adp_generate_sql_per_rule', false); } public function isTaxExemptProcessorActive() { return apply_filters('adp_is_tax_exempt_processor_active', true); } public function refreshShippingProcessorWhenNoAppliedRules() { return apply_filters('adp_refresh_shipping_processor_when_no_applied_rules', false); } protected function setUpPricesSettings() { $settings = new PriceSettings(); if ($this->isUsingGlobalPriceSettings() && $this->wcLoaded) { $settings->setTaxEnabled(wc_tax_enabled()); $settings->setIncludeTax(wc_prices_include_tax()); $settings->setDecimals(wc_get_price_decimals()); $settings->setDecimalSeparator(wc_get_price_decimal_separator()); $settings->setThousandSeparator(wc_get_price_thousand_separator()); $settings->setPriceFormat(get_woocommerce_price_format()); } else { $settings->setTaxEnabled(get_option('woocommerce_calc_taxes') === 'yes'); $settings->setIncludeTax(get_option('woocommerce_prices_include_tax') === 'yes'); $settings->setDecimals(get_option('woocommerce_price_num_decimals', 2)); $settings->setDecimalSeparator(stripslashes(get_option('woocommerce_price_decimal_sep'))); $settings->setThousandSeparator(stripslashes(get_option('woocommerce_price_thousand_sep'))); switch (get_option('woocommerce_currency_pos')) { case 'left': $priceFormat = $settings::FORMAT_LEFT; break; case 'right': $priceFormat = $settings::FORMAT_RIGHT; break; case 'left_space': $priceFormat = $settings::FORMAT_LEFT_SPACE; break; case 'right_space': $priceFormat = $settings::FORMAT_RIGHT_SPACE; break; default: $priceFormat = null; break; } $settings->setPriceFormat($priceFormat); } if ( ! $this->getOption('is_calculate_based_on_wc_precision')) { $settings->setDecimals($settings->getDecimals() + 2); } $this->priceSettings = $settings; } /** * @return WP_Theme */ protected function loadCurrentTheme() { return wp_get_theme(); } /** * @return WP_Theme */ public function getCurrentTheme() { return $this->currentTheme; } /** * @return Language */ public function getLanguage() { return $this->language; } /** * @param Language $language */ public function setLanguage($language) { $this->language = $language; } /** * @return Geolocation */ public function getGeoLocation(): Geolocation { if ($this->geoLocation !== null) { return $this->geoLocation; } $location = GeoLocationStrategy::geoLocateIp(); $this->geoLocation = new Geolocation( $location['country'] ?? "", $location['state'] ?? "", $location['city'] ?? "", $location['postcode'] ?? "" ); return $this->geoLocation; } /** * @return bool */ public function isHPOSEnabled() { $isHPOSEnabled = false; if (class_exists('Automattic\WooCommerce\Utilities\OrderUtil')) { $isHPOSEnabled = OrderUtil::custom_orders_table_usage_is_enabled(); } return $isHPOSEnabled; } public function getContainerCompatibilityManager(): ContainerCompatibilityManager { return $this->containerCompatibilityManager; } public function isBaseVersion(): bool { return defined('WC_ADP_PRO_VERSION_PATH'); } public function __serialize() { return []; } public function __unserialize($data) { $this->__construct(); } }