PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.11.0
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.11.0
3.13.4 3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 All 262 releases
wpfunnels / public / modules / dynamic-offer-templates / oxygen / offer-button.php

offer-button.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.11.0, at public/modules/dynamic-offer-templates/oxygen/offer-button.php

90 lines 5.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 ?>