Support Log in

33. WooCommerce Integration

Developer Guide
Prefer video? Watch the Lang Forge tutorials 9 short guides covering every feature Watch

WooCommerce integration is a Free feature. It handles core product translation, product meta sync, cart language switching, checkout string localization, and order language tracking. PRO adds AI-assisted and bulk WooCommerce workflows on top of this Free foundation. Advanced WooCommerce extensions, custom checkout plugins, subscription/booking flows, payment-provider emails, shipping calculators, and heavily customized transactional email templates need site-specific QA.

Product Filtering

Products are automatically filtered by language on shop, category, and tag archive pages.

php
// For custom product queries, add the language filter:
$args = [
    'post_type'      => 'product',
    'posts_per_page' => 12,
    'meta_query'     => [
        'relation' => 'OR',
        [
            'key'   => '_lf_language',
            'value' => lf_get_current_language(),
        ],
        [
            'key'     => '_lf_language',
            'compare' => 'NOT EXISTS',
        ],
    ],
];
$products = new WP_Query($args);

Product Data Sync

When a translation is created for a product, WooCommerce product data (prices, SKU, stock, attributes) is copied. Certain meta fields are synced across all translations:

php
// If you need to PREVENT syncing for a specific field:
add_filter('lf_woo_sync_meta_keys', function ($keys) {
    return array_diff($keys, ['_regular_price', '_sale_price', '_price']);
});

Cart Language Switching

When a customer switches languages, cart product IDs are automatically mapped to the translation in the new language.

WooCommerce Page Translation

WooCommerce system pages (shop, cart, checkout, my-account) are automatically resolved to their translated versions.

Order Language

The customer’s language at the time of purchase is saved with the order:

php
$order_lang = get_post_meta($order_id, '_lf_language', true);

Forge AI Assistant Online

Hi! I'm the Lang Forge AI assistant. Ask me anything about the plugin — setup, features, troubleshooting, or development.

Just now
Powered by Forge AI · Browse docs