PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.12.13
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.12.13
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 2.8.16 All 261 releases
wpfunnels / public / modules / dynamic-offer-templates / shortcode / offer-button.php

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

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