Untitled

 avatar
unknown
plain_text
a year ago
38 kB
4
Indexable
<?php
defined('ABSPATH') || exit;

// -----------------------------
// ----- Pricing Shortcode -----
// -----------------------------
add_shortcode('productx_pricing', 'productx_pricing_shortcode_callback');
function productx_pricing_shortcode_callback( $atts = array(), $content = null ) {
	extract(shortcode_atts(array(
		'id' => '',
		'recurring' => '',
		'lifetime' => '',
		'bundle' => '',
		'bundle_variations' => ''
	), $atts));

	$recurring = explode(',', $recurring);
	$lifetime = explode(',', $lifetime);
	$bundle_variations = explode(',', $bundle_variations);
	$discount = get_option( '__couppon_discount' );
    ob_start();
  
    $download = edd_get_download($id);
    $prices = $download->get_prices();
    $biggest_discount = 0;
    ?>
    <div class="xpo-pricing">
        <div class="xpo-container">
            <div class="xpo-price-btn-container" data-discount="Save up to {{[[]]}}%">
                <!-- <span class="xpo-price-btnshape" id="xpo-button-shape"></span> -->
                <button type="radio" id="xpo-year-pack" checked="true" class="active">Yearly</button>
                <button type="radio" id="xpo-lifeTime-pack">Lifetime</button>
                <button type="radio" id="xpo-lifeTime-bundle">Agency Bundle</button>
            </div>
            <div id="xpo-year-container" class="xpo-pricing-items">
                <?php
                if (isset($recurring[0])) {
                    $final = str_replace('.00', '', $prices[$recurring[0]]['amount']);
                    $url = 'https://www.wpxpo.com/checkout?edd_action=add_to_cart&download_id='.$id.'&edd_options[price_id]='.$recurring[0];
                    // coupon
                    $coupon = $discount_ = $discount_type = $discount_amount = $pervious_price = '';
                    if (isset($discount[$id]['inner'][$recurring[0]]['coupon'])) {
                        $coupon = $discount[$id]['inner'][$recurring[0]]['coupon'];
                        $discount_ = edd_get_discount_by( 'code', $coupon );
                        $discount_type = edd_get_discount_type( $discount_->id );
                        $discount_amount = edd_get_discount_amount( $discount_->id );
                        $biggest_discount = $biggest_discount > $discount_amount ? $biggest_discount : $discount_amount;
                        $pervious_price = $final;
                        $final = $discount_type == 'percent' ? $pervious_price - (($discount_amount/100)*$final) : ($discount_type == 'flat' ? $pervious_price - $discount_amount : '' );
                        $url = $url . '&discount=' . $coupon;
                    }
                    ?>
                    <div class="xpo-pricing-item">
                        <?php if ($discount_amount) { ?>
                            <span class="xpo-slaes-offer"><?php echo $discount_amount; ?>% Off</span>
                        <?php } ?>
                        <div class="xpo-pricing-header">
                            <h3>1 Site License</h3>
                            <?php if ($pervious_price) { ?>
                                <del class="xpo-offer-price">$<?php echo $pervious_price; ?></del>
                            <?php } ?>
                            <span class="xpo-original-price">$<?php echo floor($final); ?></span>
                            <span class="xpo-pricing-year">/ Year</span>
                            <a class="xpo-btn xpo-btn-pricing xpo-btn-light" href="<?php echo $url; ?>">Buy Now</a>
                        </div>
                        <div class="xpo-pricing-content">
                            <ul>
                                <li><span>1 Domain</span> License</li>
                                <li><span>1 Year</span> of Support</li>
                                <li><span>1 Year</span> of Updates</li>
                                <li>All <span>Pro</span> Features</li>
                                <li>All <span>Upcoming</span> Features</li>
                                <li><span>Ready</span> Design Patterns</li>
                                <li><span>14 Days</span> Money Back Guarantee</li>
                                <li class="xpo-pricing-addons-access">
                                    <a href="https://www.wpxpo.com/productx/addons/"><span>12 Pro Add-ons ($300+ value!)</span></a>
                                    <div class="price-list"><span>WooCommerce Builder</span></div>
                                    <div class="price-list"><span>Stock Progress Bar</span></div>
                                    <div class="price-list"><span>Pre-order</span></div>
                                    <div class="price-list"><span>Call for Price</span></div>
                                    <div class="price-list"><span>Backorder</span></div>
                                    <div class="price-list"><span>Partial Payment</span></div>
                                    <div class="price-list"><span>+ 7 More!</span></div>
                                </li>
                            </ul>
                            <a href="#xpo-compare-table">See All Features</a>
                        </div>
                    </div>
                <?php } ?>
                <?php
                if (isset($recurring[1])) {
                    $final = str_replace('.00', '', $prices[$recurring[1]]['amount']);
                    $url = 'https://www.wpxpo.com/checkout?edd_action=add_to_cart&download_id='.$id.'&edd_options[price_id]='.$recurring[1];
                    // coupon
                    $coupon = $discount_ = $discount_type = $discount_amount = $pervious_price = '';
                    if (isset($discount[$id]['inner'][$recurring[1]]['coupon'])) {
                        $coupon = $discount[$id]['inner'][$recurring[1]]['coupon'];
                        $discount_ = edd_get_discount_by( 'code', $coupon );
                        $discount_type = edd_get_discount_type( $discount_->id );
                        $discount_amount = edd_get_discount_amount( $discount_->id );
                        $biggest_discount = $biggest_discount > $discount_amount ? $biggest_discount : $discount_amount;
                        $pervious_price = $final;
                        $final = $discount_type == 'percent' ? $pervious_price - (($discount_amount/100)*$final) : ($discount_type == 'flat' ? $pervious_price - $discount_amount : '' );
                        $url = $url . '&discount=' . $coupon;
                    }
                    ?>
                    <div class="xpo-pricing-item xpo-pricing-featured">
                        <div class="ribon-wrap"><span>Popular</span></div>
                        <?php if ($discount_amount) { ?>
                            <span class="xpo-slaes-offer xpo-slaes-offer-special"><?php echo $discount_amount; ?>% Off</span>
                            <div style="color: #022fff;font-size: 16px;font-weight: 900;margin-bottom: 12px;margin-top: -8px;text-align:center;">SAVE BIG <strong>($<?php echo round($pervious_price - $final); ?>)</strong></div>
                        <?php } ?>
                        <div class="xpo-pricing-header xpo-pricing-offer">
                            <h3>Unlimited Sites License</h3>
                            <?php if ($pervious_price) { ?>
                                <del class="xpo-offer-price">$<?php echo $pervious_price; ?></del>
                            <?php } ?>
                            <span class="xpo-original-price">$<?php echo floor($final); ?></span>
                            <span class="xpo-pricing-year">/ Year</span>
                            <a class="xpo-btn xpo-btn-primary xpo-btn-pricing" href="<?php echo $url; ?>">Buy Now</a>
                        </div>
                        <div class="xpo-pricing-content">
                            <ul>
                            <li><span>Unlimited</span> License</li>
                            <li><span>1 Year</span> Support</li>
                            <li><span>1 Year</span> Updates</li>
                            <li>All <span>Pro</span> Features</li>
                            <li>All <span>Upcoming</span> Features</li>
                            <li><span>Ready</span> Design Patterns</li>
                            <li><span>14 Days</span> Money Back Guarantee</li>
                            <li class="xpo-pricing-addons-access">
                                <a href="https://www.wpxpo.com/productx/addons/"><span>12 Pro Add-ons ($300+ value!)</span></a>
                                <div class="price-list"><span>WooCommerce Builder</span></div>
                                <div class="price-list"><span>Stock Progress Bar</span></div>
                                <div class="price-list"><span>Pre-order</span></div>
                                <div class="price-list"><span>Call for Price</span></div>
                                <div class="price-list"><span>Backorder</span></div>
                                <div class="price-list"><span>Partial Payment</span></div>
                                <div class="price-list"><span>+ 7 More!</span></div>
                            </li>
                            </ul>
                            <a href="#xpo-compare-table">See All Features</a>
                        </div>
                    </div>
                <?php } ?>
                <?php
                if (isset($recurring[2])) {
                    $final = str_replace('.00', '', $prices[$recurring[2]]['amount']);
                    $url = 'https://www.wpxpo.com/checkout?edd_action=add_to_cart&download_id='.$id.'&edd_options[price_id]='.$recurring[2];
                    // coupon
                    $coupon = $discount_ = $discount_type = $discount_amount = $pervious_price = '';
                    if (isset($discount[$id]['inner'][$recurring[2]]['coupon'])) {
                        $coupon = $discount[$id]['inner'][$recurring[2]]['coupon'];
                        $discount_ = edd_get_discount_by( 'code', $coupon );
                        $discount_type = edd_get_discount_type( $discount_->id );
                        $discount_amount = edd_get_discount_amount( $discount_->id );
                        $biggest_discount = $biggest_discount > $discount_amount ? $biggest_discount : $discount_amount;
                        $pervious_price = $final;
                        $final = $discount_type == 'percent' ? $pervious_price - (($discount_amount/100)*$final) : ($discount_type == 'flat' ? $pervious_price - $discount_amount : '' );
                        $url = $url . '&discount=' . $coupon;
                    }
                    ?>
                    <div class="xpo-pricing-item">
                        <?php if ($discount_amount) { ?>
                            <span class="xpo-slaes-offer"><?php echo $discount_amount; ?>% Off</span>
                        <?php } ?>
                        <div class="xpo-pricing-header">
                            <h3>5 Sites License</h3>
                            <?php if ($pervious_price) { ?>
                                <del class="xpo-offer-price">$<?php echo $pervious_price; ?></del>
                            <?php } ?>
                            <span class="xpo-original-price">$<?php echo floor($final); ?></span>
                            <span class="xpo-pricing-year">/ Year</span>
                            <a class="xpo-btn xpo-btn-pricing xpo-btn-light" href="<?php echo $url; ?>">Buy Now</a>
                        </div>
                        <div class="xpo-pricing-content">
                            <ul>
                            <li><span>5 Domain</span> License</li>
                            <li><span>1 Year</span> Support</li>
                            <li><span>1 Year</span> Updates</li>
                            <li>All <span>Pro</span> Features</li>
                            <li>All <span>Upcoming</span> Features</li>
                            <li><span>Ready</span> Design Patterns</li>
                            <li><span>14 Days</span> Money Back Guarantee</li>
                            <li class="xpo-pricing-addons-access">
                                <a href="https://www.wpxpo.com/productx/addons/"><span>12 Pro Add-ons ($300+ value!)</span></a>
                                <div class="price-list"><span>WooCommerce Builder</span></div>
                                <div class="price-list"><span>Stock Progress Bar</span></div>
                                <div class="price-list"><span>Pre-order</span></div>
                                <div class="price-list"><span>Call for Price</span></div>
                                <div class="price-list"><span>Backorder</span></div>
                                <div class="price-list"><span>Partial Payment</span></div>
                                <div class="price-list"><span>+ 7 More!</span></div>
                            </li>
                            </ul>
                            <a href="#xpo-compare-table">See All Features</a>
                        </div>
                    </div>
                <?php } ?>
            </div>

            <div id="xpo-lifeTime-container" class="xpo-pricing-items"  style="display: none">
                <?php
                if (isset($lifetime[0])) {
                    $final = str_replace('.00', '', $prices[$lifetime[0]]['amount']);
                    $url = 'https://www.wpxpo.com/checkout?edd_action=add_to_cart&download_id='.$id.'&edd_options[price_id]='.$lifetime[0];
                    // coupon
                    $coupon = $discount_ = $discount_type = $discount_amount = $pervious_price = '';
                    if (isset($discount[$id]['inner'][$lifetime[0]]['coupon'])) {
                        $coupon = $discount[$id]['inner'][$lifetime[0]]['coupon'];
                        $discount_ = edd_get_discount_by( 'code', $coupon );
                        $discount_type = edd_get_discount_type( $discount_->id );
                        $discount_amount = edd_get_discount_amount( $discount_->id );
                        $biggest_discount = $biggest_discount > $discount_amount ? $biggest_discount : $discount_amount;
                        $pervious_price = $final;
                        $final = $discount_type == 'percent' ? $pervious_price - (($discount_amount/100)*$final) : ($discount_type == 'flat' ? $pervious_price - $discount_amount : '' );
                        $url = $url . '&discount=' . $coupon;
                    }
                    ?>
                    <div class="xpo-pricing-item">
                        <?php if ($discount_amount) { ?>
                            <span class="xpo-slaes-offer"><?php echo $discount_amount; ?>% Off</span>
                        <?php } ?>
                        <div class="xpo-pricing-header">
                            <h3>1 Site License</h3>
                            <?php if ($pervious_price) { ?>
                                <del class="xpo-offer-price">$<?php echo $pervious_price; ?></del>
                            <?php } ?>
                            <span class="xpo-original-price">$<?php echo floor($final); ?></span>
                            <span>/ One Time</span>
                            <a class="xpo-btn xpo-btn-pricing xpo-btn-light" href="<?php echo $url; ?>">Buy Now</a>
                        </div>
                        <div class="xpo-pricing-content">
                            <ul>
                            <li><span>1 Domain</span> License</li>
                            <li><span>Lifetime</span> Support</li>
                            <li><span>Lifetime</span> Updates</li>
                            <li>All <span>Pro</span> Features</li>
                            <li>All <span>Upcoming</span> Features</li>
                            <li><span>Ready</span> Design Patterns</li>
                            <li><span>14 Days</span> Money Back Guarantee</li>
                            <li class="xpo-pricing-addons-access">
                                <a href="https://www.wpxpo.com/productx/addons/"><span>12 Pro Add-ons ($300+ value!)</span></a>
                                <div class="price-list"><span>WooCommerce Builder</span></div>
                                <div class="price-list"><span>Stock Progress Bar</span></div>
                                <div class="price-list"><span>Pre-order</span></div>
                                <div class="price-list"><span>Call for Price</span></div>
                                <div class="price-list"><span>Backorder</span></div>
                                <div class="price-list"><span>Partial Payment</span></div>
                                <div class="price-list"><span>+ 7 More!</span></div>
                            </li>
                            </ul>
                            <a href="#xpo-compare-table">See All Features</a>
                        </div>
                    </div>
                <?php } ?>
                <?php
                if (isset($lifetime[1])) {
                    $final = str_replace('.00', '', $prices[$lifetime[1]]['amount']);
                    $url = 'https://www.wpxpo.com/checkout?edd_action=add_to_cart&download_id='.$id.'&edd_options[price_id]='.$lifetime[1];
                    // coupon
                    $coupon = $discount_ = $discount_type = $discount_amount = $pervious_price = '';
                    if (isset($discount[$id]['inner'][$lifetime[1]]['coupon'])) {
                        $coupon = $discount[$id]['inner'][$lifetime[1]]['coupon'];
                        $discount_ = edd_get_discount_by( 'code', $coupon );
                        $discount_type = edd_get_discount_type( $discount_->id );
                        $discount_amount = edd_get_discount_amount( $discount_->id );
                        $biggest_discount = $biggest_discount > $discount_amount ? $biggest_discount : $discount_amount;
                        $pervious_price = $final;
                        $final = $discount_type == 'percent' ? $pervious_price - (($discount_amount/100)*$final) : ($discount_type == 'flat' ? $pervious_price - $discount_amount : '' );
                        $url = $url . '&discount=' . $coupon;
                    }
                    ?>
                    <div class="xpo-pricing-item xpo-pricing-featured">
                    <div class="ribon-wrap"><span>Popular</span></div>
                        <?php if ($discount_amount) { ?>
                            <span class="xpo-slaes-offer xpo-slaes-offer-special"><?php echo $discount_amount; ?>% Off</span>
                            <div style="color: #022fff;font-size: 16px;font-weight: 900;margin-bottom: 12px;margin-top: -8px; text-align:center;">SAVE BIG <strong>($<?php echo round($pervious_price - $final); ?>)</strong></div>
                        <?php } ?>
                        <div class="xpo-pricing-header xpo-pricing-offer">
                            <h3>Unlimited Sites License</h3>
                            <?php if ($pervious_price) { ?>
                                <del class="xpo-offer-price">$<?php echo $pervious_price; ?></del>
                            <?php } ?>
                            <span class="xpo-original-price">$<?php echo floor($final); ?></span>
                            <span>/ One Time</span>
                            <a class="xpo-btn xpo-btn-primary xpo-btn-pricing" href="<?php echo $url; ?>">Buy Now</a>
                        </div>
                        <div class="xpo-pricing-content">
                            <ul>
                            <li><span>Unlimited Domain</span> License</li>
                            <li><span>Lifetime</span> Support</li>
                            <li><span>Lifetime</span> Updates</li>
                            <li>All <span>Pro</span> Features</li>
                            <li>All <span>Upcoming</span> Features</li>
                            <li><span>Ready</span> Design Patterns</li>
                            <li><span>14 Days</span> Money Back Guarantee</li>
                            <li class="xpo-pricing-addons-access">
                                <a href="https://www.wpxpo.com/productx/addons/"><span>12 Pro Add-ons ($300+ value!)</span></a>
                                <div class="price-list"><span>WooCommerce Builder</span></div>
                                <div class="price-list"><span>Stock Progress Bar</span></div>
                                <div class="price-list"><span>Pre-order</span></div>
                                <div class="price-list"><span>Call for Price</span></div>
                                <div class="price-list"><span>Backorder</span></div>
                                <div class="price-list"><span>Partial Payment</span></div>
                                <div class="price-list"><span>+ 7 More!</span></div>
                            </li>
                            </ul>
                            <a href="#xpo-compare-table">See All Features</a>
                        </div>
                    </div>
                <?php } ?>
                <?php
                if (isset($lifetime[2])) {
                    $final = str_replace('.00', '', $prices[$lifetime[2]]['amount']);
                    $url = 'https://www.wpxpo.com/checkout?edd_action=add_to_cart&download_id='.$id.'&edd_options[price_id]='.$lifetime[2];
                    // coupon
                    $coupon = $discount_ = $discount_type = $discount_amount = $pervious_price = '';
                    if (isset($discount[$id]['inner'][$lifetime[2]]['coupon'])) {
                        $coupon = $discount[$id]['inner'][$lifetime[2]]['coupon'];
                        $discount_ = edd_get_discount_by( 'code', $coupon );
                        $discount_type = edd_get_discount_type( $discount_->id );
                        $discount_amount = edd_get_discount_amount( $discount_->id );
                        $biggest_discount = $biggest_discount > $discount_amount ? $biggest_discount : $discount_amount;
                        $pervious_price = $final;
                        $final = $discount_type == 'percent' ? $pervious_price - (($discount_amount/100)*$final) : ($discount_type == 'flat' ? $pervious_price - $discount_amount : '' );
                        $url = $url . '&discount=' . $coupon;
                    }
                    ?>
                    <div class="xpo-pricing-item">
                        <?php if ($discount_amount) { ?>
                            <span class="xpo-slaes-offer"><?php echo $discount_amount; ?>% Off</span>
                        <?php } ?>
                        <div class="xpo-pricing-header">
                            <h3>5 Sites License</h3>
                            <?php if ($pervious_price) { ?>
                                <del class="xpo-offer-price">$<?php echo $pervious_price; ?></del>
                            <?php } ?>
                            <span class="xpo-original-price">$<?php echo floor($final); ?></span>
                            <span>/ One Time</span>
                            <a class="xpo-btn xpo-btn-pricing xpo-btn-light" href="<?php echo $url; ?>">Buy Now</a>
                        </div>
                        <div class="xpo-pricing-content">
                            <ul>
                            <li><span>5 Domain</span> License</li>
                            <li><span>Lifetime</span> Support</li>
                            <li><span>Lifetime</span> Updates</li>
                            <li>All <span>Pro</span> Features</li>
                            <li>All <span>Upcoming</span> Features</li>
                            <li><span>Ready</span> Design Patterns</li>
                            <li><span>14 Days</span> Money Back Guarantee</li>
                            <li class="xpo-pricing-addons-access">
                                <a href="https://www.wpxpo.com/productx/addons/"><span>12 Pro Add-ons ($300+ value!)</span></a>
                                <div class="price-list"><span>WooCommerce Builder</span></div>
                                <div class="price-list"><span>Stock Progress Bar</span></div>
                                <div class="price-list"><span>Pre-order</span></div>
                                <div class="price-list"><span>Call for Price</span></div>
                                <div class="price-list"><span>Backorder</span></div>
                                <div class="price-list"><span>Partial Payment</span></div>
                                <div class="price-list"><span>+ 7 More!</span></div>
                            </li>
                            </ul>
                            <a href="#xpo-compare-table">See All Features</a>
                        </div>
                    </div>
                <?php } ?>
            </div>

            <?php if ($bundle) { ?>
                <div id="xpo-bundle-container" class="xpo-pricing-items" style="display: none">
                    <?php
                    $download = edd_get_download($bundle);
                    $prices = $download->get_prices();
                    if (isset($bundle_variations[0])) {
                        $final = str_replace('.00', '', $prices[$bundle_variations[0]]['amount']);
                        $url = 'https://www.wpxpo.com/checkout?edd_action=add_to_cart&download_id='.$bundle.'&edd_options[price_id]='.$bundle_variations[0];
                        // coupon
                        $coupon = $discount_ = $discount_type = $discount_amount = $pervious_price = '';
                        if (isset($discount[$bundle]['inner'][$bundle_variations[0]]['coupon'])) {
                            $coupon = $discount[$bundle]['inner'][$bundle_variations[0]]['coupon'];
                            $discount_ = edd_get_discount_by( 'code', $coupon );
                            $discount_type = edd_get_discount_type( $discount_->id );
                            $discount_amount = edd_get_discount_amount( $discount_->id );
							$biggest_discount = $biggest_discount > $discount_amount ? $biggest_discount : $discount_amount;
                            $pervious_price = $final;
                            $final = $discount_type == 'percent' ? $pervious_price - (($discount_amount/100)*$final) : ($discount_type == 'flat' ? $pervious_price - $discount_amount : '' );
                            $url = $url . '&discount=' . $coupon;
                        }
                        ?>
                        <div class="xpo-pricing-item">
                            <?php if ($discount_amount) { ?>
                                <span class="xpo-slaes-offer"><?php echo $discount_amount; ?>% Off</span>
                                <div style="color: #022fff;font-size: 16px;font-weight: 900;margin-bottom: 12px;margin-top: -8px; text-align:center;">SAVE BIG <strong>($<?php echo round($pervious_price - $final); ?>)</strong></div>
                            <?php } ?>
                            <div class="xpo-pricing-header xpo-pricing-offer">
                                <div class="button_group d-flex justify-center">
                                    <img decoding="async" src="https://www.wpxpo.com/wp-content/uploads/2021/01/postx-logo.svg" alt="PostX logo" srcset="" title="PostX">
                                    <img decoding="async" src="https://www.wpxpo.com/wp-content/uploads/2021/01/productx-logo.svg" alt="ProductX logo" srcset="" title="ProductX">
                                </div>
                                <h3><span>2 in 1 Pack</span> <span style="color: #ff6844">(Life Time)</span></h3>
                                <?php if ($pervious_price) { ?>
                                    <del class="xpo-offer-price">$<?php echo $pervious_price; ?></del>
                                <?php } ?>
                                <span class="xpo-original-price">$<?php echo floor($final); ?></span>
                                <span>/ One Time</span>
                                <a class="xpo-btn xpo-btn-pricing xpo-btn-light" href="<?php echo $url; ?>">Buy Now</a>
                            </div>
                            <div class="xpo-pricing-content">
                                <ul>
                                    <li><strong>$1048</strong> Original Value</li>
                                    <li class="postx-deal-price">PostX</li>
                                    <li class="productx-deal-price">ProductX</li>
                                    <li>Unlimited Domain License</li>
                                    <li>Lifetime Updates</li>
                                    <li>Lifetime Support</li>
                                    <li>All Upcoming Features</li>
                                    <li>14 Days Money Back Guarantee</li>
                                </ul>
                            </div>
                        </div>
                    <?php } ?>
                    <?php
                    if (isset($bundle_variations[1])) {
                        $final = str_replace('.00', '', $prices[$bundle_variations[1]]['amount']);
                        $url = 'https://www.wpxpo.com/checkout?edd_action=add_to_cart&download_id='.$bundle.'&edd_options[price_id]='.$bundle_variations[1];
                        // coupon
                        $coupon = $discount_ = $discount_type = $discount_amount = $pervious_price = '';
                        if (isset($discount[$bundle]['inner'][$bundle_variations[1]]['coupon'])) {
                            $coupon = $discount[$bundle]['inner'][$bundle_variations[1]]['coupon'];
                            $discount_ = edd_get_discount_by( 'code', $coupon );
                            $discount_type = edd_get_discount_type( $discount_->id );
                            $discount_amount = edd_get_discount_amount( $discount_->id );
							$biggest_discount = $biggest_discount > $discount_amount ? $biggest_discount : $discount_amount;
                            $pervious_price = $final;
                            $final = $discount_type == 'percent' ? $pervious_price - (($discount_amount/100)*$final) : ($discount_type == 'flat' ? $pervious_price - $discount_amount : '' );
                            $url = $url . '&discount=' . $coupon;
                        }
                        ?>
                        <div class="xpo-pricing-item xpo-pricing-featured">
                        <div class="ribon-wrap"><span>Popular</span></div>
                            <?php if ($discount_amount) { ?>
                                <span class="xpo-slaes-offer xpo-slaes-offer-special"><?php echo $discount_amount; ?>% Off</span>
                                <div style="color: #022fff;font-size: 16px;font-weight: 900;margin-bottom: 12px;margin-top: -8px; text-align:center;">SAVE BIG <strong>($<?php echo round($pervious_price - $final); ?>)</strong></div>
                            <?php } ?>
                            <div class="xpo-pricing-header xpo-pricing-offer">
                                <div class="button_group d-flex justify-center">
                                    <img decoding="async" src="https://www.wpxpo.com/wp-content/uploads/2021/01/postx-logo.svg" alt="PostX logo" srcset="" title="PostX">
                                    <img decoding="async" src="https://www.wpxpo.com/wp-content/uploads/2021/01/productx-logo.svg" alt="ProductX logo" srcset="" title="ProductX">
                                    <img decoding="async" src="https://getwholesalex.com/wp-content/themes/wholesalexsite/img/logo.svg" alt="WholesaleX logo" srcset="" title="WholesaleX">
                                </div>
                                <h3><span>3 in 1 Pack</span> <span style="color: #3cce12">(Life Time)</span></h3>
                                <?php if ($pervious_price) { ?>
                                    <del class="xpo-offer-price">$<?php echo $pervious_price; ?></del>
                                <?php } ?>
                                <span class="xpo-original-price">$<?php echo floor($final); ?></span>
                                <span>/ One Time</span>
                                <a class="xpo-btn xpo-btn-pricing xpo-btn-primary" href="<?php echo $url; ?>">Buy Now</a>
                            </div>
                            <div class="xpo-pricing-content">
                                <ul>
                                    <li><strong>$1747</strong> Original Value</li>
                                    <li class="postx-deal-price">PostX</li>
                                    <li class="productx-deal-price">ProductX</li>
                                    <li class="wholesalex-deal-price">WholesaleX</li>
                                    <li>Unlimited Domain License</li>
                                    <li>Lifetime Updates</li>
                                    <li>Lifetime Support</li>
                                    <li>All Upcoming Features</li>
                                    <li>14 Days Money Back Guarantee</li>
                                </ul>
                            </div>
                        </div>
                    <?php } ?>

                    <?php
                    if (isset($bundle_variations[2])) {
                        $final = str_replace('.00', '', $prices[$bundle_variations[2]]['amount']);
                        $url = 'https://www.wpxpo.com/checkout?edd_action=add_to_cart&download_id='.$bundle.'&edd_options[price_id]='.$bundle_variations[2];
                        // coupon
                        $coupon = $discount_ = $discount_type = $discount_amount = $pervious_price = '';
                        if (isset($discount[$bundle]['inner'][$bundle_variations[2]]['coupon'])) {
                            $coupon = $discount[$bundle]['inner'][$bundle_variations[2]]['coupon'];
                            $discount_ = edd_get_discount_by( 'code', $coupon );
                            $discount_type = edd_get_discount_type( $discount_->id );
                            $discount_amount = edd_get_discount_amount( $discount_->id );
							$biggest_discount = $biggest_discount > $discount_amount ? $biggest_discount : $discount_amount;
                            $pervious_price = $final;
                            $final = $discount_type == 'percent' ? $pervious_price - (($discount_amount/100)*$final) : ($discount_type == 'flat' ? $pervious_price - $discount_amount : '' );
                            $url = $url . '&discount=' . $coupon;
                        }
                        ?>
                        <div class="xpo-pricing-item">
                            <?php if ($discount_amount) { ?>
                                <span class="xpo-slaes-offer xpo-slaes-offer-special"><?php echo $discount_amount; ?>% Off</span>
                                <div style="color: #022fff;font-size: 16px;font-weight: 900;margin-bottom: 12px;margin-top: -8px; text-align:center;">SAVE BIG <strong>($<?php echo round($pervious_price - $final); ?>)</strong></div>
                            <?php } ?>
                            <div class="xpo-pricing-header xpo-pricing-offer">
                                <div class="button_group d-flex justify-center">
                                    <img decoding="async" src="https://www.wpxpo.com/wp-content/uploads/2021/01/productx-logo.svg" alt="ProductX logo" srcset="" title="ProductX">
                                    <img decoding="async" src="https://getwholesalex.com/wp-content/themes/wholesalexsite/img/logo.svg" alt="WholesaleX logo" srcset="" title="WholesaleX">
                                </div>
                                <h3><span>2 in 1 Pack</span> <span style="color: #ff6844">(Life Time)</span></h3>
                                <?php if ($pervious_price) { ?>
                                    <del class="xpo-offer-price">$<?php echo $pervious_price; ?></del>
                                <?php } ?>
                                <span class="xpo-original-price">$<?php echo floor($final); ?></span>
                                <span>/ One Time</span>
                                <a class="xpo-btn xpo-btn-pricing xpo-btn-light" href="<?php echo $url; ?>">Buy Now</a>
                            </div>
                            <div class="xpo-pricing-content">
                                <ul>
                                    <li><strong>$1248</strong> Original Value</li>
                                    <li class="productx-deal-price">ProductX</li>
                                    <li class="postx-deal-price">WholesaleX</li>
                                    <li>Unlimited Domain License</li>
                                    <li>Lifetime Updates</li>
                                    <li>Lifetime Support</li>
                                    <li>All Upcoming Features</li>
                                    <li>14 Days Money Back Guarantee</li>
                                </ul>
                            </div>
                        </div>
                    <?php } ?>


                </div>
            <?php } ?>
        </div>
    </div>
    <?php
    $html = ob_get_clean();

    return str_replace('{{[[]]}}', round($biggest_discount), $html);
}
Leave a Comment