PluginProbe
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce / 1.1.12
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce v1.1.12
3.3.0 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.1 trunk 1.0.4 1.1.0 1.1.0.1 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 All 162 releases
cartflows / modules / checkout / classes / class-cartflows-checkout-meta.php

class-cartflows-checkout-meta.php in CartFlows – Funnel Builder & Checkout Plugin for WooCommerce 1.1.12, at modules/checkout/classes/class-cartflows-checkout-meta.php

766 lines 20.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Checkout post meta
4 *
5 * @package CartFlows
6 */
7
8 /**
9 * Meta Boxes setup
10 */
11 class Cartflows_Checkout_Meta extends Cartflows_Meta {
12
13 /**
14 * Instance
15 *
16 * @var $instance
17 */
18 private static $instance;
19
20 /**
21 * Meta Option
22 *
23 * @var $meta_option
24 */
25 private static $meta_option = null;
26
27 /**
28 * Initiator
29 */
30 public static function get_instance() {
31 if ( ! isset( self::$instance ) ) {
32 self::$instance = new self;
33 }
34
35 return self::$instance;
36 }
37
38 /**
39 * Constructor
40 */
41 public function __construct() {
42
43 /* Init Metabox */
44 add_action( 'load-post.php', array( $this, 'init_metabox' ) );
45 add_action( 'load-post-new.php', array( $this, 'init_metabox' ) );
46 }
47
48 /**
49 * Init Metabox
50 */
51 public function init_metabox() {
52
53 add_action( 'add_meta_boxes', array( $this, 'setup_meta_box' ) );
54 add_action( 'save_post', array( $this, 'save_meta_box' ) );
55 }
56
57 /**
58 * Setup Metabox
59 */
60 function setup_meta_box() {
61
62 // Get all posts.
63 $post_types = get_post_types();
64
65 if ( _is_wcf_checkout_type() ) {
66 add_meta_box(
67 'wcf-checkout-settings', // Id.
68 __( 'Checkout Layout', 'cartflows' ), // Title.
69 array( $this, 'markup_meta_box' ), // Callback.
70 wcf()->utils->get_step_post_type(), // Post_type.
71 'normal', // Context.
72 'high' // Priority.
73 );
74 }
75 }
76
77 /**
78 * Metabox Markup
79 *
80 * @param object $post Post object.
81 * @return void
82 */
83 function markup_meta_box( $post ) {
84
85 wp_nonce_field( 'save-nonce-checkout-step-meta', 'nonce-checkout-step-meta' );
86
87 $stored = get_post_meta( $post->ID );
88
89 $checkout_meta = self::get_meta_option( $post->ID );
90
91 // Set stored and override defaults.
92 foreach ( $stored as $key => $value ) {
93 if ( array_key_exists( $key, $checkout_meta ) ) {
94 self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? maybe_unserialize( $stored[ $key ][0] ) : '';
95 } else {
96 self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? $stored[ $key ][0] : '';
97 }
98 }
99
100 // Get defaults.
101 $meta = self::get_meta_option( $post->ID );
102 $checkout_data = array();
103
104 foreach ( $meta as $key => $value ) {
105
106 $checkout_data[ $key ] = $meta[ $key ]['default'];
107 }
108
109 /*
110 $billing_fields = Cartflows_Helper::get_checkout_fields( 'billing', $post->ID );
111
112 foreach ( $billing_fields as $key => $value ) {
113
114 $checkout_data[ 'wcf-' . $key ] = $meta[ 'wcf-' . $key ]['default'];
115 }
116
117 $shipping_fields = Cartflows_Helper::get_checkout_fields( 'shipping', $post->ID );
118
119 foreach ( $shipping_fields as $key => $value ) {
120
121 $checkout_data[ 'wcf-' . $key ] = $meta[ 'wcf-' . $key ]['default'];
122 }
123
124 $additional_fields = Cartflows_Helper::get_checkout_fields( 'additional', $post->ID );
125
126 foreach ( $additional_fields as $key => $value ) {
127
128 $checkout_data[ 'wcf-' . $key ] = $meta[ 'wcf-' . $key ]['default'];
129 }
130 */
131
132 do_action( 'wcf_checkout_settings_markup_before' );
133 $this->tabs_markup( $checkout_data, $post->ID );
134 do_action( 'wcf_checkout_settings_markup_after' );
135 }
136
137 /**
138 * Page Header Tabs
139 *
140 * @param array $options options.
141 * @param int $post_id post ID.
142 */
143 function tabs_markup( $options, $post_id ) {
144
145 $active_tab = get_post_meta( $post_id, 'wcf-active-tab', true );
146
147 if ( empty( $active_tab ) ) {
148 $active_tab = 'wcf-checkout-shortcodes';
149 }
150
151 $tabs = array(
152 array(
153 'title' => __( 'Shortcodes', 'cartflows' ),
154 'id' => 'wcf-checkout-shortcodes',
155 'class' => 'wcf-checkout-shortcodes' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
156 'icon' => 'dashicons-editor-code',
157 ),
158 array(
159 'title' => __( 'Select Product', 'cartflows' ),
160 'id' => 'wcf-checkout-general',
161 'class' => 'wcf-checkout-general' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
162 'icon' => 'dashicons-info',
163 ),
164 array(
165 'title' => __( 'Order Bump', 'cartflows' ),
166 'id' => 'wcf-product-order-bump',
167 'class' => 'wcf-product-order-bump' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
168 'icon' => 'dashicons-cart',
169 ),
170 array(
171 'title' => __( 'Checkout Design', 'cartflows' ),
172 'id' => 'wcf-checkout-style',
173 'class' => 'wcf-checkout-style' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
174 'icon' => 'dashicons-admin-customizer',
175 ),
176 array(
177 'title' => __( 'Checkout Fields', 'cartflows' ),
178 'id' => 'wcf-checkout-custom-fields',
179 'class' => 'wcf-checkout-custom-fields' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
180 'icon' => 'dashicons-welcome-widgets-menus',
181 ),
182 array(
183 'title' => __( 'Logo ( Optional )', 'cartflows' ),
184 'id' => 'wcf-checkout-header',
185 'class' => 'wcf-checkout-header' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
186 'icon' => 'dashicons-format-image',
187 ),
188 array(
189 'title' => __( 'Custom Script', 'cartflows' ),
190 'id' => 'wcf-checkout-custom-script-header',
191 'class' => 'wcf-checkout-custom-script-header' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
192 'icon' => 'dashicons-format-aside',
193 ),
194 );
195
196 ?>
197 <div class="wcf-checkout-table wcf-metabox-wrap widefat">
198 <div class="wcf-table-container">
199 <div class="wcf-column-left">
200 <div class="wcf-tab-wrapper">
201
202 <?php foreach ( $tabs as $key => $tab ) { ?>
203 <div class="<?php echo esc_attr( $tab['class'] ); ?>" data-tab="<?php echo esc_attr( $tab['id'] ); ?>">
204 <span class="dashicons <?php echo esc_attr( $tab['icon'] ); ?>"></span>
205 <span class="wcf-tab-title"><?php echo esc_html( $tab['title'] ); ?></span>
206 </div>
207 <?php } ?>
208
209 <input type="hidden" id="wcf-active-tab" name="wcf-active-tab" value="<?php echo esc_attr( $active_tab ); ?>" />
210 </div>
211 </div>
212 <div class="wcf-column-right">
213 <?php $this->tab_shortcodes( $options, $post_id ); ?>
214 <?php $this->tab_general( $options, $post_id ); ?>
215 <?php $this->tab_style( $options, $post_id ); ?>
216 <?php $this->tab_product_bump( $options, $post_id ); ?>
217 <?php $this->tab_custom_fields( $options, $post_id ); ?>
218 <?php $this->tab_header_content( $options, $post_id ); ?>
219 <?php $this->tab_custom_script( $options, $post_id ); ?>
220 <?php $this->right_column_footer( $options, $post_id ); ?>
221 </div>
222 </div>
223 </div>
224
225 <?php
226 }
227
228 /**
229 * Shortcodes tab
230 *
231 * @param array $options options.
232 * @param int $post_id post ID.
233 */
234 function tab_shortcodes( $options, $post_id ) {
235 ?>
236 <div class="wcf-checkout-shortcodes wcf-tab-content widefat">
237
238 <?php
239
240 echo wcf()->meta->get_shortcode_field(
241 array(
242 'label' => 'Checkout Page',
243 'name' => 'wcf-checkout-shortcode',
244 'content' => '[cartflows_checkout]',
245 'help' => __( 'Add this shortcode to your checkout page', 'cartflows' ),
246 )
247 );
248 ?>
249 </div>
250 <?php
251 }
252
253
254 /**
255 * General tab
256 *
257 * @param array $options options.
258 * @param int $post_id post ID.
259 */
260 function tab_general( $options, $post_id ) {
261 ?>
262 <div class="wcf-checkout-general wcf-tab-content widefat">
263
264 <?php
265
266 echo wcf()->meta->get_product_selection_repeater(
267 array(
268 'name' => 'wcf-checkout-products',
269 'value' => $options['wcf-checkout-products'],
270 'allow_clear' => true,
271 )
272 );
273
274 do_action( 'cartflows_checkout_general_tab_content', $options, $post_id );
275
276 ?>
277 </div>
278 <?php
279 }
280
281 /**
282 * Product bump tab
283 *
284 * @param array $options options.
285 * @param int $post_id post ID.
286 */
287 function tab_product_bump( $options, $post_id ) {
288 ?>
289 <div class="wcf-product-order-bump wcf-tab-content widefat">
290 <?php
291 if ( ! _is_cartflows_pro() ) {
292
293 echo wcf()->meta->get_description_field(
294 array(
295 'name' => 'wcf-upgrade-to-pro',
296 /* translators: %s: link */
297 'content' => '<i>' . sprintf( __( 'Upgrade to %1$sCartFlows Pro%2$s for Order Bump feature', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
298 )
299 );
300 }
301 ?>
302
303 <?php do_action( 'cartflows_order_bump_tab_content', $options, $post_id ); ?>
304 </div>
305 <?php
306 }
307 /**
308 * Tab custom fields
309 *
310 * @param array $options options.
311 * @param int $post_id post ID.
312 */
313 function tab_custom_fields( $options, $post_id ) {
314 ?>
315 <div class="wcf-checkout-custom-fields wcf-tab-content widefat">
316 <?php
317 /* Custom Checkout Fields Section */
318
319 if ( ! _is_cartflows_pro() ) {
320
321 echo wcf()->meta->get_description_field(
322 array(
323 'name' => 'wcf-upgrade-to-pro',
324 /* translators: %s: link */
325 'content' => '<i>' . sprintf( __( 'Upgrade to %1$sCartFlows Pro%2$s for Custom Fields feature', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
326 )
327 );
328 }
329 ?>
330 <?php do_action( 'cartflows_custom_fields_tab_content', $options, $post_id ); ?>
331 </div>
332 <?php
333 }
334
335 /**
336 * Tab style
337 *
338 * @param array $options options.
339 * @param int $post_id post ID.
340 */
341 function tab_style( $options, $post_id ) {
342 ?>
343
344 <div class="wcf-checkout-style wcf-tab-content widefat">
345 <div class="wcf-cs-fields">
346 <div class="wcf-cs-checkbox-field">
347 <?php
348
349 $layout_pro_option = array();
350
351 if ( ! _is_cartflows_pro() ) {
352 $layout_pro_option = array(
353 'one-column' => __( 'One Column (Available in CartFlows Pro) ', 'cartflows' ),
354 );
355 }
356
357 echo wcf()->meta->get_select_field(
358 array(
359 'label' => __( 'Checkout Skin', 'cartflows' ),
360 'name' => 'wcf-checkout-layout',
361 'value' => $options['wcf-checkout-layout'],
362 'options' => array(
363 'one-column' => __( 'One Column', 'cartflows' ),
364 'two-column' => __( 'Two Column', 'cartflows' ),
365 ),
366 'pro-options' => $layout_pro_option,
367
368 )
369 );
370
371 echo wcf()->meta->get_color_picker_field(
372 array(
373 'label' => __( 'Primary Color', 'cartflows' ),
374 'name' => 'wcf-primary-color',
375 'value' => $options['wcf-primary-color'],
376 )
377 );
378
379 echo wcf()->meta->get_font_family_field(
380 array(
381 'for' => 'wcf-base',
382 'label' => __( 'Font Family', 'cartflows' ),
383 'name' => 'wcf-base-font-family',
384 'value' => $options['wcf-base-font-family'],
385 )
386 );
387
388 echo wcf()->meta->get_checkbox_field(
389 array(
390 'label' => __( 'Advance Options', 'cartflows' ),
391 'name' => 'wcf-advance-options-fields',
392 'value' => $options['wcf-advance-options-fields'],
393 'after' => 'Enable',
394 )
395 );
396 ?>
397 </div>
398 <div class="wcf-cs-fields-options">
399 <?php
400 echo wcf()->meta->get_section(
401 array(
402 'label' => __( 'Heading', 'cartflows' ),
403 )
404 );
405
406 echo wcf()->meta->get_color_picker_field(
407 array(
408 'label' => __( 'Heading Color', 'cartflows' ),
409 'name' => 'wcf-heading-color',
410 'value' => $options['wcf-heading-color'],
411 )
412 );
413
414 echo wcf()->meta->get_font_family_field(
415 array(
416 'for' => 'wcf-heading',
417 'label' => __( 'Font Family', 'cartflows' ),
418 'name' => 'wcf-heading-font-family',
419 'value' => $options['wcf-heading-font-family'],
420 )
421 );
422
423 echo wcf()->meta->get_font_weight_field(
424 array(
425 'for' => 'wcf-heading',
426 'label' => __( 'Font Weight', 'cartflows' ),
427 'name' => 'wcf-heading-font-weight',
428 'value' => $options['wcf-heading-font-weight'],
429 )
430 );
431
432 echo wcf()->meta->get_section(
433 array(
434 'label' => __( 'Input Fields', 'cartflows' ),
435 )
436 );
437
438 $fields_skin_pro_option = array();
439
440 if ( ! _is_cartflows_pro() ) {
441 $fields_skin_pro_option = array(
442 'skin-one' => __( 'Floating Labels (Available in CartFlows Pro)', 'cartflows' ),
443 );
444 }
445
446 echo wcf()->meta->get_select_field(
447 array(
448 'label' => __( 'Style', 'cartflows' ),
449 'name' => 'wcf-fields-skins',
450 'value' => $options['wcf-fields-skins'],
451 'options' => array(
452 'default' => __( 'Default', 'cartflows' ),
453 'style-one' => __( 'Floating Labels', 'cartflows' ),
454 ),
455 'pro-options' => $fields_skin_pro_option,
456
457 )
458 );
459
460 echo wcf()->meta->get_font_family_field(
461 array(
462 'for' => 'wcf-input',
463 'label' => __( 'Font Family', 'cartflows' ),
464 'name' => 'wcf-input-font-family',
465 'value' => $options['wcf-input-font-family'],
466 )
467 );
468
469 echo wcf()->meta->get_font_weight_field(
470 array(
471 'for' => 'wcf-input',
472 'label' => __( 'Font Weight', 'cartflows' ),
473 'name' => 'wcf-input-font-weight',
474 'value' => $options['wcf-input-font-weight'],
475 )
476 );
477
478 echo wcf()->meta->get_select_field(
479 array(
480 'label' => __( 'Size', 'cartflows' ),
481 'name' => 'wcf-input-field-size',
482 'value' => $options['wcf-input-field-size'],
483 'options' => array(
484 '33px' => __( 'Extra Small', 'cartflows' ),
485 '38px' => __( 'Small', 'cartflows' ),
486 '44px' => __( 'Medium', 'cartflows' ),
487 '58px' => __( 'Large', 'cartflows' ),
488 '68px' => __( 'Extra Large', 'cartflows' ),
489 'custom' => __( 'Custom', 'cartflows' ),
490 ),
491 )
492 );
493
494 echo wcf()->meta->get_number_field(
495 array(
496 'label' => __( 'Top Bottom Spacing', 'cartflows' ),
497 'name' => 'wcf-field-tb-padding',
498 'value' => $options['wcf-field-tb-padding'],
499 )
500 );
501
502 echo wcf()->meta->get_number_field(
503 array(
504 'label' => __( 'Left Right Spacing', 'cartflows' ),
505 'name' => 'wcf-field-lr-padding',
506 'value' => $options['wcf-field-lr-padding'],
507 )
508 );
509
510 echo wcf()->meta->get_color_picker_field(
511 array(
512 'label' => __( 'Text / Placeholder Color', 'cartflows' ),
513 'name' => 'wcf-field-color',
514 'value' => $options['wcf-field-color'],
515 )
516 );
517
518 echo wcf()->meta->get_color_picker_field(
519 array(
520 'label' => __( 'Background Color', 'cartflows' ),
521 'name' => 'wcf-field-bg-color',
522 'value' => $options['wcf-field-bg-color'],
523 )
524 );
525
526 echo wcf()->meta->get_color_picker_field(
527 array(
528 'label' => __( 'Border Color', 'cartflows' ),
529 'name' => 'wcf-field-border-color',
530 'value' => $options['wcf-field-border-color'],
531 )
532 );
533 echo wcf()->meta->get_color_picker_field(
534 array(
535 'label' => __( 'Label Color', 'cartflows' ),
536 'name' => 'wcf-field-label-color',
537 'value' => $options['wcf-field-label-color'],
538 )
539 );
540
541 ?>
542 </div>
543 <div class="wcf-cs-button-options">
544 <?php
545
546 echo wcf()->meta->get_section(
547 array(
548 'label' => __( 'Buttons', 'cartflows' ),
549 )
550 );
551
552 echo wcf()->meta->get_font_family_field(
553 array(
554 'for' => 'wcf-button',
555 'label' => __( 'Font Family', 'cartflows' ),
556 'name' => 'wcf-button-font-family',
557 'value' => $options['wcf-button-font-family'],
558 )
559 );
560
561 echo wcf()->meta->get_font_weight_field(
562 array(
563 'for' => 'wcf-button',
564 'label' => __( 'Font Weight', 'cartflows' ),
565 'name' => 'wcf-button-font-weight',
566 'value' => $options['wcf-button-font-weight'],
567 )
568 );
569
570 echo wcf()->meta->get_select_field(
571 array(
572 'label' => __( 'Size', 'cartflows' ),
573 'name' => 'wcf-input-button-size',
574 'value' => $options['wcf-input-button-size'],
575 'options' => array(
576 '33px' => __( 'Extra Small', 'cartflows' ),
577 '38px' => __( 'Small', 'cartflows' ),
578 '44px' => __( 'Medium', 'cartflows' ),
579 '58px' => __( 'Large', 'cartflows' ),
580 '68px' => __( 'Extra Large', 'cartflows' ),
581 'custom' => __( 'Custom', 'cartflows' ),
582 ),
583 )
584 );
585
586 echo wcf()->meta->get_number_field(
587 array(
588 'label' => __( 'Top Bottom Spacing', 'cartflows' ),
589 'name' => 'wcf-submit-tb-padding',
590 'value' => $options['wcf-submit-tb-padding'],
591 )
592 );
593
594 echo wcf()->meta->get_number_field(
595 array(
596 'label' => __( 'Left Right Spacing', 'cartflows' ),
597 'name' => 'wcf-submit-lr-padding',
598 'value' => $options['wcf-submit-lr-padding'],
599 )
600 );
601
602 echo wcf()->meta->get_color_picker_field(
603 array(
604 'label' => __( 'Text Color', 'cartflows' ),
605 'name' => 'wcf-submit-color',
606 'value' => $options['wcf-submit-color'],
607 )
608 );
609
610 echo wcf()->meta->get_color_picker_field(
611 array(
612 'label' => __( 'Text Hover Color', 'cartflows' ),
613 'name' => 'wcf-submit-hover-color',
614 'value' => $options['wcf-submit-hover-color'],
615 )
616 );
617
618 echo wcf()->meta->get_color_picker_field(
619 array(
620 'label' => __( 'Background Color', 'cartflows' ),
621 'name' => 'wcf-submit-bg-color',
622 'value' => $options['wcf-submit-bg-color'],
623 )
624 );
625
626 echo wcf()->meta->get_color_picker_field(
627 array(
628 'label' => __( 'Background Hover Color', 'cartflows' ),
629 'name' => 'wcf-submit-bg-hover-color',
630 'value' => $options['wcf-submit-bg-hover-color'],
631 )
632 );
633
634 echo wcf()->meta->get_color_picker_field(
635 array(
636 'label' => __( 'Border Color', 'cartflows' ),
637 'name' => 'wcf-submit-border-color',
638 'value' => $options['wcf-submit-border-color'],
639 )
640 );
641
642 echo wcf()->meta->get_color_picker_field(
643 array(
644 'label' => __( 'Border Hover Color', 'cartflows' ),
645 'name' => 'wcf-submit-border-hover-color',
646 'value' => $options['wcf-submit-border-hover-color'],
647 )
648 );
649
650 ?>
651 </div>
652 <div class="wcf-cs-section-options">
653 <?php
654
655 echo wcf()->meta->get_section(
656 array(
657 'label' => __( 'Sections', 'cartflows' ),
658 )
659 );
660
661 echo wcf()->meta->get_color_picker_field(
662 array(
663 'label' => __( 'Highlight Area Background Color', 'cartflows' ),
664 'name' => 'wcf-hl-bg-color',
665 'value' => $options['wcf-hl-bg-color'],
666 )
667 );
668
669 echo wcf()->meta->get_hidden_field(
670 array(
671 'name' => 'wcf-field-google-font-url',
672 'value' => $options['wcf-field-google-font-url'],
673 )
674 );
675 ?>
676 </div>
677 <?php do_action( 'cartflows_checkout_style_tab_content', $options, $post_id ); ?>
678 </div>
679 </div>
680 <?php
681 }
682
683
684 /**
685 * Tab Header (Used for add logo into header)
686 *
687 * @param array $options options.
688 * @param int $post_id post ID.
689 */
690 function tab_header_content( $options, $post_id ) {
691 ?>
692
693 <div class="wcf-checkout-header wcf-tab-content widefat">
694 <?php
695
696 $layout_pro_option = array();
697
698 echo wcf()->meta->get_image_field(
699 array(
700 'name' => 'wcf-header-logo-image',
701 'value' => $options['wcf-header-logo-image'],
702 'label' => __( 'Header Logo', 'cartflows' ),
703 )
704 );
705
706 echo wcf()->meta->get_number_field(
707 array(
708 'name' => 'wcf-header-logo-width',
709 'value' => $options['wcf-header-logo-width'],
710 'label' => __( 'Logo Width (In px)', 'cartflows' ),
711 )
712 );
713 ?>
714 <?php do_action( 'cartflows_checkout_header_tab_content', $options, $post_id ); ?>
715 </div>
716 <?php
717 }
718 /**
719 * Get metabox options
720 *
721 * @param int $post_id post ID.
722 */
723 public static function get_meta_option( $post_id ) {
724
725 if ( null === self::$meta_option ) {
726
727 /**
728 * Set metabox options
729 *
730 * @see http://php.net/manual/en/filter.filters.sanitize.php
731 */
732 self::$meta_option = wcf()->options->get_checkout_fields( $post_id );
733 }
734
735 return self::$meta_option;
736 }
737
738 /**
739 * Metabox Save
740 *
741 * @param number $post_id Post ID.
742 * @return void
743 */
744 function save_meta_box( $post_id ) {
745
746 // Checks save status.
747 $is_autosave = wp_is_post_autosave( $post_id );
748 $is_revision = wp_is_post_revision( $post_id );
749
750 $is_valid_nonce = ( isset( $_POST['nonce-checkout-step-meta'] ) && wp_verify_nonce( $_POST['nonce-checkout-step-meta'], 'save-nonce-checkout-step-meta' ) ) ? true : false;
751
752 // Exits script depending on save status.
753 if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
754 return;
755 }
756
757 wcf()->options->save_checkout_fields( $post_id );
758 }
759
760 }
761
762 /**
763 * Kicking this off by calling 'get_instance()' method
764 */
765 Cartflows_Checkout_Meta::get_instance();
766