PluginProbe ʕ •ᴥ•ʔ
PiWeb Product Enquiry or product catalog for WooCommerce / 2.2.33.21
PiWeb Product Enquiry or product catalog for WooCommerce v2.2.33.21
2.2.34.43 2.2.34.42 2.2.34.41 2.2.34.40 2.2.34.39 trunk 2.2.22 2.2.26 2.2.33.16 2.2.33.17 2.2.33.19 2.2.33.20 2.2.33.21 2.2.33.22 2.2.33.23 2.2.33.24 2.2.33.26 2.2.33.27 2.2.33.29 2.2.33.30 2.2.33.31 2.2.33.32 2.2.33.33 2.2.33.34 2.2.33.36 2.2.33.37 2.2.33.39 2.2.33.40 2.2.33.41 2.2.33.42 2.2.33.43 2.2.33.44 2.2.33.46 2.2.33.47 2.2.33.49 2.2.34.0 2.2.34.1 2.2.34.10 2.2.34.11 2.2.34.12 2.2.34.13 2.2.34.14 2.2.34.16 2.2.34.17 2.2.34.19 2.2.34.2 2.2.34.20 2.2.34.21 2.2.34.22 2.2.34.23 2.2.34.24 2.2.34.26 2.2.34.27 2.2.34.29 2.2.34.3 2.2.34.30 2.2.34.31 2.2.34.32 2.2.34.33 2.2.34.34 2.2.34.36 2.2.34.37 2.2.34.4 2.2.34.6 2.2.34.7 2.2.34.9
enquiry-quotation-for-woocommerce / public / class-eqw-advance.php
enquiry-quotation-for-woocommerce / public Last commit date
css 2 years ago img 2 years ago js 2 years ago partials 2 years ago class-email.php 2 years ago class-eqw-advance.php 2 years ago class-eqw-enquiry-cart.php 2 years ago class-eqw-enquiry-shortcode.php 2 years ago class-eqw-product.php 2 years ago class-eqw-save-enquiry.php 2 years ago class-pisol-enquiry-quotation-woocommerce-public.php 2 years ago class-pisol-form.php 2 years ago class-webhook.php 2 years ago index.php 2 years ago
class-eqw-advance.php
119 lines
1 <?php
2
3 class class_eqw_advance{
4
5 public $hide_price;
6
7 function __construct(){
8
9 $this->hide_price = get_option('pi_eqw_hide_price','no'); // all -> hide for all, no->done hide, guest -> hide for guest visitors
10
11 add_filter( 'woocommerce_is_purchasable', array($this,'remove_add_to_cart'), 10, 2);
12
13 if( $this->hide_price != 'no'){
14
15 /**
16 * this can remove price from loop and single product page
17 */
18 add_filter( 'woocommerce_variable_sale_price_html', array($this,'removePrice'), 10, 2 );
19 add_filter( 'woocommerce_variable_price_html', array($this,'removePrice'), 10, 2 );
20 add_filter( 'woocommerce_get_price_html', array($this,'removePrice'), 10, 2 );
21
22 }
23
24 add_action( 'template_redirect', array($this,'redirectToEnquiryCart') );
25
26 }
27
28 function remove_add_to_cart($purchasable, $product ){
29 $pi_eqw_remove_add_to_cart = 0;
30 if($pi_eqw_remove_add_to_cart == 1 /*|| $this->hidePrice()*/){
31 remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
32
33 wp_register_style( 'pisol-dummy-handle', false );
34 wp_enqueue_style( 'pisol-dummy-handle' );
35
36 wp_add_inline_style( 'pisol-dummy-handle', '.single_variation_wrap, .woocommerce-variation-add-to-cart.variations_button{
37 display:none;
38 }' );
39
40 return false;
41 }
42 return $purchasable;
43 }
44
45 function removePrice( $price, $product ) {
46 if ( $this->hidePrice() ) $price = '';
47 return $price;
48 }
49
50 function hidePrice(){
51 switch($this->hide_price){
52 case 'no':
53 return false;
54 break;
55
56 case 'all':
57 return true;
58 break;
59
60 case 'guest':
61 if(is_user_logged_in()){
62 return false;
63 }else{
64 return true;
65 }
66 break;
67 }
68
69 return false;
70 }
71
72 static function checkHidePrice(){
73 $hide_price = get_option('pi_eqw_hide_price','no');
74 switch($hide_price){
75 case 'no':
76 return false;
77 break;
78
79 case 'all':
80 return true;
81 break;
82
83 case 'guest':
84 if(is_user_logged_in()){
85 return false;
86 }else{
87 return true;
88 }
89 break;
90 }
91
92 return false;
93 }
94
95 function redirectToEnquiryCart() {
96 $pi_eqw_redirect_to_enquiry_cart = get_option('pi_eqw_redirect_to_enquiry_cart',0);
97
98 if($pi_eqw_redirect_to_enquiry_cart == 1){
99 if ( is_cart() || is_checkout() ){
100
101 global $woocommerce;
102 // Redirect to check out url
103 $enquiry_cart = get_option('pi_eqw_enquiry_cart',"");
104 if($enquiry_cart != ""){
105 $url = get_permalink($enquiry_cart);
106 wp_redirect( $url, '301' );
107 exit;
108 }
109
110 }
111 }
112
113 }
114
115 }
116
117 new class_eqw_advance();
118
119