PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 4.2.2
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v4.2.2
4.7.2 4.7.1 4.7.0 4.6.6 4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.1 4.5.0 4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 All 281 releases
surecart / app / helpers / state-helpers.php
state-helpers.php
33 lines 786 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! function_exists( 'sc_initial_state' ) ) {
3 /**
4 * Merge data with the existing store.
5 *
6 * @param array $data Data that will be merged with the existing store.
7 *
8 * @return $data The current store data.
9 */
10 function sc_initial_state( $data = null ) {
11 if ( $data ) {
12 \SureCart::state()->mergeData( $data );
13 }
14 return \SureCart::state()->getData();
15 }
16 }
17
18 if ( ! function_exists( 'sc_initial_line_items' ) ) {
19 /**
20 * Get the current store state.
21 *
22 * @param array $data Data that will be merged with the existing store.
23 *
24 * @return array The current store state.
25 */
26 function sc_initial_line_items( $data = [] ) {
27 if ( $data ) {
28 return \SureCart::state()->lineItems()->merge( $data );
29 }
30 return \SureCart::state()->lineItems()->get();
31 }
32 }
33