| 1 |
<div class="oxy-offer-button-<?php echo isset($options['button_alignment']) ? $options['button_alignment'] : ''; ?>"> |
| 2 |
<div class="wpfnl-offerbtn-wrapper" id="wpfnl-offerbtn-wrapper" > |
| 3 |
<?php |
| 4 |
|
| 5 |
if( ('variable' === $get_product_type || 'variable-subscription' === $get_product_type) && 'accept' === $button_action ) { |
| 6 |
|
| 7 |
if( !empty( $variation_tbl_title ) ){ |
| 8 |
echo '<h5 class="wpfnl-product-variation-title">'.$variation_tbl_title.'</h5>'; |
| 9 |
} |
| 10 |
|
| 11 |
echo '<div class="has-variation-product">'; |
| 12 |
echo '<div class="wpfnl-product-variation">'; |
| 13 |
if( 'yes' === $show_product_price ){ |
| 14 |
echo '<span class="offer-btn-loader"></span>'; |
| 15 |
} |
| 16 |
echo do_shortcode( '[wpf_variable_offer post_id="'.$step_id.'"]' ); |
| 17 |
echo '</div>'; |
| 18 |
|
| 19 |
} |
| 20 |
?> |
| 21 |
|
| 22 |
<div class="wpfnl-offerbtn-and-price-wrapper <?php echo 'yes' === $options['show_product_price'] ? $options['product_price_alignment'] : '' ?>"> |
| 23 |
<?php if( 'yes' === $show_product_price ){ ?> |
| 24 |
<span class="wpfnl-offer-product-price" id="wpfnl-offer-product-price"> |
| 25 |
<?php |
| 26 |
if( ('variable' !== $get_product_type && 'variable-subscription' !== $get_product_type) && 'accept' === $button_action ){ |
| 27 |
if( $offer_product ){ |
| 28 |
$step_type = get_post_meta( get_the_ID(), '_step_type', true ); |
| 29 |
$discount = get_post_meta( get_the_ID(), '_wpfnl_'.$step_type.'_discount', true ); |
| 30 |
$total_price = isset($response['quantity']) ? $offer_product->get_regular_price() * $response['quantity'] : $offer_product->get_regular_price(); |
| 31 |
if( isset($discount['discountApplyTo'], $discount['discountType']) && 'original' !== $discount['discountType'] ){ |
| 32 |
if( 'sale' === $discount['discountApplyTo'] ){ |
| 33 |
$sale_price = $offer_product->get_sale_price() ? $offer_product->get_sale_price() : $offer_product->get_regular_price(); |
| 34 |
}elseif( 'regular' === $discount['discountApplyTo'] ){ |
| 35 |
$sale_price = $offer_product->get_regular_price() ? $offer_product->get_regular_price() : $offer_product->get_price(); |
| 36 |
}else{ |
| 37 |
$sale_price = $offer_product->get_price(); |
| 38 |
} |
| 39 |
$product_price = \WPFunnelsPro\Wpfnl_Pro_functions::calculate_discount_price_for_widget( $discount['discountType'] , $discount['discountValue'], $sale_price ); |
| 40 |
if( $product_price != $total_price ){ |
| 41 |
echo wc_price(number_format( (float) $product_price, 2, '.', '' )).'<del>'.wc_price(number_format( (float) $total_price, 2, '.', '' )).'</del>'; |
| 42 |
}else{ |
| 43 |
echo wc_price(number_format( (float) $product_price, 2, '.', '' )); |
| 44 |
} |
| 45 |
}else{ |
| 46 |
if( $offer_product->get_sale_price() ){ |
| 47 |
$sale_price = $offer_product->get_sale_price(); |
| 48 |
$sale_price = isset($response['quantity']) ? $sale_price * $response['quantity'] : $sale_price; |
| 49 |
echo wc_price(number_format( (float) $sale_price, 2, '.', '' )).'<del>'.wc_price(number_format( (float) $total_price, 2, '.', '' )).'</del>'; |
| 50 |
}else{ |
| 51 |
echo wc_price(number_format( (float) $total_price, 2, '.', '' )); |
| 52 |
} |
| 53 |
} |
| 54 |
} |
| 55 |
} |
| 56 |
?> |
| 57 |
</span> |
| 58 |
<?php } ?> |
| 59 |
|
| 60 |
<a class="btn-default wpfnl-oxy-offer-btn offer-button wpfunnels_offer_button" data-offertype="<?php echo $button_type ?>" id="<?php echo $button_id ?>"> <?php echo $options['title_text'] ?> </a> |
| 61 |
</div> |
| 62 |
|
| 63 |
<?php |
| 64 |
if( ('variable' === $get_product_type || 'variable-subscription' === $get_product_type) && 'accept' === $button_action ) { |
| 65 |
echo '</div>'; |
| 66 |
//end ".has-variation-product" |
| 67 |
} |
| 68 |
?> |
| 69 |
|
| 70 |
</div> |
| 71 |
</div> |
| 72 |
|
| 73 |
|
| 74 |
<?php |
| 75 |
if ( did_action( 'wpfunnels/after_offer_button' ) ) { |
| 76 |
return; |
| 77 |
} |
| 78 |
if( 'accept' === $button_action && \WPFunnels\Wpfnl_functions::maybe_unsupported_payment_gateway() ){ |
| 79 |
/** |
| 80 |
* Fires after the offer button is displayed. |
| 81 |
* |
| 82 |
* This action hook allows developers to add custom functionality after the offer button is rendered on the page. |
| 83 |
* |
| 84 |
* @since 2.0.5 |
| 85 |
* |
| 86 |
* @param void |
| 87 |
*/ |
| 88 |
do_action( 'wpfunnels/after_offer_button' ); |
| 89 |
} |
| 90 |
?> |