/** * Plugin Name: FastCart Custom 63255 * Description: سفارش سریع فقط برای محصول با شناسه 63255 * Version: 1.0 * Author: Custom */ add_action('woocommerce_single_product_summary', 'custom_fastcart_form', 35); add_action('wp_footer', 'custom_fastcart_modal'); function custom_fastcart_form() { global $product; if (!$product || $product->get_id() != 63255) return; echo '
'; echo ''; echo ''; echo '
'; } function custom_fastcart_modal() { echo ' '; } add_action('wp_ajax_nopriv_fastcart_order', 'handle_fastcart_order'); add_action('wp_ajax_fastcart_order', 'handle_fastcart_order'); function handle_fastcart_order() { $phone = sanitize_text_field($_POST['phone']); $product_id = intval($_POST['product_id']); if (!$phone || $product_id != 63255) wp_send_json_error(); $order = wc_create_order(); $order->add_product(wc_get_product($product_id), 1); $order->set_customer_note("شماره تماس: " . $phone); $order->calculate_totals(); $order->update_status('processing'); wp_send_json_success(); } add_action('wp_footer', 'custom_fastcart_modal'); function custom_fastcart_modal() { echo ' '; } add_action('wp_ajax_nopriv_handle_fastcart_order', 'handle_fastcart_order'); add_action('wp_ajax_handle_fastcart_order', 'handle_fastcart_order'); function handle_fastcart_order() { $phone = sanitize_text_field($_POST['phone']); $product_id = intval($_POST['product_id']); if (!$phone || $product_id != 63255) wp_send_json_error(); $order = wc_create_order(); $order->add_product(wc_get_product($product_id), 1); $order->set_customer_note("شماره تماس: " . $phone); $order->calculate_totals(); $order->update_status('processing'); wp_send_json_success(); } مقایسه کالاها – فروشگاه فکت آفرز