Step 1: Get your Photta widget key
Log in to the Photta Business Dashboard at business.photta.app. Go to Settings → API Keys and copy your publishable key, which starts with pk_live_. This is the only credential you need. Before the key will work, add your WooCommerce store domain (e.g., mystore.com) to Settings → Allowed Domains. The domain check runs on every try-on request, so the allowlist must be set before you go live.
If you are testing locally on a subdomain like localhost or a staging URL, add that domain to the allowlist separately. You can add up to 10 domains on any paid plan. The trial account allows one domain. Once your domain is listed, requests from that origin will be accepted immediately — there is no propagation delay.
Step 2: Choose shortcode vs. script tag
WooCommerce gives you two clean integration paths. The shortcode approach ([photta_widget pk="pk_live_..."]) lets you paste the widget into a specific location inside your product page template or a custom WooCommerce hook — ideal if you want the button to appear exactly between the product gallery and the Add to Cart button. To use the shortcode, paste it directly into the WooCommerce product template file single-product/add-to-cart/simple.php, or use a page builder block.
The script tag approach inserts the SDK globally through your theme's functions.php file using wp_enqueue_script. Add the following to your child theme's functions.php: add_action('wp_footer', function() { echo '<script src="https://widget.photta.app/v1/embed.js" data-api-key="pk_live_..." defer></script>'; }); This renders the widget button on every product page automatically, with no per-template changes. Most merchants prefer the script tag approach for its simplicity.
Step 3: Paste and save your chosen snippet
For the shortcode path: open your child theme's WooCommerce template override for the single product page. Paste [photta_widget pk="pk_live_..."] at the exact vertical position where you want the button to appear. Save the file. The shortcode renderer is registered by Photta's lightweight helper — no plugin file needed, since the SDK itself registers the shortcode handler when loaded.
For the script tag path: open Appearance → Theme File Editor in your WordPress admin, navigate to your child theme's functions.php, and add the wp_footer action snippet shown in Step 2. Click Update File to save. Verify the snippet was saved by refreshing the editor and confirming the code is present. If you use a caching plugin (WP Rocket, W3 Total Cache), clear the cache now so the new footer script is served.
Step 4: Verify the widget appears on your store
Navigate to a product page on your WooCommerce store in a private browser window. You should see a 'Try it on' button near the Add to Cart section. Click the button, upload a test photo, and verify the try-on result renders. If the button does not appear, open the browser console (F12) and look for photta errors. A 403 domain error means your domain is not yet in the Allowed Domains list.
Also check that the SDK script tag appears in the page HTML source by pressing Ctrl+U (View Source) and searching for photta. If the tag is absent but you added the wp_footer hook, double-check that your theme is calling wp_footer() in its footer template — some older or heavily customized themes omit this call. Adding <?php wp_footer(); ?> before the closing </body> in your footer.php fixes this.
Step 5: Configure per-category visibility
By default, the widget button appears on all product pages. To restrict it to specific categories, add the data-categories attribute to your script tag with a comma-separated list of WooCommerce category slugs: <script src="https://widget.photta.app/v1/embed.js" data-api-key="pk_live_..." data-categories="womens-apparel,mens-apparel,swimwear" defer></script>. The SDK reads the current page's WooCommerce category data and hides the button on non-matching pages automatically.
For shortcode users, place the shortcode only in the templates associated with the target categories, or wrap the shortcode in a WooCommerce conditional: use the has_term() PHP function to check whether the current product belongs to the target category before outputting the shortcode. This pattern gives you surgical control over which product types display the try-on option without duplicating templates.
