Checkout_next
Sistema de Pedidos WhatsApp
Checkout con Recolección de Carrito
1. Resumen de tu Carrito
2 Productos2. Datos de Envío y Receptor
Vista Previa del Mensaje
Así llegará el texto a tu WhatsApp (+595 985 730345)
Subtotal Carrito:
0 Gs.
Costo de Envío:
GRATIS
Total Final:
0 Gs.
Abrirá WhatsApp Web / App con todos los ítems precargados.
Código e Integración para tu Tienda
Copia y pega este código en tu sitio web. Tienes dos opciones principales:
Opción A: Snippet JavaScript Universal (Para sitios Web, HTML, Landing Pages)
<!-- Botón y Función para recolectar el carrito y enviar por WhatsApp -->
<script>
function checkoutWhatsApp(cartItems, customerData) {
const phoneNumber = "595985730345"; // WhatsApp Oficial de Amanopy
// 1. Encabezado del pedido
let message = `🛒 *¡NUEVO PEDIDO EN AMANOPY.COM!*\n`;
message += `----------------------------------\n`;
// 2. Datos del Cliente
message += `👤 *DATOS DEL CLIENTE:*\n`;
message += `• *Nombre:* ${customerData.name}\n`;
message += `• *Teléfono:* ${customerData.phone}\n`;
if(customerData.doc) message += `• *RUC/CI:* ${customerData.doc}\n`;
message += `• *Ciudad:* ${customerData.city}\n`;
message += `• *Dirección:* ${customerData.address}\n`;
if(customerData.ref) message += `• *Referencia:* ${customerData.ref}\n`;
message += `• *Pago:* ${customerData.paymentMethod}\n\n`;
// 3. Detalle de los Productos
message += `🛍️ *PRODUCTOS DEL CARRITO:*\n`;
let subtotal = 0;
cartItems.forEach((item, index) => {
const itemSubtotal = item.price * item.quantity;
subtotal += itemSubtotal;
message += `${index + 1}. 📦 *${item.title}*\n`;
message += ` • Cantidad: ${item.quantity}\n`;
message += ` • Precio: ${item.price.toLocaleString('es-PY')} Gs.\n`;
message += ` • Subtotal: ${itemSubtotal.toLocaleString('es-PY')} Gs.\n`;
});
// 4. Totales
message += `----------------------------------\n`;
message += `💵 *Subtotal:* ${subtotal.toLocaleString('es-PY')} Gs.\n`;
message += `🚚 *Envío:* GRATIS\n`;
message += `🔥 *TOTAL A PAGAR:* ${subtotal.toLocaleString('es-PY')} Gs.\n`;
message += `----------------------------------\n`;
if(customerData.notes) message += `💬 *Notas:* ${customerData.notes}\n`;
// 5. Redireccionar a WhatsApp
const url = `https://wa.me/${phoneNumber}?text=${encodeURIComponent(message)}`;
window.open(url, '_blank');
}
</script>
Opción B: Snippet para WooCommerce / WordPress (functions.php)
<?php
/**
* Botón de Checkout directo a WhatsApp recolectando todo el carrito de WooCommerce
* Agregar en el archivo functions.php de tu tema o plugin Code Snippets
*/
add_action('woocommerce_proceed_to_checkout', 'amanopy_whatsapp_checkout_button', 20);
function amanopy_whatsapp_checkout_button() {
if (WC()->cart->is_empty()) return;
$phone = "595985730345";
$cart = WC()->cart->get_cart();
$msg = "🛒 *NUEVO PEDIDO DE CARRITO - AMANOPY.COM*\n";
$msg .= "----------------------------------\n\n";
$msg .= "🛍️ *PRODUCTOS:*\n";
$i = 1;
foreach ($cart as $cart_item_key => $cart_item) {
$product = $cart_item['data'];
$quantity = $cart_item['quantity'];
$price = wc_get_price_to_display($product);
$subtotal = $price * $quantity;
$msg .= "{$i}. 📦 *" . $product->get_name() . "*\n";
$msg .= " • Cant: {$quantity} | Subtotal: " . number_format($subtotal, 0, ',', '.') . " Gs.\n";
$i++;
}
$total = WC()->cart->get_total('edit');
$msg .= "\n----------------------------------\n";
$msg .= "🔥 *TOTAL ESTIMADO:* " . number_format($total, 0, ',', '.') . " Gs.\n";
$msg .= "----------------------------------\n";
$msg .= "📌 *Por favor envíenme las instrucciones para confirmar el envío.*";
$whatsapp_url = "https://wa.me/" . $phone . "?text=" . urlencode($msg);
echo '<a href="' . esc_url($whatsapp_url) . '" target="_blank" class="button alt" style="background-color:#25D366 !important; color:#fff !important; font-weight:bold; width:100%; text-align:center; padding:15px; border-radius:10px; margin-top:10px; display:block;">';
echo '<i class="fa-brands fa-whatsapp"></i> Pedir Carrito por WhatsApp';
echo '</a>';
}
?>
