本文整理汇总了PHP中is_checkout函数的典型用法代码示例。如果您正苦于以下问题:PHP is_checkout函数的具体用法?PHP is_checkout怎么用?PHP is_checkout使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_checkout函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hide_minicart
public function hide_minicart($bool)
{
if (is_cart() || is_checkout()) {
return false;
}
return $bool;
}
示例2: widget
/**
* widget function.
*
* @see WP_Widget
* @access public
* @param array $args
* @param array $instance
* @return void
*/
function widget($args, $instance)
{
global $woocommerce;
extract($args);
if (is_cart() || is_checkout()) {
return;
}
$title = apply_filters('widget_title', empty($instance['title']) ? __('Cart', 'woocommerce') : $instance['title'], $instance, $this->id_base);
$hide_if_empty = empty($instance['hide_if_empty']) ? 0 : 1;
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
if ($hide_if_empty) {
echo '<div class="hide_cart_widget_if_empty">';
}
// Insert cart widget placeholder - code in woocommerce.js will update this on page load
echo '<div class="widget_shopping_cart_content"></div>';
if ($hide_if_empty) {
echo '</div>';
}
echo $after_widget;
if ($hide_if_empty && sizeof($woocommerce->cart->get_cart()) == 0) {
$woocommerce->add_inline_js("\n\t\t\t\tjQuery('.hide_cart_widget_if_empty').closest('.widget_shopping_cart').hide();\n\n\t\t\t\tjQuery('body').bind('adding_to_cart', function(){\n\t\t\t\t\tjQuery('.hide_cart_widget_if_empty').closest('.widget_shopping_cart').fadeIn();\n\t\t\t\t});\n\t\t\t");
}
}
示例3: child_manage_woocommerce_styles
/**
* Remove WooCommerce Generator tag, styles, and scripts from the homepage.
* Tested and works with WooCommerce 2.0+
*
* @author Greg Rickaby
* @since 2.0.0
*/
function child_manage_woocommerce_styles()
{
remove_action('wp_head', array($GLOBALS['woocommerce'], 'generator'));
if (!is_woocommerce() && !is_cart() && !is_checkout()) {
wp_dequeue_style('woocommerce_frontend_styles');
wp_dequeue_style('woocommerce_fancybox_styles');
wp_dequeue_style('woocommerce_chosen_styles');
wp_dequeue_style('woocommerce_prettyPhoto_css');
wp_dequeue_script('wc_price_slider');
wp_dequeue_script('wc-single-product');
wp_dequeue_script('wc-add-to-cart');
wp_dequeue_script('wc-cart-fragments');
wp_dequeue_script('wc-checkout');
wp_dequeue_script('wc-add-to-cart-variation');
wp_dequeue_script('wc-single-product');
wp_dequeue_script('wc-cart');
wp_dequeue_script('wc-chosen');
wp_dequeue_script('woocommerce');
wp_dequeue_script('prettyPhoto');
wp_dequeue_script('prettyPhoto-init');
wp_dequeue_script('jquery-blockui');
wp_dequeue_script('jquery-placeholder');
wp_dequeue_script('fancybox');
wp_dequeue_script('jqueryui');
}
}
示例4: mango_current_page_id
function mango_current_page_id()
{
global $post, $wp_query;
$current_page_id = '';
// Get The Page ID You Need
//wp_reset_postdata();
if (class_exists("woocommerce")) {
if (is_shop()) {
///|| is_product_category() || is_product_tag()) {
$current_page_id = get_option('woocommerce_shop_page_id');
} elseif (is_cart()) {
$current_page_id = get_option('woocommerce_cart_page_id');
} elseif (is_checkout()) {
$current_page_id = get_option('woocommerce_checkout_page_id');
} elseif (is_account_page()) {
$current_page_id = get_option('woocommerce_myaccount_page_id');
} elseif (is_view_order_page()) {
$current_page_id = get_option('woocommerce_view_order_page_id');
}
}
if ($current_page_id == '') {
if (is_home() && is_front_page()) {
$current_page_id = '';
} elseif (is_home()) {
$current_page_id = get_option('page_for_posts');
} elseif (is_search() || is_category() || is_tag() || is_tax()) {
$current_page_id = '';
//}elseif(class_exists("woocommerce") && (is_shop() || is_product_category() || is_cart() || is_checkout() || is_account_page() || is_view_order_page() )){
// $current_page_id = '';
} elseif (!is_404()) {
$current_page_id = $post->ID;
}
}
return $current_page_id;
}
示例5: veritrans_scripts
function veritrans_scripts()
{
if (is_checkout()) {
wp_enqueue_script('veritrans', 'https://payments.veritrans.co.id/vtdirect/veritrans.min.js', array('jquery'));
wp_enqueue_script('veritrans-integration', VT_PLUGIN_DIR . 'js/script.js', array('veritrans'));
}
}
示例6: woo_wc_body_class
function woo_wc_body_class($classes)
{
if (is_checkout() && apply_filters('upstart_distraction_free_checkout', true)) {
$classes[] = 'distraction-free-checkout';
}
return $classes;
}
示例7: wpex_add_itemcart_to_menu
function wpex_add_itemcart_to_menu($items, $args)
{
// Add to main menu only
if ('main_menu' == $args->theme_location) {
// Get style from theme mod
$style = get_theme_mod('woo_menu_icon_style', 'drop-down');
// Add class for the toggle
if ('drop-down' == $style) {
$class = 'wcmenucart-toggle-dropdown';
} elseif ('overlay' == $style) {
$class = 'wcmenucart-toggle-overlay';
} elseif ('store' == $style) {
$class = '';
} elseif ('custom-link' == $style) {
$class = '';
} else {
$class = '';
}
// Only add toggle class when needed
if (is_cart() || is_checkout()) {
$class = '';
}
// Add cart link to menu items
$items .= '<li class="' . $class . ' woo-menu-icon">' . wpex_wcmenucart_menu_item() . '</li>';
}
// Return menu items
return $items;
}
示例8: woodrobe_body_class
function woodrobe_body_class($classes)
{
if (is_woocommerce() || is_cart() || is_checkout() || is_account_page()) {
$classes[] = 'woodrobe';
}
return $classes;
}
示例9: flatsome_admin_bar_helper
function flatsome_admin_bar_helper()
{
global $wp_admin_bar;
$optionUrl = get_admin_url() . 'themes.php?page=optionsframework';
$adminUrl = get_admin_url();
if (is_category() || is_home()) {
$wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'Blog Layout', 'href' => $optionUrl . '&tab=of-option-blog'));
}
if (ux_is_woocommerce_active()) {
if (is_checkout() || is_cart()) {
$wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'Checkout Settings', 'href' => $adminUrl . 'admin.php?page=wc-settings&tab=checkout'));
}
if (is_product()) {
$wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'Product Page Layout', 'href' => $optionUrl . '&tab=of-option-productpage'));
}
if (is_account_page()) {
$wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'My Account Page', 'href' => $adminUrl . 'admin.php?page=wc-settings&tab=account'));
}
if (is_shop() || is_product_category()) {
$wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'Shop Settings'));
$wp_admin_bar->add_menu(array('parent' => 'admin_bar_helper', 'id' => 'admin_bar_helper_flatsome', 'title' => 'Category Page Layout', 'href' => $optionUrl . '&tab=of-option-categorypage'));
$wp_admin_bar->add_menu(array('parent' => 'admin_bar_helper', 'id' => 'admin_bar_helper_woocommerce', 'title' => 'Shop Page Display', 'href' => $adminUrl . 'admin.php?page=wc-settings&tab=products§ion=display'));
}
}
}
示例10: load_checkout_script
/**
* Add script to checkout page
*/
public function load_checkout_script()
{
if (is_checkout()) {
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
wp_enqueue_script('wc-tfls-checkout', plugin_dir_url(TFLS_FILE) . 'assets/js/tfls-checkout' . $suffix . '.js', array('wc-checkout', 'wc-cart-fragments'), WC_VERSION, true);
}
}
示例11: load_scripts
/**
* Register/queue frontend scripts.
*
* @access public
* @return void
*/
public static function load_scripts()
{
global $post;
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
$lightbox_en = get_option('woocommerce_enable_lightbox') == 'yes' ? true : false;
$ajax_cart_en = get_option('woocommerce_enable_ajax_add_to_cart') == 'yes' ? true : false;
$assets_path = str_replace(array('http:', 'https:'), '', WC()->plugin_url()) . '/assets/';
$frontend_script_path = $assets_path . 'js/frontend/';
// Register any scripts for later use, or used as dependencies
wp_register_script('chosen', $assets_path . 'js/chosen/chosen.jquery' . $suffix . '.js', array('jquery'), '1.0.0', true);
wp_register_script('jquery-blockui', $assets_path . 'js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array('jquery'), '2.60', true);
wp_register_script('jquery-payment', $assets_path . 'js/jquery-payment/jquery.payment' . $suffix . '.js', array('jquery'), '1.0.2', true);
wp_register_script('wc-credit-card-form', $assets_path . 'js/frontend/credit-card-form' . $suffix . '.js', array('jquery', 'jquery-payment'), WC_VERSION, true);
wp_register_script('wc-add-to-cart-variation', $frontend_script_path . 'add-to-cart-variation' . $suffix . '.js', array('jquery'), WC_VERSION, true);
wp_register_script('wc-single-product', $frontend_script_path . 'single-product' . $suffix . '.js', array('jquery'), WC_VERSION, true);
wp_register_script('wc-country-select', $frontend_script_path . 'country-select' . $suffix . '.js', array('jquery'), WC_VERSION, true);
wp_register_script('wc-address-i18n', $frontend_script_path . 'address-i18n' . $suffix . '.js', array('jquery'), WC_VERSION, true);
wp_register_script('jquery-cookie', $assets_path . 'js/jquery-cookie/jquery.cookie' . $suffix . '.js', array('jquery'), '1.3.1', true);
// Queue frontend scripts conditionally
if ($ajax_cart_en) {
wp_enqueue_script('wc-add-to-cart', $frontend_script_path . 'add-to-cart' . $suffix . '.js', array('jquery'), WC_VERSION, true);
}
if (is_cart()) {
wp_enqueue_script('wc-cart', $frontend_script_path . 'cart' . $suffix . '.js', array('jquery', 'wc-country-select'), WC_VERSION, true);
}
if (is_checkout()) {
if (get_option('woocommerce_enable_chosen') == 'yes') {
wp_enqueue_script('wc-chosen', $frontend_script_path . 'chosen-frontend' . $suffix . '.js', array('chosen'), WC_VERSION, true);
wp_enqueue_style('woocommerce_chosen_styles', $assets_path . 'css/chosen.css');
}
wp_enqueue_script('wc-checkout', $frontend_script_path . 'checkout' . $suffix . '.js', array('jquery', 'woocommerce', 'wc-country-select', 'wc-address-i18n'), WC_VERSION, true);
}
if (is_page(get_option('woocommerce_myaccount_page_id'))) {
if (get_option('woocommerce_enable_chosen') == 'yes') {
wp_enqueue_script('wc-chosen', $frontend_script_path . 'chosen-frontend' . $suffix . '.js', array('chosen'), WC_VERSION, true);
wp_enqueue_style('woocommerce_chosen_styles', $assets_path . 'css/chosen.css');
}
}
if (is_add_payment_method_page()) {
wp_enqueue_script('wc-add-payment-method', $frontend_script_path . 'add-payment-method' . $suffix . '.js', array('jquery', 'woocommerce'), WC_VERSION, true);
}
if ($lightbox_en && (is_product() || !empty($post->post_content) && strstr($post->post_content, '[product_page'))) {
wp_enqueue_script('prettyPhoto', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto' . $suffix . '.js', array('jquery'), '3.1.5', true);
wp_enqueue_script('prettyPhoto-init', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto.init' . $suffix . '.js', array('jquery', 'prettyPhoto'), WC_VERSION, true);
wp_enqueue_style('woocommerce_prettyPhoto_css', $assets_path . 'css/prettyPhoto.css');
}
if (is_product()) {
wp_enqueue_script('wc-single-product');
}
// Global frontend scripts
wp_enqueue_script('woocommerce', $frontend_script_path . 'woocommerce' . $suffix . '.js', array('jquery', 'jquery-blockui'), WC_VERSION, true);
wp_enqueue_script('wc-cart-fragments', $frontend_script_path . 'cart-fragments' . $suffix . '.js', array('jquery', 'jquery-cookie'), WC_VERSION, true);
// CSS Styles
$enqueue_styles = self::get_styles();
if ($enqueue_styles) {
foreach ($enqueue_styles as $handle => $args) {
wp_enqueue_style($handle, $args['src'], $args['deps'], $args['version'], $args['media']);
}
}
}
示例12: wholesale_price
/**
* wholesale_price.
*/
function wholesale_price($price, $product)
{
if (!wcj_is_product_wholesale_enabled($product->id)) {
return $price;
}
// Show only on checkout and cart pages
$is_ajax = is_admin() && (defined('DOING_AJAX') && DOING_AJAX) ? true : false;
if (!(is_checkout() || is_cart() || $is_ajax)) {
return $price;
}
// Get quanitity from cart
$quanitities = array();
$the_cart = WC()->cart->get_cart();
foreach ($the_cart as $cart_item_key => $values) {
if (!isset($quanitities[$values['product_id']])) {
$quanitities[$values['product_id']] = 0;
}
$quanitities[$values['product_id']] += $values['quantity'];
}
foreach ($quanitities as $product_id => $product_quantity) {
if ($product_id == $product->id) {
// Found matching product in the cart
if ($product_quantity > 1) {
// Setting wholesale price
$price = $this->get_wholesale_price($price, $product_quantity);
$precision = get_option('woocommerce_price_num_decimals', 2);
return round($price, $precision);
}
}
}
return $price;
}
示例13: hide_coupon_field_on_checkout
function hide_coupon_field_on_checkout($enabled)
{
if (is_checkout()) {
$enabled = false;
}
return $enabled;
}
示例14: woocommerce_cart_tab
function woocommerce_cart_tab()
{
global $woocommerce;
$skin = get_option('wc_ct_skin');
$position = get_option('wc_ct_horizontal_position');
$widget = get_option('wc_ct_cart_widget');
if (!is_cart() && !is_checkout()) {
if ($widget == 'yes') {
echo '<div class="' . $position . ' cart-tab ' . $skin . '">';
} else {
echo '<div class="' . $position . ' cart-tab no-animation ' . $skin . '">';
}
wcct_cart_button();
// Display the widget if specified
if ($widget == 'yes') {
// Check for WooCommerce 2.0 and display the cart widget
if (version_compare(WOOCOMMERCE_VERSION, "2.0.0") >= 0) {
the_widget('WC_Widget_Cart', 'title=');
} else {
the_widget('WooCommerce_Widget_Cart', 'title=');
}
}
echo '</div>';
}
}
示例15: xt_get_page_ID
function xt_get_page_ID()
{
global $wp_query, $post;
$page_id = false;
if (is_home() && get_option('page_for_posts')) {
$page_id = get_option('page_for_posts');
} elseif (is_front_page() && get_option('page_on_front')) {
$page_id = get_option('page_on_front');
} else {
if (function_exists('is_shop') && is_shop() && get_option('woocommerce_shop_page_id') != '') {
$page_id = get_option('woocommerce_shop_page_id');
} else {
if (function_exists('is_cart') && is_cart() && get_option('woocommerce_cart_page_id') != '') {
$page_id = get_option('woocommerce_cart_page_id');
} else {
if (function_exists('is_checkout') && is_checkout() && get_option('woocommerce_checkout_page_id') != '') {
$page_id = get_option('woocommerce_checkout_page_id');
} else {
if (function_exists('is_account_page') && is_account_page() && get_option('woocommerce_myaccount_page_id') != '') {
$page_id = get_option('woocommerce_myaccount_page_id');
} else {
if ($wp_query && !empty($wp_query->queried_object) && !empty($wp_query->queried_object->ID)) {
$page_id = $wp_query->queried_object->ID;
} else {
if (!empty($post->ID)) {
$page_id = $post->ID;
}
}
}
}
}
}
}
return $page_id;
}