Amazon’s Washington State Ad Tax: What Sellers Need to Know
Reading Time: 3 minutesAmazon recently announced a significant change for sellers advertising in Washington state:…
When you shop for any product especially clothing or shoes, when you click on the product, along with the product the colours available for it are also displayed. You can simply click on each colour and view the product. How is this feature made possible in Magento? In Magento PWA Studio this is made possible through colour swatches. Customers can click on the swatch and check all the colour options for a particular product. So here’s a blog dedicated to how to add a custom attributes in PWA Studio.
This is the third blog in our series dedicated to Magento PWA Studio, the first two being How to add a newsletter to the footer and How to add banner on a category page, both interesting reads which you can check out.
Without further ado let’s see how it’s done.
Check out our Cenia Pro Theme for Magento 2 PWA, a fast and seamless PWA solution
Magento has a feature to show product attributes as a swatch be it visual swatch for colors or product swatch. In Venia Pwa Studio, By default, only fashion_color attribute is added as a swatch attribute. So if your website has custom attributes as a swatch then it will not display as a swatch image out of the box. So here we have come up with the solution of how you can show your custom attribute as a swatch image on product pages. For this, you need to specify your attribute in the option type array list inside
/venia-ui/lib/components/ProductOptions/getOptionType.js
Click to embrace the technological evolution with our Magento 2 PWA Theme
To achieve this first create a Venia project through scaffolding https://magento.github.io/pwa-studio/pwa-buildpack/scaffolding/ yarn create @magento/pwa
Once you have your scaffolded Venia project:
node_modules/@magento/venia-ui/lib/components/ProductOptions/getOptionType.js
We are going to add it with the help of targetable introduced in PW Studio.
Interesting Reads: Benefits of Magento PWA for eCommerce websites
Here I am taking Magento with sample data installed as a backend. So my default installation looks like this
To show the color attribute as a swatch I will add the below code in the local-intercept.js file
local-intercept.js [YOUR_PROJECT_NAME/local-intercept.js]
const { Targetables } = require('@magento/pwa-buildpack'); module.exports = targets => { const targetableFactory = Targetables.using(targets); // Create a TargetableModule instance that points to the getOptionType.js source const OptionsType = targetableFactory.module( '@magento/venia-ui/lib/components/ProductOptions/getOptionType.js' ); const instruction = { after: 'const customAttributes = {', insert: "color: 'swatch'," }; OptionsType.spliceSource(instruction); };
Get a tour of our Demo marketplace
After that run your project yarn build yarn start
Now check your product page. It should show your attribute as a swatch like this
This is the procedure that you can follow for Magento PWA Studio to add a custom attribute in PWA Studio. We hope we were able to share it in a simple way and would encourage you to give it a try.
You can expect similar articles as we want to share what we have learned, things that have made Cedcommerce what we are today.
Contact us for any related queries and we will be happy to help!
Reading Time: 3 minutesAmazon recently announced a significant change for sellers advertising in Washington state:…
Reading Time: 14 minutesBlack Friday–Cyber Monday used to be a weekend. Now it’s a pressure…
Reading Time: 2 minutesKey Updates Shopify is deprecating the “Sell from all locations to all…
Reading Time: 2 minutesWhat’s New Amazon has published a Data Processing Addendum (DPA) for Multi-Channel…
Reading Time: 2 minutesKey Highlights AI-driven traffic to U.S. retail sites will increase by 520%…
Reading Time: 3 minutesDid you know, a new one-tap ordering feature from Amazon is set…
Reading Time: 2 minutesWalmart has overtaken eBay to become the No. 2 U.S. retail eCommerce…
Reading Time: 2 minutesA new step in AI-driven commerce offers merchants direct access to hundreds…
Reading Time: 2 minutesAmazon has officially launched Amazon Haul in Spain, a budget-focused storefront designed…
Reading Time: 2 minutesOpenAI is bringing ecommerce transactions directly into ChatGPT with the debut of…
Reading Time: 2 minutesAmazon has introduced a new FBA multi-unit discount for Amazon Business orders,…
Reading Time: 2 minutesNews Summary At its recent Etsy Up event (September 2025), Etsy unveiled…
Reading Time: 2 minutesNews Summary eBay has rolled out an update that now defaults all…
Reading Time: 2 minuteseBay has announced its acquisition of Tise, a Nordic consumer-to-consumer (C2C) social…
Reading Time: 3 minutesWalmart’s seasonal practices and incentives around holiday shipping have evolved, impacting seller…
Reading Time: 2 minutesAmazon has revised its variation themes policy for 2025. Instead of removing…
Reading Time: 8 minutesEvery sale you make online in the UK comes with a cut.…
Reading Time: 3 minutesHeads-up: eBay is changing what U.S. personal and financial data appears in…
Reading Time: 2 minutesAmazon has expanded Multi-Channel Fulfilment (MCF) and the broader Supply Chain by…
Reading Time: 9 minutesIt’s mid-October. The whiteboard is covered in timelines, SKU codes, and a…