/** * 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'); } }
/** * 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"); } }
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; }
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; }
function woodrobe_body_class($classes) { if (is_woocommerce() || is_cart() || is_checkout() || is_account_page()) { $classes[] = 'woodrobe'; } return $classes; }
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')); } } }
/** * 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']); } } }
/** * Check if this gateway is enabled and available in the user's country * @return bool */ public function is_available() { if (false === is_checkout()) { return false; } return 'yes' === $this->enabled && 'BR' === $this->get_country_code() && $this->container->api->accept_bank_slip() && $this->container->check_ssl(); }
function hide_coupon_field_on_checkout($enabled) { if (is_checkout()) { $enabled = false; } return $enabled; }
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>'; } }
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; }
/** * Register and Enqueue Klarna scripts */ function load_scripts() { if (is_checkout()) { wp_register_script('klarna-pms-js', KLARNA_URL . 'assets/js/klarnapms.js', array('jquery'), '1.0', false); wp_enqueue_script('klarna-pms-js'); } }
/** * 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); } }
/** * Add the checkout page css to for the grouped payment options */ function add_ipay88_checkout_styles() { if (is_checkout()) { wp_register_style('ipay88-checkout-css', WC_iPay88::plugin_url() . '/assets/css/ipay88.css'); wp_enqueue_style('ipay88-checkout-css'); } }
function woo_wc_body_class($classes) { if (is_checkout() && apply_filters('upstart_distraction_free_checkout', true)) { $classes[] = 'distraction-free-checkout'; } return $classes; }
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')); } }
/** * 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; }
/** * Init theme config for shop. * */ function dt_woocommerce_init_template_config($name = '') { dt_woocommerce_add_config_actions(); if ('shop' != $name) { return; } $config = presscore_get_config(); $post_id = null; if (is_shop()) { $post_id = woocommerce_get_page_id('shop'); } else { if (is_cart()) { $post_id = woocommerce_get_page_id('cart'); } else { if (is_checkout()) { $post_id = woocommerce_get_page_id('checkout'); } } } presscore_config_base_init($post_id); if (is_product_category() || is_product_tag()) { $post_id = woocommerce_get_page_id('shop'); if ($post_id) { $config->set('post_id', $post_id); presscore_config_populate_sidebar_and_footer_options(); $config->set('post_id', null); } } if (!is_product()) { add_filter('presscore_get_page_title', 'dt_woocommerce_get_page_title', 20); } // replace theme breadcrumbs add_filter('presscore_get_breadcrumbs-html', 'dt_woocommerce_replace_theme_breadcrumbs', 20, 2); }
public function hide_minicart($bool) { if (is_cart() || is_checkout()) { return false; } return $bool; }
function child_manage_woocommerce_styles() { //remove generator meta tag remove_action('wp_head', array($GLOBALS['woocommerce'], 'generator')); //first check that woo exists to prevent fatal errors if (function_exists('is_woocommerce')) { //dequeue scripts and styles 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'); } } }
/** * Init theme config for shop. * * @param string $name */ function dt_woocommerce_configure_template($name = '') { dt_woocommerce_configure_mini_cart(); // Add template configuration actions. $config = presscore_config(); $mod_wc_config = dt_woocommerce_template_config($config); add_action('dt_wc_loop_start', array($mod_wc_config, 'setup')); add_action('dt_wc_loop_end', array($mod_wc_config, 'cleanup')); // Stop if not on woocommerce page. if ('shop' !== $name) { return; } // From what page get settings? $post_id = null; if (is_shop()) { $post_id = woocommerce_get_page_id('shop'); } else { if (is_cart()) { $post_id = woocommerce_get_page_id('cart'); } else { if (is_checkout()) { $post_id = woocommerce_get_page_id('checkout'); } } } if ($post_id) { $config->set('post_id', $post_id); } if (!is_product()) { add_filter('presscore_get_page_title', 'dt_woocommerce_get_page_title', 20); } // Replace theme breadcrumbs. add_filter('presscore_get_breadcrumbs-html', 'dt_woocommerce_replace_theme_breadcrumbs', 20, 2); }
/** * enqueue_checkout_script. */ public function enqueue_checkout_script() { if (!is_checkout()) { return; } wp_enqueue_script('wcj-payment-gateways-checkout'); }
function veritrans_scripts() { if (is_checkout()) { wp_enqueue_script('veritrans', 'https://api.veritrans.co.id/v2/assets/js/veritrans.min.js', array('jquery')); wp_enqueue_script('veritrans-integration', VT_PLUGIN_DIR . 'js/script.js', array('veritrans')); } }
/** * Handles the subscription upgrade/downgrade process. * * @since 1.4 */ public static function subscription_switch_handler() { global $woocommerce, $post; // If the current user doesn't own the subscription, remove the query arg from the URL if (isset($_GET['switch-subscription'])) { // Visiting a switch link for someone elses subscription if (!WC_Subscriptions_Manager::user_owns_subscription($_GET['switch-subscription'])) { wp_redirect(remove_query_arg('switch-subscription')); exit; } else { if (isset($_GET['auto-switch'])) { $switch_message = __('You have an active subscription to this product. Choosing a new subscription will replace your existing subscription.', 'woocommerce-subscriptions'); } else { $switch_message = __('Choose a new subscription.', 'woocommerce-subscriptions'); } WC_Subscriptions::add_notice($switch_message, 'notice'); } } elseif ((is_cart() || is_checkout()) && false !== self::cart_contains_subscription_switch()) { WC_Subscriptions::add_notice(__('Once sign up is complete, this will replace your existing subscription.', 'woocommerce-subscriptions'), 'notice'); } elseif (is_product() && ($product = get_product($post))) { // Automatically initiate the switch process for limited variable subscriptions if (($product->is_type(array('variable-subscription', 'subscription_variation')) || 0 !== $product->post->post_parent) && WC_Subscriptions_Product::is_subscription($product->id) && 'yes' === $product->limit_subscriptions) { // Check if the user has an active subscription for this product, and if so, initiate the switch process $subscriptions = WC_Subscriptions_Manager::get_users_subscriptions(); foreach ($subscriptions as $subscription_key => $subscription) { if ($subscription['product_id'] == $product->id && 'active' == $subscription['status']) { wp_redirect(add_query_arg('auto-switch', 'true', self::get_switch_link($subscription_key))); exit; } } } } }
/** * Widget * Display the widget in the sidebar * Save output to the cache if empty * * @param array sidebar arguments * @param array instance */ public function widget($args, $instance) { // Hide widget if page is the cart or checkout if (is_cart() || is_checkout()) { return false; } extract($args); // Set the widget title $title = apply_filters('widget_title', $instance['title'] ? $instance['title'] : __('Cart', 'fflcommerce'), $instance, $this->id_base); // Print the widget wrapper & title echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } // Get the contents of the cart $cart_contents = fflcommerce_cart::$cart_contents; // If there are items in the cart print out a list of products if (!empty($cart_contents)) { // Open the list echo '<ul class="cart_list">'; foreach ($cart_contents as $key => $value) { // Get product instance $_product = $value['data']; if ($_product->exists() && $value['quantity'] > 0) { echo '<li>'; // Print the product image & title with a link to the permalink echo '<a href="' . esc_attr(get_permalink($_product->id)) . '" title="' . esc_attr($_product->get_title()) . '">'; // Print the product thumbnail image if exists else display placeholder echo has_post_thumbnail($_product->id) ? get_the_post_thumbnail($_product->id, 'shop_tiny') : fflcommerce_get_image_placeholder('shop_tiny'); // Print the product title echo '<span class="js_widget_product_title">' . $_product->get_title() . '</span>'; echo '</a>'; // Displays variations and cart item meta echo fflcommerce_cart::get_item_data($value); // Print the quantity & price per product echo '<span class="js_widget_product_price">' . $value['quantity'] . ' × ' . $_product->get_price_html() . '</span>'; echo '</li>'; } } echo '</ul>'; // Close the list // Print the cart total echo '<p class="total"><strong>'; echo __('Subtotal', 'fflcommerce'); echo ':</strong> ' . fflcommerce_price($this->total_cart_items()); echo '</p>'; do_action('fflcommerce_widget_cart_before_buttons'); // Print view cart & checkout buttons $view_cart_button_label = isset($instance['view_cart_button']) ? $instance['view_cart_button'] : __('View Cart →', 'fflcommerce'); $checkout_button_label = isset($instance['checkout_button']) ? $instance['checkout_button'] : __('Checkout →', 'fflcommerce'); echo '<p class="buttons">'; echo '<a href="' . esc_attr(fflcommerce_cart::get_cart_url()) . '" class="button">' . __($view_cart_button_label, 'fflcommerce') . '</a>'; echo '<a href="' . esc_attr(fflcommerce_cart::get_checkout_url()) . '" class="button checkout">' . __($checkout_button_label, 'fflcommerce') . '</a>'; echo '</p>'; } else { echo '<span class="empty">' . __('No products in the cart.', 'fflcommerce') . '</span>'; } // Print closing widget wrapper echo $after_widget; }
/** * Enqueue scripts * * @return void */ public function enqueue() { $path = defined('WP_DEBUG') && WP_DEBUG ? 'unminified/' : ''; $suffix = defined('WP_DEBUG') && WP_DEBUG ? '' : '.min'; if (is_checkout()) { wp_enqueue_script('yith-wcauthnet-form-handler', YITH_WCAUTHNET_URL . 'assets/js/' . $path . 'authorize-net' . $suffix . '.js', array('jquery'), false, true); } }
public function render() { if (is_checkout()) { echo $this->add_cart_conversion_prices(); } else { echo $this->add_conversion_prices(); } }
/** * Loading minicart option on wp_head section. * * @return void */ public function woo_floating_minicart() { if (!(is_cart() || is_checkout())) { echo "<div class='awfm-warp-content'>"; $this->awfm_woocommerce_mini_cart(); echo "</div>"; } }
function wpex_cart_widget_dropdown() { // If disabled bail if (!get_theme_mod('woo_menu_icon', true)) { return; } // Do nothing if it isn't the corrent style if ('drop-down' != get_theme_mod('woo_menu_icon_style', 'drop-down')) { return; } // Globals & vars global $woocommerce; $shop_page_url = get_permalink(woocommerce_get_page_id('shop')); $cart_contents_count = $woocommerce->cart->cart_contents_count; // Not needed on checkout if (is_checkout()) { return false; } // Not needed on cart page when items exist if (is_cart() && sizeof($cart_contents_count) !== 0) { return false; } ?> <div id="current-shop-items-dropdown" class="clr"> <div id="current-shop-items-inner" class="clr"> <?php // Display WooCommerce cart the_widget('WC_Widget_Cart', 'title= '); ?> </div><!-- #current-shop-items-inner --> </div><!-- #current-shop-items-dropdown --> <?php }
/** * Modify the subtotal of order-items (order-details.php) depending on the bundles's pricing strategy. * * @param string $subtotal the item subtotal * @param array $item the items * @param WC_Order $order the order * @return string modified subtotal string. */ function woo_bundles_order_item_subtotal($subtotal, $item, $order) { global $woocommerce_bundles; // If it's a bundled item if (isset($item['bundled_by'])) { // find bundle parent $parent_item = $this->get_bundled_order_item_container($item, $order); $per_product_pricing = !empty($parent_item) && isset($parent_item['per_product_pricing']) ? $parent_item['per_product_pricing'] : get_post_meta($parent_item['product_id'], '_per_product_pricing_active', true); if ($per_product_pricing == 'no' || isset($parent_item['composite_parent'])) { return ''; } else { /*------------------------------------------------------------------------------------------------------------------------------------------*/ /* woocommerce_order_formatted_line_subtotal is filtered by WC_Subscriptions_Order::get_formatted_line_total. /* The filter is temporarily unhooked internally, when the function calls get_formatted_line_subtotal to fetch the recurring price string. /* Here, we check whether it's unhooked to avoid displaying the "Subtotal" string next to the recurring part. /*------------------------------------------------------------------------------------------------------------------------------------------*/ if (function_exists('is_account_page') && is_account_page() || function_exists('is_checkout') && is_checkout()) { $wrap_start = ''; $wrap_end = ''; } else { $wrap_start = '<small>'; $wrap_end = '</small>'; } if ($woocommerce_bundles->compatibility->is_item_subscription($order, $item) && !has_filter('woocommerce_order_formatted_line_subtotal', 'WC_Subscriptions_Order::get_formatted_line_total')) { return $subtotal; } else { return $wrap_start . __('Subtotal', 'woocommerce-product-bundles') . ': ' . $subtotal . $wrap_end; } } } // If it's a bundle (parent item) if (!isset($item['bundled_by']) && isset($item['stamp'])) { if (isset($item['subtotal_updated'])) { return $subtotal; } $contains_recurring_fees = false; foreach ($order->get_items() as $order_item_id => $order_item) { if (isset($order_item['bundle_cart_key'])) { $is_child = isset($item['bundled_items']) && in_array($order_item['bundle_cart_key'], maybe_unserialize($item['bundled_items'])) ? true : false; } else { $is_child = isset($order_item['stamp']) && $order_item['stamp'] == $item['stamp'] && isset($order_item['bundled_by']) ? true : false; } if ($is_child) { if ($woocommerce_bundles->compatibility->is_item_subscription($order, $order_item)) { if ($order_item['subscription_recurring_amount'] > 0) { $contains_recurring_fees = true; } } $item['line_subtotal'] += $order_item['line_subtotal']; $item['line_subtotal_tax'] += $order_item['line_subtotal_tax']; } } $item['subtotal_updated'] = 'yes'; $subtotal = $order->get_formatted_line_subtotal($item); if ($item['per_product_pricing'] === 'yes' && $contains_recurring_fees) { $subtotal .= __(' up front with recurring fees <small>(see below)</small>', 'woocommerce-product-bundles'); } } return $subtotal; }