);
$attributes = $product->get_attributes();
return ( in_array( $name, array_keys( $attributes ), true ) && in_array( $value, $variation_attributes[ $attributes[ $name ]['name'] ], true ) );
} else {
return false;
}
}
}
if ( ! function_exists( 'wc_tax_enabled' ) ) {
/**
* Are store-wide taxes enabled?
*
* @return bool
*/
function wc_tax_enabled() {
return apply_filters( 'wc_tax_enabled', get_option( 'woocommerce_calc_taxes' ) === 'yes' );
}
}
if ( ! function_exists( 'wc_shipping_enabled' ) ) {
/**
* Is shipping enabled?
*
* @return bool
*/
function wc_shipping_enabled() {
return apply_filters( 'wc_shipping_enabled', get_option( 'woocommerce_ship_to_countries' ) !== 'disabled' );
}
}
if ( ! function_exists( 'wc_prices_include_tax' ) ) {
/**
* Are prices inclusive of tax?
*
* @return bool
*/
function wc_prices_include_tax() {
return wc_tax_enabled() && apply_filters( 'woocommerce_prices_include_tax', get_option( 'woocommerce_prices_include_tax' ) === 'yes' );
}
}
/**
* Simple check for validating a URL, it must start with http:// or https://.
* and pass FILTER_VALIDATE_URL validation.
*
* @param string $url to check.
* @return bool
*/
function wc_is_valid_url( $url ) {
// Must start with http:// or https://.
if ( 0 !== strpos( $url, 'http://' ) && 0 !== strpos( $url, 'https://' ) ) {
return false;
}
// Must pass validation.
if ( ! filter_var( $url, FILTER_VALIDATE_URL ) ) {
return false;
}
return true;
}
/**
* Check if the home URL is https. If it is, we don't need to do things such as 'force ssl'.
*
* @since 2.4.13
* @return bool
*/
function wc_site_is_https() {
return false !== strstr( get_option( 'home' ), 'https:' );
}
/**
* Check if the checkout is configured for https. Look at options, WP HTTPS plugin, or the permalink itself.
*
* @since 2.5.0
* @return bool
*/
function wc_checkout_is_https() {
return wc_site_is_https() || 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) || class_exists( 'WordPressHTTPS' ) || strstr( wc_get_page_permalink( 'checkout' ), 'https:' );
}
/**
* Checks whether the content passed contains a specific short code.
*
* @param string $tag Shortcode tag to check.
* @return bool
*/
function wc_post_content_has_shortcode( $tag = '' ) {
global $post;
return is_singular() && is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, $tag );
}
/**
* Check if reviews are enabled.
*
* @since 3.6.0
* @return bool
*/
function wc_reviews_enabled() {
return 'yes' === get_option( 'woocommerce_enable_reviews' );
}
/**
* Check if reviews ratings are enabled.
*
* @since 3.6.0
* @return bool
*/
function wc_review_ratings_enabled() {
return wc_reviews_enabled() && 'yes' === get_option( 'woocommerce_enable_review_rating' );
}
/**
* Check if review ratings are required.
*
* @since 3.6.0
* @return bool
*/
function wc_review_ratings_required() {
return 'yes' === get_option( 'woocommerce_review_rating_required' );
}
/**
* Check if a CSV file is valid.
*
* @since 3.6.5
* @param string $file File name.
* @param bool $check_path If should check for the path.
* @return bool
*/
function wc_is_file_valid_csv( $file, $check_path = true ) {
/**
* Filter check for CSV file path.
*
* @since 3.6.4
* @param bool $check_import_file_path If requires file path check. Defaults to true.
* @param string $file Path of the file to be checked.
*/
$check_import_file_path = apply_filters( 'woocommerce_csv_importer_check_import_file_path', true, $file );
if ( $check_path && $check_import_file_path && false !== stripos( $file, '://' ) ) {
return false;
}
/**
* Filter CSV valid file types.
*
* @since 3.6.5
* @param array $valid_filetypes List of valid file types.
*/
$valid_filetypes = apply_filters(
'woocommerce_csv_import_valid_filetypes',
array(
'csv' => 'text/csv',
'txt' => 'text/plain',
)
);
$filetype = wp_check_filetype( $file, $valid_filetypes );
if ( in_array( $filetype['type'], $valid_filetypes, true ) ) {
return true;
}
return false;
}
/**
* Check if the current theme is a block theme.
*
* @since 6.0.0
* @return bool
*/
function wc_current_theme_is_fse_theme() {
if ( function_exists( 'wp_is_block_theme' ) ) {
return (bool) wp_is_block_theme();
}
if ( function_exists( 'gutenberg_is_fse_theme' ) ) {
return (bool) gutenberg_is_fse_theme();
}
return false;
}
/**
* Check if the current theme has WooCommerce support or is a FSE theme.
*
* @since 6.0.0
* @return bool
*/
function wc_current_theme_supports_woocommerce_or_fse() {
return (bool) current_theme_supports( 'woocommerce' ) || wc_current_theme_is_fse_theme();
}
/**
* Given an element name, returns a class name.
*
* If the WP-related function is not defined or current theme is not a FSE theme, return empty string.
*
* @param string $element The name of the element.
*
* @since 7.0.1
* @return string
*/
function wc_wp_theme_get_element_class_name( $element ) {
if ( wc_current_theme_is_fse_theme() && function_exists( 'wp_theme_get_element_class_name' ) ) {
return wp_theme_get_element_class_name( $element );
}
return '';
}
/**
* Given an element name, returns true or false depending on whether the
* current theme has styles for that element defined in theme.json.
*
* If the theme is not a block theme or the WP-related function is not defined,
* return false.
*
* @param string $element The name of the element.
*
* @since 7.4.0
* @return bool
*/
function wc_block_theme_has_styles_for_element( $element ) {
if (
! wc_current_theme_is_fse_theme() ||
wc_wp_theme_get_element_class_name( $element ) === ''
) {
return false;
}
if ( function_exists( 'wp_get_global_styles' ) ) {
$global_styles = wp_get_global_styles();
if (
array_key_exists( 'elements', $global_styles ) &&
array_key_exists( $element, $global_styles['elements'] )
) {
return is_array( $global_styles['elements'][ $element ] );
}
}
return false;
}
Fatal error: Uncaught Error: Call to undefined function wc_current_theme_is_fse_theme() in /home/arasetne/public_html/wp-content/plugins/woocommerce/includes/customizer/class-wc-shop-customizer.php:892
Stack trace:
#0 /home/arasetne/public_html/wp-content/plugins/woocommerce/includes/class-woocommerce.php(512): include_once()
#1 /home/arasetne/public_html/wp-content/plugins/woocommerce/includes/class-woocommerce.php(186): WooCommerce->includes()
#2 /home/arasetne/public_html/wp-content/plugins/woocommerce/includes/class-woocommerce.php(145): WooCommerce->__construct()
#3 /home/arasetne/public_html/wp-content/plugins/woocommerce/woocommerce.php(47): WooCommerce::instance()
#4 /home/arasetne/public_html/wp-content/plugins/woocommerce/woocommerce.php(62): WC()
#5 /home/arasetne/public_html/wp-settings.php(517): include_once('/home/arasetne/...')
#6 /home/arasetne/public_html/wp-config.php(188): require_once('/home/arasetne/...')
#7 /home/arasetne/public_html/wp-load.php(50): require_once('/home/arasetne/...')
#8 /home/araset in /home/arasetne/public_html/wp-content/plugins/woocommerce/includes/customizer/class-wc-shop-customizer.php on line 892