Virtual Try-On for Magento 2 — Enterprise Fashion API Integration
TryOnCloud integrates with Magento 2 via REST API and a lightweight frontend module. Suitable for enterprise fashion retailers running Magento Commerce or Magento Open Source. Full control over the try-on experience with Magento's block and layout XML system.
Method
Magento 2 Module + REST API
Auth
API key via Magento configuration — stored in core_config_data
Language
PHP / XML / JavaScript (RequireJS)
Best for
Mid-market to enterprise fashion retailers ($5M+ GMV)
Why use TryOnCloud with Magento 2
- Full control via Magento layout XML — position try-on anywhere on the product page
- Works with Luma, Hyva, and custom Magento themes
- Admin panel configuration — no hardcoded values
- Supports Magento's block cache — try-on button is cache-friendly
- Compatible with Magento Commerce B2B and multi-store setups
How to set up TryOnCloud on Magento 2
Estimated setup time: 2–4 hours. Difficulty: Intermediate.
- 1
Install the Magento module via Composer
Run: composer require tryoncloud/magento2-module. Then: bin/magento module:enable TryOnCloud_VirtualTryOn && bin/magento setup:upgrade.
- 2
Configure API key in Magento Admin
Go to Stores > Configuration > TryOnCloud > General. Enter your API key from the TryOnCloud dashboard. Save and flush cache.
- 3
Configure display settings
In the same configuration panel, select which attribute sets show try-on (e.g., Clothing, Apparel). Set button position relative to the Add to Cart block.
- 4
Deploy static content
Run: bin/magento setup:static-content:deploy. This publishes the TryOnCloud JavaScript to your static file directory.
- 5
Test and flush cache
Visit a product with the configured attribute set. Verify the try-on button appears. Run bin/magento cache:flush if changes are not visible.
Code example
Magento 2: API call from Block class
<?php
namespace TryOnCloud\VirtualTryOn\Block\Product;
use Magento\Framework\View\Element\Template;
use Magento\Framework\HTTP\Client\Curl;
class TryOnButton extends Template
{
public function __construct(
Template\Context $context,
private readonly Curl $curl,
private readonly \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
array $data = []
) {
parent::__construct($context, $data);
}
public function getApiKey(): string
{
return $this->scopeConfig->getValue(
'tryoncloud/general/api_key',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
}
}Things to know
- ⓘRequires Magento 2.4.x (2.3.x supported with minor adjustments)
- ⓘModule installation requires SSH access to the server
- ⓘDeveloper familiarity with Magento's layout XML system recommended
Frequently asked questions
Does TryOnCloud work with Hyva themes?
Yes. TryOnCloud's Magento module ships with a Hyva-compatible Alpine.js component alongside the standard RequireJS version. Enable it in the module configuration.
Does it work with Magento Commerce (Adobe Commerce)?
Yes. The module is compatible with Magento Open Source and Adobe Commerce 2.4.x. B2B and multi-store configurations are supported.
Can we use the API without installing the module?
Yes. You can call the TryOnCloud REST API directly from any custom Magento frontend without the module. The module simply provides a pre-built UI integration.
Ready to add virtual try-on to your Magento 2 store?
Join hundreds of fashion merchants reducing returns and boosting conversions with TryOnCloud. Start free — no credit card required.
Get started free