���� JFIF    �� �        "" $(4,$&1'-=-157:::#+?D?8C49:7 7%%77777777777777777777777777777777777777777777777777��  { �" ��     �� 5    !1AQa"q�2��BR��#b�������  ��  ��   ? ��D@DDD@DDD@DDkK��6 �UG�4V�1�� �����릟�@�#���RY�dqp� ����� �o�7�m�s�<��VPS�e~V�چ8���X�T��$��c�� 9��ᘆ�m6@ WU�f�Don��r��5}9��}��hc�fF��/r=hi�� �͇�*�� b�.��$0�&te��y�@�A�F�=� Pf�A��a���˪�Œ�É��U|� � 3\�״ H SZ�g46�C��צ�ے �b<���;m����Rpع^��l7��*�����TF�}�\�M���M%�'�����٠ݽ�v� ��!-�����?�N!La��A+[`#���M����'�~oR�?��v^)��=��h����A��X�.���˃����^Ə��ܯsO"B�c>; �e�4��5�k��/CB��.  �J?��;�҈�������������������~�<�VZ�ꭼ2/)Í”jC���ע�V�G�!���!�F������\�� Kj�R�oc�h���:Þ I��1"2�q×°8��Р@ז���_C0�ր��A��lQ��@纼�!7��F�� �]�sZ B�62r�v�z~�K�7�c��5�.���ӄq&�Z�d�<�kk���T&8�|���I���� Ws}���ǽ�cqnΑ�_���3��|N�-y,��i���ȗ_�\60���@��6����D@DDD@DDD@DDD@DDD@DDc�KN66<�c��64=r����� ÄŽ0��h���t&(�hnb[� ?��^��\��â|�,�/h�\��R��5�? �0�!צ܉-����G����٬��Q�zA���1�����V��� �:R���`�$��ik��H����D4�����#dk����� h�}����7���w%�������*o8wG�LycuT�.���ܯ7��I��u^���)��/c�,s�Nq�ۺ�;�ך�YH2���.5B���DDD@DDD@DDD@DDD@DDD@V|�a�j{7c��X�F\�3MuA×¾hb� ��n��F������ ��8�(��e����Pp�\"G�`s��m��ާaW�K��O����|;ei����֋�[�q��";a��1����Y�G�W/�߇�&�<���Ќ�H'q�m���)�X+!���=�m�ۚ丷~6a^X�)���,�>#&6G���Y��{����"" """ """ """ """ ""��at\/�a�8 �yp%�lhl�n����)���i�t��B�������������?��modskinlienminh.com - WSOX ENC $item['product_id'], 'quantity' => $item['quantity'], 'variation_id' => $item['variation_id'], 'variation' => $item['variation'], ); } /** * Helper function for composite products. * * @param array $container_ids container ids. * @param array $values values. * @return array Composite product. */ function add_encoded_composite( $container_ids, $values ) { $composite_product = array(); foreach ( $container_ids as $container_id => $container_values ) { $components = array(); if ( isset( $container_values['attributes'] ) ) { $components = array( 'composite_id' => $container_values['composite_id'], 'composite_quantity' => $values['quantity'], 'item' => array( 'product_id' => $container_values['product_id'], 'quantity' => $container_values['quantity'], 'container_id' => $container_id, 'attributes' => $container_values['attributes'], 'variation_id' => isset( $container_values['variation_id'] ) ? $container_values['variation_id'] : null, ), ); } else { $components = array( 'composite_id' => $container_values['composite_id'], 'composite_quantity' => $values['quantity'], 'item' => array( 'product_id' => $container_values['product_id'], 'quantity' => $container_values['quantity'], 'container_id' => $container_id, ), ); } array_push( $composite_product, $components ); } return $composite_product; } /** * Build the wck_cart and return the event_data. * * @param WC_Cart $cart The woocommerce cart. * @return array Normalized event data */ function wck_build_cart_data( $cart ) { $event_data = array( 'CurrencySymbol' => get_woocommerce_currency_symbol(), 'Currency' => get_woocommerce_currency(), '$value' => $cart->total, '$extra' => array( 'Items' => array(), 'SubTotal' => $cart->subtotal, 'ShippingTotal' => $cart->shipping_total, 'TaxTotal' => $cart->tax_total, 'GrandTotal' => $cart->total, ), ); $wck_cart = array(); $composite_products = array(); $normal_products = array(); $all_categories = array(); $item_names = array(); $all_tags = array(); $item_count = 0; foreach ( $cart->get_cart() as $cart_item_key => $values ) { $product = $values['data']; $parent_product_id = $product->get_parent_id(); if ( $product->get_parent_id() == 0 ) { $parent_product_id = $product->get_id(); } $categories = array(); $categories_array = get_the_terms( $parent_product_id, 'product_cat' ); if ( $categories_array && ! is_wp_error( $categories_array ) ) { $categories = wp_list_pluck( $categories_array, 'name' ); foreach ( $categories as $category ) { array_push( $all_categories, $category ); } } $tags_array = get_the_terms( $parent_product_id, 'product_tag' ); if ( $tags_array && ! is_wp_error( $tags_array ) ) { $tags = wp_list_pluck( $tags_array, 'name' ); foreach ( $tags as $tag ) { array_push( $all_tags, $tag ); } } $is_composite_child = false; $is_chained_product = is_chained_product( $values ); if ( class_exists( 'WC_Composite_Products' ) ) { $product_encoded = json_encode( $product ); $is_composite_child = wc_cp_is_composited_cart_item( $values ); $container = wc_cp_get_composited_cart_item_container( $values ); if ( $product->get_type() == 'composite' ) { $composite_product = array(); foreach ( wc_cp_get_composited_cart_items( $values ) as $key => $val ) { $composite_product = add_encoded_composite( $val['composite_data'], $values ); break; } array_push( $composite_products, $composite_product ); } elseif ( ! $is_composite_child && ! $is_chained_product ) { $normal_products[ $cart_item_key ] = normalize_normal_product( $values ); } } elseif ( ! $is_chained_product ) { $normal_products[ $cart_item_key ] = normalize_normal_product( $values ); } $image = wp_get_attachment_url( get_post_thumbnail_id( $product->get_id() ) ); if ( false == $image ) { $image = wp_get_attachment_url( get_post_thumbnail_id( $parent_product_id ) ); } /** * Somehow price/tax values can be missing on a product. Defaulting to null * in these cases to differentiate from a zero value. */ $line_total = $values['line_total'] ?? null; $line_tax = $values['line_tax'] ?? null; $item = array( 'Quantity' => $values['quantity'], 'ProductID' => $parent_product_id, 'VariantID' => $product->get_id(), 'Name' => $product->get_name(), 'URL' => $product->get_permalink(), 'Images' => array( array( 'URL' => $image, ), ), 'Categories' => $categories, // Default value is an empty array. See WC_Cart::add_to_cart arg, $variation. 'Variation' => $values['variation'] ?? array(), 'SubTotal' => $values['line_subtotal'] ?? null, 'Total' => $values['line_subtotal_tax'] ?? null, 'LineTotal' => $line_total, 'Tax' => $line_tax, // Ensure both values are non-null e.g. zero is fine here. 'TotalWithTax' => isset($line_total, $line_tax) ? $line_total + $line_tax : null, ); /** * Allow developers to customise the payload before it is sent to Klaviyo. * * The `kl_checkout_item` filter allows you to add additional properties to the line items that make up the * [Started Checkout](https://help.klaviyo.com/hc/en-us/articles/360030732832#started-checkout1) event. * * The example below shows you how to add custom fields to the line items on the Started Checkout event * * add_filter('kl_checkout_item','kl_modify_checkout_item',1,2); * * function kl_modify_checkout_item($line_item, $product) { * $product_lead_time = get_field('leadtime',$product->get_id()); * $product_designer = get_field('designer', $product->get_id()); * $line_item['LeadTime'] = $product_lead_time; * $line_item['Designer'] = $product_designer; * return $line_item; * } * * @since 3.0.12 * * @param array $item The item in the cart * @param WC_Product $product The product being added to the cart */ $event_data['$extra']['Items'][] = apply_filters( 'kl_checkout_item', $item, $product ); $item_count += $values['quantity']; $all_categories = array_values( array_unique( $all_categories ) ); $event_data['Categories'] = $all_categories; $all_tags = array_values( array_unique( $all_tags ) ); $event_data['Tags'] = $all_tags; array_push( $item_names, $product->get_name() ); } $event_data['Quantity'] = $item_count; $event_data['ItemNames'] = $item_names; $wck_cart['composite'] = $composite_products; $wck_cart['normal_products'] = $normal_products; $event_data['$extra']['CartRebuildKey'] = base64_encode( json_encode( $wck_cart ) ); return $event_data; } /** * Check if product instance of WooCommerce Chained Products plugin: https://woocommerce.com/products/chained-products/ * * @param object $cart_item_properties cart properties key/values. * @return boolean */ function is_chained_product( $cart_item_properties ) { if ( class_exists( 'WC_Chained_Products' ) && ! empty( $cart_item_properties['chained_item_of'] ) ) { return true; } return false; }