Current Path : /storage/v11800/romasitenew/public_html/wp-content/plugins/webappick-product-feed-for-woocommerce/ctx-compatibility/ |
Linux v11800 5.3.0-1023-aws #25~18.04.1-Ubuntu SMP Fri Jun 5 15:19:18 UTC 2020 aarch64
|
Current File : /storage/v11800/romasitenew/public_html/wp-content/plugins/webappick-product-feed-for-woocommerce/ctx-compatibility/PricingDealsForWoocommerceVT.php |
<?php
namespace CTXFeed\Compatibility;
class PricingDealsForWoocommerceVT
{
public function vt_pricing_deals_discount_price( $price, $product ) {
if($product->get_type() == 'variation' ){
$price = $product->get_regular_price();
}
if ( class_exists( 'VTPRD_Controller' ) ) {
global $vtprd_rules_set;
$vtprd_rules_set = maybe_unserialize(get_option( 'vtprd_rules_set' ));
if ( ! empty( $vtprd_rules_set ) && is_array( $vtprd_rules_set ) ) {
foreach ( $vtprd_rules_set as $key =>$vtprd_rule_set ) {
$status = $vtprd_rule_set->rule_on_off_sw_select;
if ( 'on' === $status || 'onForever' === $status ) {
$discount_type = $vtprd_rule_set->rule_deal_info[0]['discount_amt_type'];
$discount = (float)$vtprd_rule_set->rule_deal_info[0]['discount_amt_count'];
if ( 'currency' === $discount_type || 'fixedPrice' === $discount_type ) {
$price = (float)$price - $discount;
} elseif ( 'percent' === $discount_type ) {
$price = (float)$price - ( ( (float)$price * $discount ) / 100 );
}
}
}
}
}
return $price;
}
}