Connect with us


Your Essential Guide to Dropshipping Eco-Friendly Products



Your Essential Guide to Dropshipping Eco-Friendly Products

The world is changing, and many shoppers want to do their part in saving the environment. Because of this, it is a wonder whether or not dropshipping eco-friendly products is a good idea. If so, how do you do it right? 

Today, I will share what I learned about dropshipping organic and holistic products over the past few years. You can expect to have all your questions answered today. 

Here are what you will learn: 

  • Determine if there is a market for eco-friendly dropshipping niche
  • Find out what eco-friendly products have huge potential revenue
  • Get to know a selection of the best dropshipping suppliers of eco-friendly products 

Ready? Let us start!

Key Takeaways

  • There is a big market for eco-friendly products
  • This niche has its own challenges that are solvable
  • Not all eco-friendsly products are sustainable 

Are Eco-Friendly Products a Good Dropshipping Niche?

Eco-friendly products, or green technology, are excellent for dropshipping. The global market for this niche will be USD 46.54 billion in 2022 [1]. By 2030, experts agree that this industry will reach a revenue of USD 417.35 billion.

I recommend starting your dropshipping store in this niche as early as now. You want to be one of the first people to dominate the market.

Why is this niche growing? It is growing because there is a strong drive for it. Emissions continue to rise, and we want to reduce our carbon footprint. If we do not do this now, we will pollute our environment. 


However, there are challenges and risks in dropshipping green or holistic products, which I will describe in detail in the next section.

What Are the Risks of Dropshipping Eco-Friendly Products? 

Before you start dropshipping eco-friendly products, it makes perfect sense to understand what the risks are. I can say from experience that green tech is much harder to sell than brand-new or conventional items. 

I am not trying to discourage you—all I am saying is that you will be in for a wild ride. One may think that green tech or eco-friendly products have a market, but then you’d be surprised that it is difficult to convince people to buy your goods.  

Here are the three main risks of dropshipping eco-friendly products:  

  • Cost of Goods
  • Negative Associations
  • Not Aesthetically Pleasing

Allow me to discuss each one in detail. 

1. Cost of Goods 

The cost of recycled products is much higher than brand-new ones. Recycling costs money for several reasons. First, you need a special plant or manufacturing process. In addition, there are steps in the recycling process that make the entire ordeal expensive. 

For example, the cost start with paying people to gather and sort recyclable materials. Next, you must sanitize the recyclable products several times more than usual or typical manufacturing. 


All these lead to bigger capital. When you dropship these items, the product costs more than something similar to the normal manufacturing process. 

THE SOLUTION: Appeal to Emotion

The only reason we recycle is to save the planet. That in itself must be your slogan. You want your customers to feel “guilty” about what is happening on earth.

The trick to doing this is in your hero banner on your home page and the product pages. You have to tell the viewer how the product helps the environment. 

For example, you can say that “people waste millions of plastic bottles per year. There are tons of plastic wastes in our ocean. Products like this reduce the ocean waste by XXX%,” or something like that 

2. Negative Associations

People think that recycled products are not as sturdy or reliable. Many people are not interested in buying green products because they doubt the performance ability of recycled goods. 

Given the high cost of eco-friendly dropshipping products, a customer would think that there is no practical reason to spend so much money on something that is not reliable. 


THE SOLUTION: Educate the Byer

It is not true that organic or sustainable dropshipping products are less effective than their brand-new counterparts. This notion is nothing more than perception. As such, the only solution is education. 

You must tell the buyer that the product on your site is sturdy, effective, and reliable. It would help if you made it a point to describe your product’s dependability. 

If you have to, you can say things like “better than brand-new” or “stronger than factory-made products.” I also recommend that you test the products yourself. Create videos demonstrating their effectiveness and reliability. 

3. Not Aesthetically Pleasing 

The last risk is that many recycled products are not aesthetically pleasing. It is difficult for manufacturers to design these products since their materials are old. The absence of design makes it hard to convince people to buy.   

THE SOLUTION: Print-On-Demand Dropshipping

There are companies like Printful and Printify that offer eco-friendly products. Take a look at the screenshot below: 

All these are “green” dropshipping products. The good news is that you can design them. As such, design and aesthetics are no longer a problem. The screenshot below shows how a blank white shirt can look pleasing to the eye. 


1708066563 13 Your Essential Guide to Dropshipping Eco Friendly Products

As you can see, there are challenges ahead of you if you dropship eco-friendly products. Do not let these challenges and risks scare you. Take the time to assess each risk, then create an action plan to mitigate them. 

Which Eco-Friendly Products Should I Avoid Dropshipping?

Like all niches, there are some products that you must avoid. In the eco-friendly niche, there are “trap products” that you must not sell, which I will explain in detail here.

1. Almond Milk

While this may sound like an excellent alternative to cow milk, it is not a sustainable product. You may have a market for this—lactose-intolerant people. However, its production is damaging the environment. 

Producers consume water to grow almonds and squeeze the juices out. The consequence is a drought effect. On average, it takes 15 gallons of water to produce 16 pieces of almonds. The problem is that there is little nutritional value to justify the amount of water to make it. 

2. Bamboo Fabrics

Companies are touting that bamboo is the new alternative to fabric. The common materials we use today are harmful to the environment. The proponents of bamboo fabrics say that: 

  • Bamboo is renewable
  • Bamboo does not need pesticides or chemicals to grow
  • Bamboo does not require fertilizers 

So, what is the problem? The problem is that bamboo requires a lot of energy to process into the fabric. In addition, a producer must use harsh chemicals to break down the cellulose from the bamboo plant and then turn it in t a fabric. 

It is also not true that bamboo fabrics are antimicrobial. The chemicals used to break down the cellulose eliminates the bamboo’s property to be antimicrobial. Finally, this chemical makes the bamboo fabric non-biodegradable!


3. Paper Coffee Cups and Lids

Many people think that these recycled products are great. Manufacturers make these papers out of recycled materials, right?  

Yes, but then the problem is that these cups need polyethylene coating. Because of this chemical, paper cup is not a viable item to recycle anymore.  

Where to Find the Best Dropshipping Suppliers for Eco-Friendly Products

Now, let us discuss the best places to find eco-friendly product suppliers. You must choose the right suppliers to help you grow your business.  

The best options are: 

  • Dropship supplier databases – these are systems like CJDropshipping, Spocket, Dropified, etc. Their main task is to make a marketplace where suppliers and dropshippers meet. It is also common that these companies offer integration processes where you can import products and place orders in a few clicks. 
  • Dropship product databases – we at Dropship.IO started a product database for dropshippers and retailers. We are moving into providing you with a supplier database. With our system, you can find eco-friendly products and know 
  • Direct from wholesalers – you can go to websites like Earth Hero. They sell a wide variety of eco-friendly products. However, the items they sell have a brand name—theirs—and you cannot change the brand name. 

You do not have to choose one. You can get supplies from all of these suppliers at the same time. However, I recommend starting with only one if it is your first time. 

For example, if you decide to use an app like CJDropshipping, it would help if you understand its complexities before you get supplies from wholesalers. 

Best Eco-Friendly Products to Sell

What eco-friendly products have a market? Everything. However, I can understand if people want to enter this niche with best-selling items in mind. Since there is no eco-friendly product sales stat repository, the best way to get this information is through the Amazon best-seller list. 


What I did was search for “eco-friendly” products. Then, I took a closer look at those with the most reviews. 

The best eco-friendly products to sell are: 

  • Dishcloths
  • Bamboo toilet paper
  • Reusable dishcloth
  • Travel toothpaste tablets
  • Hand towels
  • Clothes
  • Make-up remover pads
  • Rice water shampoo

Although I said bamboo products are not a good thing to dropship, it is still up to you. To some degree, you are not exaclty being unethical. It’s just that if you really think about it, bamboo products are not as eco-friendly as they seem to be. 

Many of these products have at least 1,000 reviews. If you do the same thing, you will notice that many products come from bamboo production. I advise you to avoid bamboo products if you want to be eco-friendly. 

5 Best Eco-Friendly Product Suppliers

1. Syncee

1708066563 814 Your Essential Guide to Dropshipping Eco Friendly Products

Syncee is a dropship supplier database and application. You can integrate the system with several platforms and work with different suppliers. I recommend Syncee because it offers high-quality, premium products. They also regulate their suppliers, ensuring that you receive appropriate support. 

In addition, the platform offers an auto-order sync feature. With it, the system will place orders on your behalf once a customer places them in your store. You do not have to order them manually from the dashboard. 

Syncee Features

  • Integration – you can integrate Syncee with Shopify, Squarespace, Wix, EKM, and many more. After the integration, you can import the products from Syncee to your store in a few clicks. 
  • Eco-Friendly – Syncee has a division or category of products made from sustainable processes and materials. They offer eco-friendly products from brands like The Natural Spa, Plantish, and Korissa. 
  • International Suppliers – it is always easier to dropship if the product comes from the same location as the shipping destination. Syncee has US, Canada, EU, UK, and Australian suppliers. 

Syncee Pros

  • The app is easy to use
  • Integration is possible with many platforms
  • You can contact the suppliers directly 
  • There are no transaction fees

Syncee Cons

  • You must upgrade to benefit from the system fully 

Use Syncee if you want a system that allows you to sell many products. Syncee’s listing has more than 6 million products. The system also auto-updates, meaning you do not have to update each product manually if there is a change. 

2. Printify 

1708066563 788 Your Essential Guide to Dropshipping Eco Friendly Products

Printify is a print-on-demand company. They work with suppliers of blank products from several countries. You would make a design on these blank products and sell them in your online store. I recommend Printify because they allow you to sell unique products. 

Printify Features

  • Free Design Tool – you can use the free design tool to upload your graphics and “embed” them on the blank products. You do not need another software like Photoshop or GIMP to create the mock-up. 
  • Eco-Friendly Products – Pritnfiy works with several suppliers. There are over 800 products on the site, several of which are sustainable. For example, you can find items like eco-friendly shirts and bento boxes. 
  • Integrations – you can integrate the system with Shopify, Woocommerce, and other platforms. The integration means that you can import your Printify products into different stores. The platform also works with Etsy. 

Printify Pros

  • Printify offers hundreds of products that you can design
  • It is possible to transfer the production to another supplier if your current one is out of stock
  • You can get a discount if you upgrade; if you do, you can buy the items for 20% less than the usual listed price

Printify Cons 

  • You need to subscribe to a third-party provider to get more mock-ups

Printify is what you need to sell goods with unique designs. It is not likely that your products would have duplicates unless you used graphic art that is accessible to other people. 

3. Printful 

1708066564 2 Your Essential Guide to Dropshipping Eco Friendly Products

Printful is another POD company. The way this system works is the same as Printify. The difference is that with Printful, it is easier to create white-label products. 

Printful also offers several types of printing techniques. They have direct-to-garment, all-over printing, and embroidery. However, the embroidery option is only available to paying subscribers. 

Printful Features

  • Warehouse Service – if you buy in bulk, you can ask Printful to store your goods in their warehouse. If a customer orders, they will take care of the fulfillment or shipping. The warehouse service is not free. The cost depends on the size and number of your products. 
  • Auto-Import – after designing your products, you can easily move them to your online store. You can create one product and then import that to different stores, too. 
  • Integrations – you can integrate Printful with over a dozen platforms. You can also use Printful to sell merch on social media channels like TikTok and YouTube. 

Printful Pros

  • Lots of products to choose from
  • Multiple integration possibilities
  • They offer warehouse and fulfillment services

Printful Cons

  • The custom packing and branding services are only available to upgraded accounts

Use Printful if you want to start a huge dropshipping business. They have several eco-friendly dropshipping products like hoodies for kids, and adults, tote bags, and sweatshirts. Printful is excellent if you want to order in bulk.

4. AppScenic

1708066564 46 Your Essential Guide to Dropshipping Eco Friendly Products

AppScenic is a trusty dropshipping supplier database for eco-friendly products. I recommend this application because they have a dedicated list of suppliers for the niche we want to target. They offer free trial, plus they have global suppliers. 

AppScenic Features

  • Verified Suppliers – companies cannot just register for an account here. AppScenic puts them through the test, and the suppliers must maintain a reasonable rating. The suppliers here have close to zero rate of return, and all of them offer fast shipping. 
  • Integrations – you can integrate AppScenic with Shopify, WooCommerce, Wix, and eBay. 
  • Academy – they recently released ana academy where you can learn about the best tis to succeed in dropshipping. There are over 80 lessons and 12 hours of video content on this learning platform. 

AppScenic Pros

  • All suppliers on the platform are reliable
  • The system integrates with major e-commerce platforms
  • You can automate the entire dropshipping process

AppScenic Cons

  • You have to pay to use the system; the free account only allows you to browse

AppScenic is what I recommend if you use Shopify and WooCommerce. Although it does not integrate with a lot of stores, the system works perfectly well for these two platforms. 

5. CJDropshipping

1708066564 11 Your Essential Guide to Dropshipping Eco Friendly Products

The last on our list is CJDropshipping, a Chinese dropshipping supplier database. Although their main office is in China, they have warehouses globally. I recommend CJDropshipping because there are hundreds of thousands of products here, including eco-friendly ones.

CJDropshipping Features

  • Warehouses – the company now has warehouses in Germany, the US, Canada, Italy, Poland, and other countries. It means that you can dropship eco-friendly products from many shipping locations.
  • Integrations – you can integrate CJDropshipping with platforms like Lazada, Shopify, eBay, Etsy, Wix, and TikTok. 
  • Print-on-Demand – the company works with a third-party POD provider. You can use this company as a source for eco-friendly POD products. 

CJDropshipping Pros

  • Lots of products to choose from
  • Easy integration with several platforms
  • The system is completely free to use

CJDropshipping Cons

  • Most suppliers are from China, so shipping can take a while 

Use CJDropshipping if you want to dropship to the Asian market. Although CJ has warehouses in Europe and North America, the system does not tell where the products are. As such, it can be a good international dropshipping supplier, but you do not know where the products sit.

Successful Eco-Friendly Product Dropshipping Store Examples

If you want inspiration, I looked for some of the best and most successful dropshipping stores in the eco-friendly niche. These two are Taylor Stitch and Notebook Therapy.


Taylor Stitch

1708066564 309 Your Essential Guide to Dropshipping Eco Friendly Products

One of the biggest sellers of eco-friendly clothing is Taylor Stitch. They sell men’s clothing. While they are not dropshipper in a traditional sense, they still source their products from third-party providers. I can say from their website that they are a private-label company. 

Here are the items they sell:

  • Sweaters
  • Denim
  • Footwear
  • Flannels
  • Bottoms

Taylor Stitch sells around $400,000 per week. On slow days, they sell 13 items in a day. On fast days, they sell as many as  572 units in a day!

1708066564 870 Your Essential Guide to Dropshipping Eco Friendly Products

As a dropshipper, competing against a giant like this is not easy. However, you can always use the route to print-on-demand (POD)and look for eco-friendly products. The two most effective POD suppliers I can recommend are Printify and Printful.

Notebook Therapy

1708066564 657 Your Essential Guide to Dropshipping Eco Friendly Products

Notebook Therapy sells East Asian stationery. Its top-selling products are the Tsuki Pop-Up Pencil and the Tote Bag. If you want to sell tote bags, I can say that you can find eco-friendly versions of these in Printify.  

Today, this company has more than one million followers on social media. Their following is the key to their success. As a dropshipper, it would also help if you amassed a huge following. If people follow you, they will buy from you eventually. 

Notebook Therapy has a massive presence on Instagram. They sell around $64,000 worth of goods in a week!

1708066564 445 Your Essential Guide to Dropshipping Eco Friendly Products

Right now, these two are the biggest and most successful. As you can see, the eco-friendly trend is not competitive. It is why today is the best time to do it!

Eco-Friendly Product Dropshipping Globally 

There are no issues when shipping eco-friendly products on a global scale. The only thing I advise you not to sell is food or anything related to food, medication, and food supplements. 

We discussed these countries in another blog post, particularly this one: does it make sense to dropshipping kitchen products?

However, you must know that some countries are not particularly environmentally friendly. These are: 

  • Liberia
  • Myanmar
  • Afghanistan
  • Sierra Leone
  • Côte d’Ivoire (Ivory Coast)
  • Guinea
  • Madagascar
  • The Solomon Islands
  • Chad
  • Haiti

One can say that most of these countries are financially struggling. Knowing that eco-friendly products are expensive, I advise you not to target countries that are still “developing.” Most people there do not have the financial capacity to pay for something expensive when they could easily get the same thing for a lower price.

Dropshipping Eco-Friendly Products FAQ

Is Dropshipping Environmentally friendly?

Yes and no. Anything that requires fuel to ship is not environmentally friendly. If you dropship, a person who orders only pays for one item, which takes a delivery person to spend power, energy, etc. It is not eco-friendly because it is better if someone just went to a mall and bought many things.

What products are most successful in dropship?

There is no magic list of products that will make you successful in dropshipping. There are dropshipping products that are trending, which you can sell. However, the success of dropshipping relies on your knowledge of marketing.

What eco-friendly products to sell?

There are many eco-friendly products that you can sell, such as recycled shoes, clothing, reusable eyepatches, beeswax wrap, natural cleaning products, etc. 

How do I find eco-friendly suppliers?

For starters, use our list in this article. After checking their sites, you can visit Dropship.IO to look for products. You can find eco-friendly products and their respective suppliers in our database.


The next thing I suggest you do now is to checki the suppliers I recommend. Go to their respective websites by clicking on the links I provided. Search for products, then decide if you want to use that supplier. 

Alternatively, you can also use our product database, Dropship.IO, for free for seven days. Search our product database, learn about your competition, and track their sales performance! 


Happy dropshipping!

Source link

Keep an eye on what we are doing
Be the first to get latest updates and exclusive content straight to your email inbox.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address


10 Amazing WordPress Design Resouces – News




10 Amazing WordPress Design Resouces – News

Whether you’re a design pro or a total newbie, you’ll find a great tool in this list that will take your website skills to the next level.

Designing a beautiful website from scratch can be difficult for developers of all skill levels. Luckily, in today’s Build and Beyond video, Jamie Marsland reveals his ten favorite WordPress design tools and websites to elevate your next build.

Get inspiration for your next website’s design and then start building with Ready to get going? Click below to embark on your free trial today:

Here are the sites and resources mentioned in the video:

1713497163 978 10 Amazing WordPress Design Resouces – WordPresscom News


Stunning backgrounds and visuals

1713497163 497 10 Amazing WordPress Design Resouces – WordPresscom News
1713497163 315 10 Amazing WordPress Design Resouces – WordPresscom News
1713497163 599 10 Amazing WordPress Design Resouces – WordPresscom News
1713497163 270 10 Amazing WordPress Design Resouces – WordPresscom News


Easy mockups for products and thumbnails

1713497163 518 10 Amazing WordPress Design Resouces – WordPresscom News
1713497163 631 10 Amazing WordPress Design Resouces – WordPresscom News


Generate color palettes with a click

1713497163 689 10 Amazing WordPress Design Resouces – WordPresscom News
1713497163 719 10 Amazing WordPress Design Resouces – WordPresscom News
10 Amazing WordPress Design Resouces – WordPresscom News

Join 110.1M other subscribers


Source link

Keep an eye on what we are doing
Be the first to get latest updates and exclusive content straight to your email inbox.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address
Continue Reading


[GET] The7 Website And Ecommerce Builder For WordPress




The7 website and ecommerce builder for wordpress is the most customizable WordPress, Elementor, and WooCommerce theme available on the market up to …

Source link

Keep an eye on what we are doing
Be the first to get latest updates and exclusive content straight to your email inbox.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address
Continue Reading


Making 43% of the Web More Dynamic with the WordPress Interactivity API – News




Making 43% of the Web More Dynamic with the WordPress Interactivity API – News

Creating rich, engaging, and interactive website experiences is a simple way to surprise, delight, and attract attention from website readers and users. Dynamic interactivity like instant search, form handling, and client-side “app-like” navigation where elements can persist across routes, all without a full page reload, can make the web a more efficient and interesting place for all.

But creating those experiences on WordPress hasn’t always been the easiest or most straightforward, often requiring complex JavaScript framework setup and maintenance. 

Now, with the Interactivity API, WordPress developers have a standardized way for doing that, all built directly into core. 

The Interactivity API started as an experimental plugin in early 2022, became an official proposal in March 2023, and was finally merged into WordPress core with the release of WordPress 6.5 on April 2, 2024. It provides an easier, standardized way for WordPress developers to create rich, interactive user experiences with their blocks on the front-end.

ELI5: The Interactivity API and the Image Block

Several core WordPress blocks, including the Query Loop, Image, and Search blocks, have already adopted the Interactivity API. The Image block, in particular, is a great way to show off the Interactivity API in action. 


At its core, the Image blocks allow you to add an image to a post or page. When a user clicks on an image in a post or page, the Interactivity API launches a lightbox showing a high-resolution version of the image.

The rendering of the Image block is handled server-side. The client-side interactivity, handling resizing and opening the lightbox, is now done with the new API that comes bundled with WordPress. You can bind the client-side interactivity simply by adding the wp-on--click directive to the image element, referencing the showLightbox action in view.js.

You might say, “But I could easily do this with some JavaScript!” With the Interactivity API, the code is compact and declarative, and you get the context (local state) to handle the lightbox, resizing, side effects, and all of the other needed work here in the store object.

actions: {
			showLightbox() {
				const ctx = getContext();

				// Bails out if the image has not loaded yet.
				if ( ! ctx.imageRef?.complete ) {

				// Stores the positons of the scroll to fix it until the overlay is
				// closed.
				state.scrollTopReset = document.documentElement.scrollTop;
				state.scrollLeftReset = document.documentElement.scrollLeft;

				// Moves the information of the expaned image to the state.
				ctx.currentSrc = ctx.imageRef.currentSrc;
				imageRef = ctx.imageRef;
				buttonRef = ctx.buttonRef;
				state.currentImage = ctx;
				state.overlayEnabled = true;

				// Computes the styles of the overlay for the animation.

The lower-level implementation details, like keeping the server and client side in sync, just work; developers no longer need to account for them.

This functionality is possible using vanilla JavaScript, by selecting the element via a query selector, reading data attributes, and manipulating the DOM. But it’s far less elegant, and up until now, there hasn’t been a standardized way in WordPress of handling interactive events like these.

With the Interactivity API, developers have a predictable way to provide interactivity to users on the front-end. You don’t have to worry about lower-level code for adding interactivity; it’s there in WordPress for you to start using today. Batteries are included.


How is the Interactivity API different from Alpine, React, or Vue?

Prior to merging the Interactivity API into WordPress core, developers would typically reach for a JavaScript framework to add dynamic features to the user-facing parts of their websites. This approach worked just fine, so why was there a need to standardize it?

At its core, the Interactivity API is a lightweight JavaScript library that standardizes the way developers can build interactive HTML elements on WordPress sites.

Mario Santos, a developer on the WordPress core team, wrote in the Interactivity API proposal that, “With a standard, WordPress can absorb the maximum amount of complexity from the developer because it will handle most of what’s needed to create an interactive block.”

The team saw that the gap between what’s possible and what’s practical grew as sites became more complex. The more complex a user experience developers wanted to build, the more blocks needed to interact with each other, and the more difficult it became to build and maintain sites. Developers would spend a lot of time making sure that the client-side and server-side code played nicely together.

For a large open-source project with several contributors, having an agreed-upon standard and native way of providing client-side interactivity speeds up development and greatly improves the developer experience.

Five goals shaped the core development team’s decisions as they built the API: 

  1. Block-first and PHP-first: Prioritizing blocks for building sites and server side rendering for better SEO and performance. Combining the best for user and developer experience.
  2. Backward-compatible: Ensuring compatibility with both classic and block themes and optionally with other JavaScript frameworks, though it’s advised to use the API as the primary method. It also works with hooks and internationalization.
  3. Declarative and reactive: Using declarative code to define interactions, listening for changes in data, and updating only relevant parts of the DOM accordingly.
  4. Performant: Optimizing runtime performance to deliver a fast and lightweight user experience.
  5. Send less JavaScript: Reduce the overall amount of JavaScript being sent on the page by providing a common framework that blocks can reuse.  So the more that blocks leverage the Interactivity API, the less JavaScript will be sent overall.

Other goals are on the horizon, including improvements to client-side navigation, as you can see in this PR.

Interactivity API vs. Alpine

The Interactivity API shares a few similarities to Alpine—a lightweight JavaScript library that allows developers to build interactions into their web projects, often used in WordPress and Laravel projects.

Similar to Alpine, the Interactivity API uses directives directly in HTML and both play nicely with PHP. Unlike Alpine, the Interactivity API is designed to seamlessly integrate with WordPress and support server-side rendering of its directives.

With the interactivity API, you can easily generate the view from the server in PHP, and then add client-side interactivity. This results in less duplication, and its support in WordPress core will lead to less architectural decisions currently required by developers. 

So while Alpine and the Interactivity API share a broadly similar goal—making it easy for web developers to add interactive elements to a webpage—the Interactivity API is even more plug-and-play for WordPress developers.

Interactivity API vs. React and Vue

Many developers have opted for React when adding interactivity to WordPress sites because, in the modern web development stack, React is the go-to solution for declaratively handling DOM interactivity. This is familiar territory, and we’re used to using React and JSX when adding custom blocks for Gutenberg.

Loading React on the client side can be done, but it leaves you with many decisions: “How should I handle routing? How do I work with the context between PHP and React? What about server-side rendering?”


Part of the goal in developing the Interactivity API was the need to write as little as little JavaScript as possible, leaving the heavy lifting to PHP, and only shipping JavaScript when necessary.

The core team also saw issues with how these frameworks worked in conjunction with WordPress. Developers can use JavaScript frameworks like React and Vue to render a block on the front-end that they server-rendered in PHP, for example, but this requires logic duplication and risks exposure to issues with WordPress hooks.

For these reasons, among others, the core team preferred Preact—a smaller UI framework that requires less JavaScript to download and execute without sacrificing performance. Think of it like React with fewer calories.

Luis Herranz, a WordPress Core contributor from Automattic, outlines more details on Alpine vs the Interactivity API’s usage of Preact with a thin layer of directives on top of it in this comment on the original proposal.

Preact only loads if the page source contains an interactive block, meaning it is not loaded until it’s needed, aligning with the idea of shipping as little JavaScript as possible (and shipping no JavaScript as a default).

In the original Interactivity API proposal, you can see the run-down and comparison of several frameworks and why Preact was chosen over the others.


What does the new Interactivity API provide to WordPress developers?

In addition to providing a standardized way to render interactive elements client-side, the Interactivity API also provides developers with directives and a more straightforward way of creating a store object to handle state, side effects, and actions.

Graphic from Proposal: The Interactivity API – A better developer experience in building interactive blocks on


Directives, a special set of data attributes, allow you to extend HTML markup. You can share data between the server-side-rendered blocks and the client-side, bind values, add click events, and much more. The Interactivity API reference lists all the available directives.

These directives are typically added in the block’s render.php file, and they support all of the WordPress APIs, including actions, filters, and core translation APIs. 

Here’s the render file of a sample block. Notice the click event (data-wp-on--click="actions.toggle"), and how we bind the value of the aria-expanded attributes via directives.

	<?php echo get_block_wrapper_attributes(); ?>
	<?php echo wp_interactivity_data_wp_context( array( 'isOpen' => false ) ); ?>
		aria-controls="<?php echo esc_attr( $unique_id ); ?>"
		<?php esc_html_e( 'Toggle', 'my-interactive-block' ); ?>

		id="<?php echo esc_attr( $unique_id ); ?>"
			esc_html_e( 'My Interactive Block - hello from an interactive block!', 'my-interactive-block' );

Do you need to dynamically update an element’s inner text? The Interactivity API allows you to use data-wp-text on an element, just like you can use v-text in Vue.

You can bind a value to a boolean or string using wp-bind– or hook up a click event by using data-wp-on–click on the element. This means you can write PHP and HTML and sprinkle in directives to add interactivity in a declarative way.


Handling state, side effects, and actions

The second stage of adding interactivity is to create a store, which is usually done in your view.js file. In the store, you’ll have access to the same context as in your render.php file.

In the store object, you define actions responding to user interactions. These actions can update the local context or global state, which then re-renders and updates the connected HTML element. You can also define side effects/callbacks, which are similar to actions, but they respond to state changes instead of direct user actions.

import { store, getContext } from '@wordpress/interactivity';

store( 'create-block', {
	actions: {
		toggle: () => {
			const context = getContext();
			context.isOpen = ! context.isOpen;
	callbacks: {
		logIsOpen: () => {
			const { isOpen } = getContext();
			// Log the value of `isOpen` each time it changes.
			console.log( `Is open: ${ isOpen }` );
} );

Try it out for yourself

The Interactivity API is production-ready and already running on! With any plan, you’ll have access to the core blocks built on top of the Interactivity API. 

If you want to build your own interactive blocks, you can scaffold an interactive block by running the below code in your terminal:

npx @wordpress/create-block@latest my-interactive-block --template @wordpress/create-block-interactive-template 

This will give you an example interactive block, with directives and state handling set up. 

You can then play around with this locally, using wp-env, using a staging site, or by uploading the plugin directly to your site running a plugin-eligible plan


If you want a seamless experience between your local dev setup and your site, try using it with our new GitHub Deployments feature! Developing custom blocks is the perfect use case for this new tool.

The best way to learn something new is to start building. To kick things off, you may find the following resources a good starting point:

Join 106.9M other subscribers

Source link

Keep an eye on what we are doing
Be the first to get latest updates and exclusive content straight to your email inbox.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address
Continue Reading


Follow by Email