| @@ -881,75 +881,8 @@ | ||
| 881 | 881 | return self::$snapchat; |
| 882 | 882 | } |
| 883 | 883 | |
| 884 | 884 | /** |
| 885 | - * Prepare response data for facebook. | |
| 886 | - * | |
| 887 | - * @todo Remove this function in 1.6.18 as it is added in cartflows-tracking file. | |
| 888 | - * @param int $order_id order_id. | |
| 889 | - * @param array $offer_data offer data. | |
| 890 | - * @return void | |
| 891 | - */ | |
| 892 | - public static function send_fb_response_if_enabled( $order_id, $offer_data = array() ) { | |
| 893 | - | |
| 894 | - _deprecated_function( __METHOD__, '1.6.15' ); | |
| 895 | - | |
| 896 | - // Stop Execution if WooCommerce is not installed & don't set the cookie. | |
| 897 | - if ( ! Cartflows_Loader::get_instance()->is_woo_active ) { | |
| 898 | - return; | |
| 899 | - } | |
| 900 | - | |
| 901 | - // @Since 1.6.15 It will only trigger offer purchase event. | |
| 902 | - $fb_settings = self::get_facebook_settings(); | |
| 903 | - if ( 'enable' === $fb_settings['facebook_pixel_tracking'] ) { | |
| 904 | - setcookie( 'wcf_order_details', wp_json_encode( self::prepare_purchase_data_fb_response( $order_id, $offer_data ) ), strtotime( '+1 year' ), '/', COOKIE_DOMAIN, CARTFLOWS_HTTPS, true ); //phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.cookies_setcookie | |
| 905 | - } | |
| 906 | - } | |
| 907 | - | |
| 908 | - /** | |
| 909 | - * Prepare purchase response for facebook purcase event. | |
| 910 | - * | |
| 911 | - * @todo Remove this function in 1.6.18 as it is added in cartflows-tracking file. | |
| 912 | - * | |
| 913 | - * @param integer $order_id order id. | |
| 914 | - * @param array $offer_data offer data. | |
| 915 | - * @return mixed | |
| 916 | - */ | |
| 917 | - public static function prepare_purchase_data_fb_response( $order_id, $offer_data ) { | |
| 918 | - | |
| 919 | - _deprecated_function( __METHOD__, '1.6.15' ); | |
| 920 | - | |
| 921 | - $purchase_data = array(); | |
| 922 | - | |
| 923 | - if ( empty( $offer_data ) ) { | |
| 924 | - return $purchase_data; | |
| 925 | - } | |
| 926 | - | |
| 927 | - if ( ! Cartflows_Loader::get_instance()->is_woo_active ) { | |
| 928 | - return $purchase_data; | |
| 929 | - } | |
| 930 | - | |
| 931 | - $order = wc_get_order( $order_id ); | |
| 932 | - | |
| 933 | - if ( ! $order ) { | |
| 934 | - return $purchase_data; | |
| 935 | - } | |
| 936 | - | |
| 937 | - $purchase_data['content_type'] = 'product'; | |
| 938 | - $purchase_data['currency'] = wcf()->options->get_checkout_meta_value( $order_id, '_order_currency' ); | |
| 939 | - $purchase_data['userAgent'] = wcf()->options->get_checkout_meta_value( $order_id, '_customer_user_agent' ); | |
| 940 | - $purchase_data['plugin'] = 'CartFlows-Offer'; | |
| 941 | - | |
| 942 | - $purchase_data['content_ids'][] = (string) $offer_data['id']; | |
| 943 | - $purchase_data['content_names'][] = $offer_data['name']; | |
| 944 | - $purchase_data['content_category'][] = wp_strip_all_tags( wc_get_product_category_list( $offer_data['id'] ) ); | |
| 945 | - $purchase_data['value'] = $offer_data['total']; | |
| 946 | - $purchase_data['transaction_id'] = $order_id; | |
| 947 | - | |
| 948 | - return $purchase_data; | |
| 949 | - } | |
| 950 | - | |
| 951 | - /** | |
| 952 | 885 | * Get the image url of size. |
| 953 | 886 | * |
| 954 | 887 | * @param int $post_id post id. |
| 955 | 888 | * @param array $key key. |
| @@ -1223,8 +1156,19 @@ | ||
| 1223 | 1156 | |
| 1224 | 1157 | $product = wc_get_product( $product_id ); |
| 1225 | 1158 | } |
| 1226 | 1159 | |
| 1160 | + if ( $product && $product->is_type( 'bundle' ) && method_exists( $product, 'get_bundle_price' ) ) { | |
| 1161 | + /* | |
| 1162 | + * A bundle's own price is only its container base price, which is 0 or empty as soon | |
| 1163 | + * as the bundled items are priced individually — leaving the step showing just a | |
| 1164 | + * currency symbol. Use the bundle's minimum price instead: the "from" price the | |
| 1165 | + * customer would pay, mirroring how a variable product resolves to a variation price | |
| 1166 | + * above. Kept scalar because callers run discount maths on this value. | |
| 1167 | + */ | |
| 1168 | + return $product->get_bundle_price( 'min', false ); | |
| 1169 | + } | |
| 1170 | + | |
| 1227 | 1171 | if ( $product ) { |
| 1228 | 1172 | $custom_price = $product->get_price( 'edit' ); |
| 1229 | 1173 | } |
| 1230 | 1174 | |
| @@ -1985,9 +1929,9 @@ | ||
| 1985 | 1929 | * |
| 1986 | 1930 | * @return array<string> Allowed file extensions. |
| 1987 | 1931 | */ |
| 1988 | 1932 | public static function get_allowed_file_extensions() { |
| 1989 | - return array( 'jpg', 'jpeg', 'png', 'gif', 'webp', 'ico', 'pdf', 'mp3', 'm4a', 'wav', 'mp4', 'm4v', 'mov' ); | |
| 1933 | + return array( 'jpg', 'jpeg', 'png', 'gif', 'webp', 'pdf', 'mp3', 'm4a', 'wav', 'mp4', 'm4v', 'mov' ); | |
| 1990 | 1934 | } |
| 1991 | 1935 | |
| 1992 | 1936 | /** |
| 1993 | 1937 | * Sanitize accepted file types input against the master allowlist. |