PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 2.3.6
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v2.3.6
2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 1.8.1 All 42 releases
sellkit / includes / admin / funnel / class.php

class.php in SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster 2.3.6, at includes/admin/funnel/class.php

67 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Sellkit\Admin\Funnel;
4
5 defined( 'ABSPATH' ) || die();
6
7 /**
8 * Class Funnel.
9 *
10 * @since 1.1.0
11 */
12 class Funnel {
13
14 const SELLKIT_FUNNELS_TEMPLATE_SOURCE = 'https://templates.getsellkit.com';
15
16 /**
17 * Funnel_Importer constructor.
18 *
19 * @since 1.1.0
20 */
21 public function __construct() {
22 if ( class_exists( 'Elementor\Plugin' ) ) {
23 sellkit()->load_files( [
24 'admin/funnel/importer/page-builders/elementor-importer',
25 ] );
26 }
27
28 sellkit()->load_files(
29 [
30 'admin/funnel/importer/page-builders/importer-base',
31 'admin/funnel/importer/step-importer',
32 'admin/funnel/importer/ajax-handler',
33 ]
34 );
35
36 add_action( 'wp_ajax_sellkit_steps_bump_get_product_data', [ $this, 'get_product_data' ] );
37 }
38
39 /**
40 * Gets products data.
41 *
42 * @since 1.1.0
43 */
44 public function get_product_data() {
45 check_ajax_referer( 'sellkit', 'nonce' );
46
47 $product_id = filter_input( INPUT_GET, 'product_id', FILTER_SANITIZE_NUMBER_INT );
48
49 if ( ! sellkit()->has_valid_dependencies() ) {
50 wp_send_json_error( __( 'Please install and activate WooCommerce.', 'sellkit' ) );
51 }
52
53 $product = wc_get_product( $product_id );
54
55 if ( empty( $product ) ) {
56 wp_send_json_error( __( 'Product does not exist', 'sellkit' ) );
57 }
58
59 wp_send_json_success( [
60 'thumbnail' => get_the_post_thumbnail_url( $product_id ),
61 'regularPrice' => $product->get_regular_price(),
62 ] );
63 }
64 }
65
66 new Funnel();
67