PluginProbe
StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More / 2.2.0
StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More v2.2.0
2.3.0 2.2.0 2.1.1 2.1.0 2.0.0 1.10.0 1.9.1 1.9.0 1.2.1 1.2.2 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 All 59 releases
storeengine / includes / frontend / floating-cart.php

floating-cart.php in StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More 2.2.0, at includes/frontend/floating-cart.php

38 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace StoreEngine\Frontend;
4
5 use StoreEngine\Traits\Singleton;
6 use StoreEngine\Utils\Helper;
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit;
10 }
11
12 class FloatingCart {
13 use Singleton;
14
15 public function __construct() {
16 add_action( 'wp_footer', [ $this, 'display_cart_button' ] );
17 }
18
19 public function display_cart_button() {
20 if ( Helper::is_cart() || Helper::is_checkout() ) {
21 return;
22 }
23
24 $count = storeengine_cart()->get_count();
25 ?>
26 <button style="display: <?php echo esc_attr( 0 === $count ? 'none' : 'block' ); ?>" type="button" data-storeengine-mini-cart-open-drawer class="storeengine-floating-cart">
27 <div class="storeengine-floating-cart-button">
28 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 16 16">
29 <path d="M0 1.5A.5.5 0 0 1 .5 1H2a.5.5 0 0 1 .485.379L2.89 3H14.5a.5.5 0 0 1 .491.592l-1.5 8A.5.5 0 0 1 13 12H4a.5.5 0 0 1-.491-.408L2.01 3.607 1.61 2H.5a.5.5 0 0 1-.5-.5M3.102 4l1.313 7h8.17l1.313-7zM5 12a2 2 0 1 0 0 4 2 2 0 0 0 0-4m7 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4m-7 1a1 1 0 1 1 0 2 1 1 0 0 1 0-2m7 0a1 1 0 1 1 0 2 1 1 0 0 1 0-2"/>
30 </svg>
31 <span class="storeengine-floating-cart-count storeengine-cart-count"><?php echo esc_html( $count ); ?></span>
32 </div>
33 </button>
34 <div id="storeengine-mini-cart-drawer-root"></div>
35 <?php
36 }
37 }
38