Anddressfor Brands
WooCommerce & WordPress Hook Integration

专为 WooCommerce 独立站打造的 AI 虚拟试衣间

无需安装臃肿的 WordPress 插件,通过轻量 Web Component 直接接入,服务器零负担。

Zero PHP Overhead

Zero CPU or memory consumed on your WordPress server. All GPU inference is handled by Anddress infrastructure.

Native WooCommerce Hooks

Hooks natively into standard action points like woocommerce_after_add_to_cart_button without modifying core templates.

Page Builders Ready

Works seamlessly inside Elementor Pro Single Product templates, Divi Builder, or Gutenberg product blocks with isolated Shadow DOM.

Instalación en functions.php

Add this snippet to your child theme

En tu archivo wp-content/themes/tu-tema-hijo/functions.php:
// 1. Cargar el script asíncrono en el pie de página
add_action('wp_footer', function() {
    echo '<script src="https://brands.anddress.com/widget/anddress-brands.js" data-brand-key="pk_live_TU_CLAVE" async></script>';
});

// 2. Inyectar el botón en la ficha de producto de WooCommerce
add_action('woocommerce_after_add_to_cart_button', function() {
    global $product;
    if (!$product) return;
    $img_id  = $product->get_image_id();
    $img_url = wp_get_attachment_image_url($img_id, 'full');
    ?>
    <div style="margin-top: 14px;">
      <anddress-tryon-button
        data-garment-image="<?php echo esc_url($img_url); ?>"
        data-garment-category="tops"
        data-garment-id="<?php echo esc_attr($product->get_sku() ?: $product->get_id()); ?>"
        data-garment-name="<?php echo esc_attr($product->get_name()); ?>">
      </anddress-tryon-button>
    </div>
    <?php
});
WooCommerce & WordPress 专属 AI 虚拟试衣间 — Anddress for Brands