class-frontend.php
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* Dependency Checker
*
* Checks if required Dependency plugin is enabled
*
* @link https://wordpress.org/plugins/woocommerce-role-based-price/
* @package Role Based Price For WooCommerce
* @subpackage Role Based Price For WooCommerce/FrontEnd
* @since 3.0
*/
if( ! defined('WPINC') ) {
die;
}
class WooCommerce_Role_Based_Price_Functions {
/**
* Define the core functionality of the plugin.
*
* Set the plugin name and the plugin version that can be used throughout the plugin.
* Load the dependencies, define the locale, and set the hooks for the admin area and
* the public-facing side of the site.
*
* @since 1.0.0
*/
public function __construct() {
add_filter('woocommerce_product_object', array( $this, 'setup_product_prices' ));
}
public function setup_product_prices($product) {
if( $product == NULL ) {
return $product;
}
$product->wc_rbp = wc_rbp_get_product_price($product->ID);
$product->wc_rbp_status = wc_rbp_product_status($product->ID);
do_action_ref_array('wc_rbp_product_class_attribute', array( &$product ));
return $product;
}
}