PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.11.1
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.11.1
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 / bricks / offer-button.php

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

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