300, ) ); } add_action( 'after_setup_theme', 'blog_prime_woocommerce_setup' ); /** * Woocommerce Widget Area. */ function blog_prime_woocommerc_widgets_init() { register_sidebar( array( 'name' => esc_html__('WooCommerce Sidebar', 'blog-prime'), 'id' => 'blog-prime-woocommerce-widget', 'description' => esc_html__('Add widgets here.', 'blog-prime'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); } add_action('widgets_init', 'blog_prime_woocommerc_widgets_init'); /** * Woocommerce Enqueue Scripts. */ function blog_prime_woocommerce_scripts() { wp_enqueue_style( 'blog-prime-woocommerce-style', get_template_directory_uri() . '/assets/lib/twp/css/woocommerce.css' ); } add_action( 'wp_enqueue_scripts', 'blog_prime_woocommerce_scripts' ); if ( ! function_exists( 'blog_prime_woocommerce_cart_link_fragment' ) ) { /** * Cart Fragments. * * Ensure cart contents update when products are added to the cart via AJAX. * * @param array $fragments Fragments to refresh via AJAX. * @return array Fragments to refresh via AJAX. */ function blog_prime_woocommerce_cart_link_fragment( $fragments ) { ob_start(); blog_prime_woocommerce_cart_link(); $fragments['.cart-totle-item'] = ob_get_clean(); return $fragments; } } add_filter( 'woocommerce_add_to_cart_fragments', 'blog_prime_woocommerce_cart_link_fragment' ); if ( ! function_exists( 'blog_prime_woocommerce_cart_link' ) ) { /** * Cart Link. * * Displayed a link to the cart including the number of items present and the cart total. * * @return void */ function blog_prime_woocommerce_cart_link() { ?>
cart->get_cart_contents_count() <= 0 ){ ?>style="opacity: 0" class="cart-totle-item"> cart->get_cart_contents_count(), 'blog-prime' ), WC()->cart->get_cart_contents_count() ); ?> cart->get_cart_subtotal() ); ?> cart->get_cart_contents_count() ); ?>