Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/woocomme.../includes
File: wc-conditional-functions.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WooCommerce Conditional Functions
[2] Fix | Delete
*
[3] Fix | Delete
* Functions for determining the current query/page.
[4] Fix | Delete
*
[5] Fix | Delete
* @package WooCommerce\Functions
[6] Fix | Delete
* @version 2.3.0
[7] Fix | Delete
*/
[8] Fix | Delete
[9] Fix | Delete
use Automattic\Jetpack\Constants;
[10] Fix | Delete
use Automattic\WooCommerce\Blocks\Utils\CartCheckoutUtils;
[11] Fix | Delete
[12] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[13] Fix | Delete
exit;
[14] Fix | Delete
}
[15] Fix | Delete
[16] Fix | Delete
/**
[17] Fix | Delete
* Is_woocommerce - Returns true if on a page which uses WooCommerce templates (cart and checkout are standard pages with shortcodes and thus are not included).
[18] Fix | Delete
*
[19] Fix | Delete
* @return bool
[20] Fix | Delete
*/
[21] Fix | Delete
function is_woocommerce() {
[22] Fix | Delete
return apply_filters( 'is_woocommerce', is_shop() || is_product_taxonomy() || is_product() );
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
if ( ! function_exists( 'is_shop' ) ) {
[26] Fix | Delete
[27] Fix | Delete
/**
[28] Fix | Delete
* Is_shop - Returns true when viewing the product type archive (shop).
[29] Fix | Delete
*
[30] Fix | Delete
* @return bool
[31] Fix | Delete
*/
[32] Fix | Delete
function is_shop() {
[33] Fix | Delete
return ( is_post_type_archive( 'product' ) || is_page( wc_get_page_id( 'shop' ) ) );
[34] Fix | Delete
}
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
if ( ! function_exists( 'is_product_taxonomy' ) ) {
[38] Fix | Delete
[39] Fix | Delete
/**
[40] Fix | Delete
* Is_product_taxonomy - Returns true when viewing a product taxonomy archive.
[41] Fix | Delete
*
[42] Fix | Delete
* @return bool
[43] Fix | Delete
*/
[44] Fix | Delete
function is_product_taxonomy() {
[45] Fix | Delete
return is_tax( get_object_taxonomies( 'product' ) );
[46] Fix | Delete
}
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
if ( ! function_exists( 'is_product_category' ) ) {
[50] Fix | Delete
[51] Fix | Delete
/**
[52] Fix | Delete
* Is_product_category - Returns true when viewing a product category.
[53] Fix | Delete
*
[54] Fix | Delete
* @param string $term (default: '') The term slug your checking for. Leave blank to return true on any.
[55] Fix | Delete
* @return bool
[56] Fix | Delete
*/
[57] Fix | Delete
function is_product_category( $term = '' ) {
[58] Fix | Delete
return is_tax( 'product_cat', $term );
[59] Fix | Delete
}
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
if ( ! function_exists( 'is_product_tag' ) ) {
[63] Fix | Delete
[64] Fix | Delete
/**
[65] Fix | Delete
* Is_product_tag - Returns true when viewing a product tag.
[66] Fix | Delete
*
[67] Fix | Delete
* @param string $term (default: '') The term slug your checking for. Leave blank to return true on any.
[68] Fix | Delete
* @return bool
[69] Fix | Delete
*/
[70] Fix | Delete
function is_product_tag( $term = '' ) {
[71] Fix | Delete
return is_tax( 'product_tag', $term );
[72] Fix | Delete
}
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
if ( ! function_exists( 'is_product' ) ) {
[76] Fix | Delete
[77] Fix | Delete
/**
[78] Fix | Delete
* Is_product - Returns true when viewing a single product.
[79] Fix | Delete
*
[80] Fix | Delete
* @return bool
[81] Fix | Delete
*/
[82] Fix | Delete
function is_product() {
[83] Fix | Delete
return is_singular( array( 'product' ) );
[84] Fix | Delete
}
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
if ( ! function_exists( 'is_cart' ) ) {
[88] Fix | Delete
[89] Fix | Delete
/**
[90] Fix | Delete
* Is_cart - Returns true when viewing the cart page.
[91] Fix | Delete
*
[92] Fix | Delete
* @return bool
[93] Fix | Delete
*/
[94] Fix | Delete
function is_cart() {
[95] Fix | Delete
/**
[96] Fix | Delete
* Filter to allow for custom logic to determine if the cart page is being viewed.
[97] Fix | Delete
*
[98] Fix | Delete
* @since 2.4.0
[99] Fix | Delete
* @param bool $is_cart Whether the cart page is being viewed.
[100] Fix | Delete
*/
[101] Fix | Delete
return apply_filters( 'woocommerce_is_cart', false ) || Constants::is_defined( 'WOOCOMMERCE_CART' ) || CartCheckoutUtils::is_cart_page();
[102] Fix | Delete
}
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
if ( ! function_exists( 'is_checkout' ) ) {
[106] Fix | Delete
[107] Fix | Delete
/**
[108] Fix | Delete
* Is_checkout - Returns true when viewing the checkout page, or when processing AJAX requests for updating or processing the checkout.
[109] Fix | Delete
*
[110] Fix | Delete
* @return bool
[111] Fix | Delete
*/
[112] Fix | Delete
function is_checkout() {
[113] Fix | Delete
/**
[114] Fix | Delete
* Filter to allow for custom logic to determine if the checkout page is being viewed.
[115] Fix | Delete
*
[116] Fix | Delete
* @since 2.4.0
[117] Fix | Delete
* @param bool $is_checkout Whether the checkout page is being viewed.
[118] Fix | Delete
*/
[119] Fix | Delete
return apply_filters( 'woocommerce_is_checkout', false ) || Constants::is_defined( 'WOOCOMMERCE_CHECKOUT' ) || CartCheckoutUtils::is_checkout_page();
[120] Fix | Delete
}
[121] Fix | Delete
}
[122] Fix | Delete
[123] Fix | Delete
if ( ! function_exists( 'is_checkout_pay_page' ) ) {
[124] Fix | Delete
[125] Fix | Delete
/**
[126] Fix | Delete
* Is_checkout_pay - Returns true when viewing the checkout's pay page (aka pay for order page).
[127] Fix | Delete
*
[128] Fix | Delete
* @param bool $use_query_params Whether to use query parameters to determine if this is the pay for order page.
[129] Fix | Delete
* @return bool
[130] Fix | Delete
*/
[131] Fix | Delete
function is_checkout_pay_page( bool $use_query_params = false ): bool {
[132] Fix | Delete
global $wp;
[133] Fix | Delete
[134] Fix | Delete
// Use-case: attempt to identify the page based on global variables.
[135] Fix | Delete
if ( ! empty( $wp->query_vars['order-pay'] ) && is_checkout() ) {
[136] Fix | Delete
return true;
[137] Fix | Delete
}
[138] Fix | Delete
[139] Fix | Delete
// Use-case: check for the presence of a specific query parameter when globals are not available.
[140] Fix | Delete
if ( $use_query_params ) {
[141] Fix | Delete
return isset( $_GET['pay_for_order'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
[142] Fix | Delete
}
[143] Fix | Delete
[144] Fix | Delete
return false;
[145] Fix | Delete
}
[146] Fix | Delete
}
[147] Fix | Delete
[148] Fix | Delete
if ( ! function_exists( 'is_wc_endpoint_url' ) ) {
[149] Fix | Delete
[150] Fix | Delete
/**
[151] Fix | Delete
* Is_wc_endpoint_url - Check if an endpoint is showing.
[152] Fix | Delete
*
[153] Fix | Delete
* @param string|false $endpoint Whether endpoint.
[154] Fix | Delete
* @return bool
[155] Fix | Delete
*/
[156] Fix | Delete
function is_wc_endpoint_url( $endpoint = false ) {
[157] Fix | Delete
global $wp;
[158] Fix | Delete
[159] Fix | Delete
$wc_endpoints = WC()->query->get_query_vars();
[160] Fix | Delete
[161] Fix | Delete
if ( false !== $endpoint ) {
[162] Fix | Delete
if ( ! isset( $wc_endpoints[ $endpoint ] ) ) {
[163] Fix | Delete
return false;
[164] Fix | Delete
} else {
[165] Fix | Delete
$endpoint_var = $wc_endpoints[ $endpoint ];
[166] Fix | Delete
}
[167] Fix | Delete
[168] Fix | Delete
return isset( $wp->query_vars[ $endpoint_var ] );
[169] Fix | Delete
} else {
[170] Fix | Delete
foreach ( $wc_endpoints as $key => $value ) {
[171] Fix | Delete
if ( isset( $wp->query_vars[ $key ] ) ) {
[172] Fix | Delete
return true;
[173] Fix | Delete
}
[174] Fix | Delete
}
[175] Fix | Delete
[176] Fix | Delete
return false;
[177] Fix | Delete
}
[178] Fix | Delete
}
[179] Fix | Delete
}
[180] Fix | Delete
[181] Fix | Delete
if ( ! function_exists( 'is_account_page' ) ) {
[182] Fix | Delete
[183] Fix | Delete
/**
[184] Fix | Delete
* Is_account_page - Returns true when viewing an account page.
[185] Fix | Delete
*
[186] Fix | Delete
* @return bool
[187] Fix | Delete
*/
[188] Fix | Delete
function is_account_page() {
[189] Fix | Delete
$page_id = wc_get_page_id( 'myaccount' );
[190] Fix | Delete
[191] Fix | Delete
return ( $page_id && is_page( $page_id ) ) || wc_post_content_has_shortcode( 'woocommerce_my_account' ) || apply_filters( 'woocommerce_is_account_page', false );
[192] Fix | Delete
}
[193] Fix | Delete
}
[194] Fix | Delete
[195] Fix | Delete
if ( ! function_exists( 'is_view_order_page' ) ) {
[196] Fix | Delete
[197] Fix | Delete
/**
[198] Fix | Delete
* Is_view_order_page - Returns true when on the view order page.
[199] Fix | Delete
*
[200] Fix | Delete
* @return bool
[201] Fix | Delete
*/
[202] Fix | Delete
function is_view_order_page() {
[203] Fix | Delete
global $wp;
[204] Fix | Delete
[205] Fix | Delete
$page_id = wc_get_page_id( 'myaccount' );
[206] Fix | Delete
[207] Fix | Delete
return ( $page_id && is_page( $page_id ) && isset( $wp->query_vars['view-order'] ) );
[208] Fix | Delete
}
[209] Fix | Delete
}
[210] Fix | Delete
[211] Fix | Delete
if ( ! function_exists( 'is_edit_account_page' ) ) {
[212] Fix | Delete
[213] Fix | Delete
/**
[214] Fix | Delete
* Check for edit account page.
[215] Fix | Delete
* Returns true when viewing the edit account page.
[216] Fix | Delete
*
[217] Fix | Delete
* @since 2.5.1
[218] Fix | Delete
* @return bool
[219] Fix | Delete
*/
[220] Fix | Delete
function is_edit_account_page() {
[221] Fix | Delete
global $wp;
[222] Fix | Delete
[223] Fix | Delete
$page_id = wc_get_page_id( 'myaccount' );
[224] Fix | Delete
[225] Fix | Delete
return ( $page_id && is_page( $page_id ) && isset( $wp->query_vars['edit-account'] ) );
[226] Fix | Delete
}
[227] Fix | Delete
}
[228] Fix | Delete
[229] Fix | Delete
if ( ! function_exists( 'is_order_received_page' ) ) {
[230] Fix | Delete
[231] Fix | Delete
/**
[232] Fix | Delete
* Is_order_received_page - Returns true when viewing the order received page.
[233] Fix | Delete
*
[234] Fix | Delete
* @return bool
[235] Fix | Delete
*/
[236] Fix | Delete
function is_order_received_page() {
[237] Fix | Delete
global $wp;
[238] Fix | Delete
[239] Fix | Delete
$page_id = wc_get_page_id( 'checkout' );
[240] Fix | Delete
[241] Fix | Delete
return apply_filters( 'woocommerce_is_order_received_page', ( $page_id && is_page( $page_id ) && isset( $wp->query_vars['order-received'] ) ) );
[242] Fix | Delete
}
[243] Fix | Delete
}
[244] Fix | Delete
[245] Fix | Delete
if ( ! function_exists( 'is_payment_methods_page' ) ) {
[246] Fix | Delete
[247] Fix | Delete
/**
[248] Fix | Delete
* Is_payment_methods_page - Returns true when viewing the payment methods list page.
[249] Fix | Delete
*
[250] Fix | Delete
* @return bool
[251] Fix | Delete
*/
[252] Fix | Delete
function is_payment_methods_page() {
[253] Fix | Delete
global $wp;
[254] Fix | Delete
[255] Fix | Delete
$page_id = wc_get_page_id( 'myaccount' );
[256] Fix | Delete
[257] Fix | Delete
return ( $page_id && is_page( $page_id ) && isset( $wp->query_vars['payment-methods'] ) );
[258] Fix | Delete
}
[259] Fix | Delete
}
[260] Fix | Delete
[261] Fix | Delete
if ( ! function_exists( 'is_add_payment_method_page' ) ) {
[262] Fix | Delete
[263] Fix | Delete
/**
[264] Fix | Delete
* Is_add_payment_method_page - Returns true when viewing the add payment method page.
[265] Fix | Delete
*
[266] Fix | Delete
* @return bool
[267] Fix | Delete
*/
[268] Fix | Delete
function is_add_payment_method_page() {
[269] Fix | Delete
global $wp;
[270] Fix | Delete
[271] Fix | Delete
$page_id = wc_get_page_id( 'myaccount' );
[272] Fix | Delete
[273] Fix | Delete
return ( $page_id && is_page( $page_id ) && ( isset( $wp->query_vars['payment-methods'] ) || isset( $wp->query_vars['add-payment-method'] ) ) );
[274] Fix | Delete
}
[275] Fix | Delete
}
[276] Fix | Delete
[277] Fix | Delete
if ( ! function_exists( 'is_lost_password_page' ) ) {
[278] Fix | Delete
[279] Fix | Delete
/**
[280] Fix | Delete
* Is_lost_password_page - Returns true when viewing the lost password page.
[281] Fix | Delete
*
[282] Fix | Delete
* @return bool
[283] Fix | Delete
*/
[284] Fix | Delete
function is_lost_password_page() {
[285] Fix | Delete
global $wp;
[286] Fix | Delete
[287] Fix | Delete
$page_id = wc_get_page_id( 'myaccount' );
[288] Fix | Delete
[289] Fix | Delete
return ( $page_id && is_page( $page_id ) && isset( $wp->query_vars['lost-password'] ) );
[290] Fix | Delete
}
[291] Fix | Delete
}
[292] Fix | Delete
[293] Fix | Delete
if ( ! function_exists( 'is_wc_admin_settings_page' ) ) {
[294] Fix | Delete
[295] Fix | Delete
/**
[296] Fix | Delete
* Is_wc_admin_settings_page - Returns true when viewing the admin settings page.
[297] Fix | Delete
*
[298] Fix | Delete
* @return bool
[299] Fix | Delete
*/
[300] Fix | Delete
function is_wc_admin_settings_page(): bool {
[301] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
[302] Fix | Delete
return isset( $_REQUEST['page'] ) && 'wc-settings' === wp_unslash( $_REQUEST['page'] ) && is_admin();
[303] Fix | Delete
}
[304] Fix | Delete
}
[305] Fix | Delete
[306] Fix | Delete
if ( ! function_exists( 'is_ajax' ) ) {
[307] Fix | Delete
[308] Fix | Delete
/**
[309] Fix | Delete
* Is_ajax - Returns true when the page is loaded via ajax.
[310] Fix | Delete
*
[311] Fix | Delete
* @see wp_doing_ajax() for an equivalent function provided by WordPress since 4.7.0
[312] Fix | Delete
* @return bool
[313] Fix | Delete
*/
[314] Fix | Delete
function is_ajax() {
[315] Fix | Delete
return function_exists( 'wp_doing_ajax' ) ? wp_doing_ajax() : Constants::is_defined( 'DOING_AJAX' );
[316] Fix | Delete
}
[317] Fix | Delete
}
[318] Fix | Delete
[319] Fix | Delete
if ( ! function_exists( 'is_store_notice_showing' ) ) {
[320] Fix | Delete
[321] Fix | Delete
/**
[322] Fix | Delete
* Is_store_notice_showing - Returns true when store notice is active.
[323] Fix | Delete
*
[324] Fix | Delete
* @return bool
[325] Fix | Delete
*/
[326] Fix | Delete
function is_store_notice_showing() {
[327] Fix | Delete
return 'no' !== get_option( 'woocommerce_demo_store', 'no' );
[328] Fix | Delete
}
[329] Fix | Delete
}
[330] Fix | Delete
[331] Fix | Delete
if ( ! function_exists( 'is_filtered' ) ) {
[332] Fix | Delete
[333] Fix | Delete
/**
[334] Fix | Delete
* Is_filtered - Returns true when filtering products using layered nav or price sliders.
[335] Fix | Delete
*
[336] Fix | Delete
* @return bool
[337] Fix | Delete
*/
[338] Fix | Delete
function is_filtered() {
[339] Fix | Delete
return apply_filters( 'woocommerce_is_filtered', ( count( WC_Query::get_layered_nav_chosen_attributes() ) > 0 || isset( $_GET['max_price'] ) || isset( $_GET['min_price'] ) || isset( $_GET['rating_filter'] ) ) ); // WPCS: CSRF ok.
[340] Fix | Delete
}
[341] Fix | Delete
}
[342] Fix | Delete
[343] Fix | Delete
if ( ! function_exists( 'taxonomy_is_product_attribute' ) ) {
[344] Fix | Delete
[345] Fix | Delete
/**
[346] Fix | Delete
* Returns true when the passed taxonomy name is a product attribute.
[347] Fix | Delete
*
[348] Fix | Delete
* @uses $wc_product_attributes global which stores taxonomy names upon registration
[349] Fix | Delete
* @param string $name of the attribute.
[350] Fix | Delete
* @return bool
[351] Fix | Delete
*/
[352] Fix | Delete
function taxonomy_is_product_attribute( $name ) {
[353] Fix | Delete
global $wc_product_attributes;
[354] Fix | Delete
[355] Fix | Delete
return taxonomy_exists( $name ) && array_key_exists( $name, (array) $wc_product_attributes );
[356] Fix | Delete
}
[357] Fix | Delete
}
[358] Fix | Delete
[359] Fix | Delete
if ( ! function_exists( 'meta_is_product_attribute' ) ) {
[360] Fix | Delete
[361] Fix | Delete
/**
[362] Fix | Delete
* Returns true when the passed meta name is a product attribute.
[363] Fix | Delete
*
[364] Fix | Delete
* @param string $name of the attribute.
[365] Fix | Delete
* @param string $value of the attribute.
[366] Fix | Delete
* @param int $product_id to check for attribute.
[367] Fix | Delete
* @return bool
[368] Fix | Delete
*/
[369] Fix | Delete
function meta_is_product_attribute( $name, $value, $product_id ) {
[370] Fix | Delete
$product = wc_get_product( $product_id );
[371] Fix | Delete
[372] Fix | Delete
if ( $product && method_exists( $product, 'get_variation_attributes' ) ) {
[373] Fix | Delete
$variation_attributes = $product->get_variation_attributes();
[374] Fix | Delete
$attributes = $product->get_attributes();
[375] Fix | Delete
[376] Fix | Delete
return (
[377] Fix | Delete
in_array( $name, array_keys( $attributes ), true ) &&
[378] Fix | Delete
isset( $variation_attributes[ $attributes[ $name ]['name'] ] ) &&
[379] Fix | Delete
in_array( $value, $variation_attributes[ $attributes[ $name ]['name'] ], true )
[380] Fix | Delete
);
[381] Fix | Delete
} else {
[382] Fix | Delete
return false;
[383] Fix | Delete
}
[384] Fix | Delete
}
[385] Fix | Delete
}
[386] Fix | Delete
[387] Fix | Delete
if ( ! function_exists( 'wc_tax_enabled' ) ) {
[388] Fix | Delete
[389] Fix | Delete
/**
[390] Fix | Delete
* Are store-wide taxes enabled?
[391] Fix | Delete
*
[392] Fix | Delete
* @return bool
[393] Fix | Delete
*/
[394] Fix | Delete
function wc_tax_enabled() {
[395] Fix | Delete
return apply_filters( 'wc_tax_enabled', get_option( 'woocommerce_calc_taxes' ) === 'yes' );
[396] Fix | Delete
}
[397] Fix | Delete
}
[398] Fix | Delete
[399] Fix | Delete
if ( ! function_exists( 'wc_shipping_enabled' ) ) {
[400] Fix | Delete
[401] Fix | Delete
/**
[402] Fix | Delete
* Is shipping enabled?
[403] Fix | Delete
*
[404] Fix | Delete
* @return bool
[405] Fix | Delete
*/
[406] Fix | Delete
function wc_shipping_enabled() {
[407] Fix | Delete
return apply_filters( 'wc_shipping_enabled', get_option( 'woocommerce_ship_to_countries' ) !== 'disabled' );
[408] Fix | Delete
}
[409] Fix | Delete
}
[410] Fix | Delete
[411] Fix | Delete
if ( ! function_exists( 'wc_prices_include_tax' ) ) {
[412] Fix | Delete
[413] Fix | Delete
/**
[414] Fix | Delete
* Are prices inclusive of tax?
[415] Fix | Delete
*
[416] Fix | Delete
* @return bool
[417] Fix | Delete
*/
[418] Fix | Delete
function wc_prices_include_tax() {
[419] Fix | Delete
return wc_tax_enabled() && apply_filters( 'woocommerce_prices_include_tax', get_option( 'woocommerce_prices_include_tax' ) === 'yes' );
[420] Fix | Delete
}
[421] Fix | Delete
}
[422] Fix | Delete
[423] Fix | Delete
/**
[424] Fix | Delete
* Simple check for validating a URL, it must start with http:// or https://.
[425] Fix | Delete
* and pass FILTER_VALIDATE_URL validation.
[426] Fix | Delete
*
[427] Fix | Delete
* @param string $url to check.
[428] Fix | Delete
* @return bool
[429] Fix | Delete
*/
[430] Fix | Delete
function wc_is_valid_url( $url ) {
[431] Fix | Delete
[432] Fix | Delete
// Must start with http:// or https://.
[433] Fix | Delete
if ( 0 !== strpos( $url, 'http://' ) && 0 !== strpos( $url, 'https://' ) ) {
[434] Fix | Delete
return false;
[435] Fix | Delete
}
[436] Fix | Delete
[437] Fix | Delete
// Must pass validation.
[438] Fix | Delete
if ( ! filter_var( $url, FILTER_VALIDATE_URL ) ) {
[439] Fix | Delete
return false;
[440] Fix | Delete
}
[441] Fix | Delete
[442] Fix | Delete
return true;
[443] Fix | Delete
}
[444] Fix | Delete
[445] Fix | Delete
/**
[446] Fix | Delete
* Check if the home URL is https. If it is, we don't need to do things such as 'force ssl'.
[447] Fix | Delete
*
[448] Fix | Delete
* @since 2.4.13
[449] Fix | Delete
* @return bool
[450] Fix | Delete
*/
[451] Fix | Delete
function wc_site_is_https() {
[452] Fix | Delete
return false !== strstr( get_option( 'home' ), 'https:' );
[453] Fix | Delete
}
[454] Fix | Delete
[455] Fix | Delete
/**
[456] Fix | Delete
* Check if the checkout is configured for https. Look at options, WP HTTPS plugin, or the permalink itself.
[457] Fix | Delete
*
[458] Fix | Delete
* @since 2.5.0
[459] Fix | Delete
* @return bool
[460] Fix | Delete
*/
[461] Fix | Delete
function wc_checkout_is_https() {
[462] Fix | Delete
return wc_site_is_https() || 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) || class_exists( 'WordPressHTTPS' ) || strstr( wc_get_page_permalink( 'checkout' ), 'https:' );
[463] Fix | Delete
}
[464] Fix | Delete
[465] Fix | Delete
/**
[466] Fix | Delete
* Checks whether the content passed contains a specific short code.
[467] Fix | Delete
*
[468] Fix | Delete
* @param string $tag Shortcode tag to check.
[469] Fix | Delete
* @return bool
[470] Fix | Delete
*/
[471] Fix | Delete
function wc_post_content_has_shortcode( $tag = '' ) {
[472] Fix | Delete
global $post;
[473] Fix | Delete
[474] Fix | Delete
return is_singular() && is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, $tag );
[475] Fix | Delete
}
[476] Fix | Delete
[477] Fix | Delete
/**
[478] Fix | Delete
* Check if reviews are enabled.
[479] Fix | Delete
*
[480] Fix | Delete
* @since 3.6.0
[481] Fix | Delete
* @return bool
[482] Fix | Delete
*/
[483] Fix | Delete
function wc_reviews_enabled() {
[484] Fix | Delete
return 'yes' === get_option( 'woocommerce_enable_reviews' );
[485] Fix | Delete
}
[486] Fix | Delete
[487] Fix | Delete
/**
[488] Fix | Delete
* Check if reviews ratings are enabled.
[489] Fix | Delete
*
[490] Fix | Delete
* @since 3.6.0
[491] Fix | Delete
* @return bool
[492] Fix | Delete
*/
[493] Fix | Delete
function wc_review_ratings_enabled() {
[494] Fix | Delete
return wc_reviews_enabled() && 'yes' === get_option( 'woocommerce_enable_review_rating' );
[495] Fix | Delete
}
[496] Fix | Delete
[497] Fix | Delete
/**
[498] Fix | Delete
* Check if review ratings are required.
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function