Is WordPress Good for E-commerce? [Pros & Cons]

Ever wondered how online shopping has become such a seamless part of our lives? The answer lies in the significance of e-commerce websites. These platforms have transformed the way businesses connect with customers globally. Now, imagine a tool that simplifies the process of creating these online stores. Meet WordPress, an all-in-one platform that started as a blogging tool and has evolved into so much more.

Let’s explore why e-commerce matters and how WordPress makes it accessible for everyone.

Table of Contents

Why Choose WordPress for E-commerce?

WordPress is a popular choice for e-commerce development for several reasons beyond its pros. Businesses choose WordPress for e-commerce primarily because it’s widely trusted and used.

Many people find it easy to navigate and manage their online shops without needing advanced technical skills. WordPress’s popularity means there’s abundant support available online and numerous plugins and themes to customize their stores as needed. This simplicity and accessibility make it an attractive choice for businesses looking to enter or expand the e-commerce market. If you are considering building your online store, a reputable web development company can help you leverage WordPress to its fullest potential.

5 Pros of Using WordPress for E-commerce

Let’s explore pros of using WordPress and why it’s the platform of choice for building and growing successful e-commerce websites.

#1 Free to Use

WordPress is an open-source platform, which means it’s free to use. This significantly reduces the initial investment required to set up your online store. With cost-effective hosting options available, even small businesses or individuals with limited budgets can establish a professional e-commerce presence.

#2 Extensive Themes & Plugins

The vast library of WordPress themes allows you to customize the look and feel of your online store according to your brand. Additionally, the availability of plugins, especially the widely-used WooCommerce, provides diverse e-commerce functionalities.

#3 User-Friendly Interface

WordPress is renowned for its user-friendly interface, making it accessible to users with varying levels of technical expertise. Managing products, updating content, and handling day-to-day operations can be done effortlessly through the intuitive dashboard.

This ease of use ensures that you can focus on your products and customers instead of grappling with complex technicalities.

#4 SEO-Friendly Structure

WordPress is inherently designed with search engine optimization (SEO) in mind. Its clean and structured code, along with customizable permalinks, allows search engines to crawl and index your e-commerce site efficiently.

This SEO-friendly foundation enhances your website’s visibility, helping potential customers find your products more easily.

#5 Community Support & Regular Updates

WordPress is surrounded by a vibrant and engaged community of developers, designers, and users. This community support ensures that you have access to a wealth of resources, forums and documentation.

Regular updates and improvements to the core software and plugins enhance security, performance, and features, keeping your e-commerce site up-to-date and secure.

Cons of Using WordPress for E-commerce

While WordPress offers numerous advantages for e-commerce development, it’s also essential to consider some potential drawbacks as well.

Security Vulnerabilities

One of the primary concerns with WordPress is its susceptibility to security vulnerabilities. Since it’s an open source platform with a vast ecosystem of plugins and themes, there’s a risk of security breaches if these components are not regularly updated or if malicious code is introduced.

While WordPress itself prioritizes security updates, site owners must stay vigilant and implement additional security measures such as firewalls, malware scanning, and strong password policies to mitigate risks.

Performance Optimization Challenges

As an inherently dynamic platform, WordPress websites can sometimes face performance optimization challenges, especially as the site grows in complexity or experiences increased traffic. Factors such as inefficient coding, resource-heavy plugins, and unoptimized media files can impact site speed and responsiveness.

Addressing performance issues may require technical expertise and careful optimization strategies, which can be time-consuming and complex for inexperienced users.

Updates Issues

While regular updates are essential for keeping your WordPress site secure and functioning optimally, they can also pose challenges in terms of maintenance. Managing updates for the WordPress core, themes, and plugins requires diligence and can sometimes lead to compatibility issues or conflicts between different components.

Site owners must allocate time and resources to stay on top of updates, test compatibility, and ensure seamless functionality, which can be burdensome for individuals or small businesses without dedicated technical support.

WordPress E-commerce Solutions

WordPress offers various e-commerce solutions to cater to different business needs and preferences. These e-commerce plugins provide a range of features and functionalities to help businesses create and manage online stores effectively.

Depending on your specific requirements, budget, and technical expertise, you can choose the solution that best fits your needs and integrates seamlessly with your WordPress website.

Some of the most popular e-commerce solutions available in WordPress include:


WooCommerce is the most widely used e-commerce plugin for WordPress. It transforms your WordPress website into a fully functional online store with features like product listings, shopping cart, checkout process, payment gateways integration, and inventory management. WooCommerce is highly customizable, with a vast ecosystem of themes and extensions to enhance its functionality.

Easy Digital Downloads (EDD)

Easy Digital Downloads is a specialized e-commerce plugin designed for selling digital products such as software, ebooks, music, and videos. It provides features tailored to digital sales, including file downloads, product licensing, customer management, and integration with payment gateways.

Shopify for WordPress

Shopify for WordPress allows you to integrate your existing WordPress website with Shopify’s e-commerce platform. This integration enables you to leverage Shopify’s powerful e-commerce features, including product management, order processing, and payment processing, while maintaining your WordPress site’s design and content management capabilities.

BigCommerce for WordPress

BigCommerce for WordPress is another integration option that combines the flexibility of WordPress with the robust e-commerce features of BigCommerce.

With this integration, you can create a seamless online shopping experience by leveraging BigCommerce’s advanced product catalog, multi-channel selling capabilities, and built-in marketing tools within your WordPress site.

Ecwid E-commerce Shopping Cart

Ecwid is a versatile e-commerce solution that integrates seamlessly with WordPress through a plugin. It allows you to add a full-featured online store to your WordPress site, complete with product listings, shopping cart, and checkout process.

Ecwid supports various payment gateways and shipping options, making it suitable for small businesses and individuals looking to start selling online quickly.

WP eCommerce

WP eCommerce is another e-commerce plugin for WordPress that offers a range of features for creating and managing online stores. It includes customizable themes, product variations, shipping options, and payment gateways integration.

WP eCommerce is suitable for businesses of all sizes, from small startups to large enterprises.

How to Set Up an E-commerce Website with WordPress?

Starting an e-commerce business with WordPress involves several key steps to ensure a successful launch.

1. Define Your Business Idea and Niche:

  • Identify the products or services you want to sell and determine your target audience.
  • Research your niche market to understand customer needs, competition, and potential demand.

2. Choose a Domain Name and Hosting Provider:

  • Select a domain name that reflects your brand and is easy to remember.
  • Choose a reliable hosting provider that offers WordPress-compatible hosting plans.

3. Install WordPress:

  • Sign up for a hosting plan that includes a one-click WordPress installation option.
  • Follow the hosting provider’s instructions to install WordPress on your domain.

4. Select a Theme for Your Online Store:

  • Choose a WordPress theme that is optimized for e-commerce and aligns with your brand identity.
  • Consider factors such as design, customization options, and mobile responsiveness.

5. Install an E-commerce Plugin:

  • Install a robust e-commerce plugin such as WooCommerce, Easy Digital Downloads, or WP eCommerce.
  • Follow the plugin’s setup wizard to configure essential settings such as currency, payment gateways, and shipping options.

6. Customize Your Store:

  • Customize your website’s appearance and layout using the theme’s customization options.
  • Add your logo, branding elements, and high-quality product images to enhance visual appeal.

7. Add Products and Categories:

  • Create product listings for your inventory, including detailed descriptions, prices, and images.
  • Organize your products into categories and subcategories to make navigation easier for customers.

8. Set Up Payment Gateways:

  • Integrate secure payment gateways such as PayPal, Stripe, or Square to accept online payments.
  • Configure payment settings and ensure that transactions are processed smoothly.

9. Configure Shipping Options:

  • Set up shipping methods, rates, and zones based on your business requirements.
  • Offer options such as flat-rate shipping, free shipping thresholds, or real-time carrier rates.

10. Implement Security Measures:

  • Install security plugins such as Wordfence or Sucuri to protect your website from malware, hacking attempts, and other security threats.
  • Implement SSL encryption to secure sensitive data and build trust with customers.

11. Optimize for SEO:

  • Optimize your website’s content, product descriptions, and metadata for search engines.
  • Install an SEO plugin such as Yoast SEO to help improve your site’s visibility in search engine results.

12. Test and Launch Your Store:

  • Conduct thorough testing to ensure that all website functionalities are working correctly.
  • Test the checkout process, payment gateways, and responsiveness across different devices.
  • Once you’re satisfied with the testing results, launch your e-commerce store and start promoting it to attract customers.

13. Monitor and Improve:

  • Monitor your website’s performance, traffic, and sales using analytics tools such as Google Analytics.
  • Collect feedback from customers and use it to improve your products, services, and user experience.
  • Continuously update and optimize your website to stay competitive in the ever-evolving e-commerce landscape.

By following these steps, you can start an e-commerce business with WordPress and lay a solid foundation for growth and success.

About IT Creative Labs

Ready to take your e-commerce business to the next level? Our team of expert WordPress developers at IT Creative Labs is here to help.

Whether you’re looking to create a brand-new WordPress e-commerce website, launch your online store, or redesign and optimize your existing site for better performance and SEO, we’ve got you covered.

Contact us today to discuss your project and let’s turn your e-commerce vision into reality!

Top 5 E-Commerce Trends for 2024

E-commerce has evolved from a novel convenience to an integral component of global commerce, with its trajectory shaped by rapid technological advancements and shifting consumer behaviors.

The industry is characterized by a dynamic and ever-changing landscape, which requires businesses to stay agile and proactive in embracing new trends. In this article, we’ll delve into key e-commerce trends expected for 2024, offering insights and strategies to help your business not only navigate but thrive in the evolving e-commerce arena.

Table of Contents

Trend #1. Augmented Reality (AR) Shopping Experiences

ar shopping experiences

In 2024, the integration of augmented reality (AR) into e-commerce platforms is poised to elevate the online shopping experience in profound ways. AR technologies are set to transform how consumers interact with products, fostering a more immersive and personalized connection. One significant aspect of this transformation lies in the application of AR for virtual try-ons.

AR-powered virtual try-ons will redefine the way users engage with products, particularly in the realms of fashion, accessories, and beauty. Through the lens of AR, users will be able to virtually try on clothing, accessories, and makeup in real-time. This technology leverages advanced computer vision and image recognition to overlay virtual representations of products onto the user’s physical environment.

By virtually trying on products, customers can make more informed decisions about fit, style, and appearance before committing to a purchase. This addresses a longstanding challenge in online shopping, where the inability to physically interact with products often leads to uncertainty. Also with virtual tools, users can visualize how products look individually on them based on their unique body shape, skin tone or facial features. This level of personalization fosters a stronger emotional connection between the consumer and the product.

Integration of AR technologies transcends the limitations of traditional online shopping by providing a dynamic and interactive experience that closely simulates the in-store try-on process. This not only meets the growing expectations of consumers but positions e-commerce businesses at the forefront of technological innovation in 2024.

Trend #2. Integration of Social Commerce

Social commerce has evolved into a dominant force in e-commerce, with platforms like Instagram, Facebook, and TikTok transforming into seamless shopping hubs. In 2024, businesses can leverage these platforms to reach and engage customers directly within the app, providing unparalleled convenience.

The rise of social commerce in 2024 presents unprecedented opportunities for businesses to connect with customers and facilitate transactions seamlessly. Social platforms have integrated shopping features, allowing users to make purchases without leaving the app. To maximize this trend, businesses should cultivate a strong social media presence – сraft a content strategy that incorporates product showcases, compelling videos, and collaborations with influencers to enhance visibility. Engaging with your audience through prompt responses to comments and messages builds trust and fosters a sense of community.

Furthermore, utilizing social media advertising expands your reach and promotes products effectively. By embracing social commerce, businesses can tap into an expansive pool of potential customers, driving revenue and amplifying e-commerce sales.

Trend #3. Voice Commerce

voice commerce trend 2024

In 2024, the impact of voice-activated devices, equipped with intelligent voice assistants such as Siri, Alexa, and Google Assistant, is reshaping the way consumers interact with online shopping platforms. The integration of voice technology introduces a seamless and convenient dimension to the e-commerce experience.

Voice-activated devices, ranging from smart speakers to smartphones, have become ubiquitous in households, offering users hands-free access to information and services. In the realm of e-commerce, these devices serve as virtual shopping assistants, allowing customers to navigate, explore, and make purchases using voice commands. This shift towards voice commerce streamlines the online shopping process, offering a more natural and intuitive interface for users.

Businesses embracing voice commerce can optimize their platforms to align with the preferences of a voice-activated audience. Voice assistants facilitate tasks such as product searches, order placements, and even personalized recommendations. The integration of voice technology also opens avenues for businesses to provide tailored and user-friendly experiences.

Trend #4. Same-Day and Instant Delivery

Same-day and instant delivery services aim to provide customers with unparalleled convenience, reducing the waiting time between placing an order and receiving the purchased items. This evolution in delivery services is driven by the consumer’s desire for immediacy, a trend fueled by the influence of major e-commerce players and heightened expectations set by various industries.

E-commerce platforms are now strategically partnering with local logistics providers, employing advanced route optimization algorithms, and establishing fulfillment centers in key locations to enable same-day and instant delivery. This shift not only caters to the demand for rapid order fulfillment but also enhances customer satisfaction and loyalty.

In 2024, businesses that prioritize and successfully implement these expedited delivery options are better positioned to meet the dynamic needs of modern consumers, setting a new standard for the e-commerce experience.

Trend #5. Subscription-Based Models

subscription-based model

The subscription e-commerce market is still experiencing significant growth. According to a report by McKinsey, the subscription e-commerce market has grown by over 100% annually for the past five years. In 2024, businesses will increasingly adopt subscription models, and this shift is reshaping the traditional way consumers engage with products and services. This model is characterized by customers subscribing to receive goods or services on a regular basis, whether monthly, quarterly, or annually.

For businesses, the adoption of subscription-based models brings a plethora of advantages. The predictable nature of recurring revenue from subscriptions provides a stable financial foundation, offering businesses a clearer and more sustainable revenue stream. This steady income allows for better financial planning, investment in product innovation, and overall business growth.

On the consumer front, the appeal of subscription-based models lies in the convenience, customization, and cost-effectiveness they offer. Subscribers often benefit from discounted rates, exclusive access to new products or features, and the convenience of automated deliveries. This not only enhances customer loyalty but also fosters a long-term relationship between businesses and their clientele.

Moreover, subscription models create a sense of community and engagement. Consumers feel like part of an exclusive club, enjoying a personalized and curated experience that aligns with their preferences. As the subscription-based e-commerce trend continues to gain momentum, businesses that successfully leverage this model stand to cultivate a loyal customer base and achieve sustained success in the evolving market landscape of 2024.

Shopify Experts: Unleashing E-Commerce Potential

The significance of e-commerce in modern business cannot be overstated. As businesses adapt to the evolving landscape, the digital marketplace has emerged as a fundamental driver of success. It has revolutionized customer engagement, providing unparalleled convenience and accessibility to businesses and consumers alike.

Central to this e-commerce evolution is Shopify, a platform that has seen an explosive surge in popularity. Its user-friendly interface, robust feature set, and scalability have made it a top choice for entrepreneurs and established businesses alike. With millions of online stores powered by Shopify, it’s evident that this platform has become the cornerstone of modern e-commerce.

However, navigating the intricate nuances of Shopify can be a formidable task. This is where Shopify experts come into play. These seasoned professionals possess the expertise and insight required to unlock the full potential of the Shopify platform.

In this article, we delve deeper into the world of Shopify experts and explore how their skills and guidance can propel businesses to new heights in the competitive e-commerce landscape.

Table of Contents

Who are Shopify Experts?

Shopify experts are highly skilled professionals or agencies who specialize in various aspects of the Shopify e-commerce platform. They play a pivotal role in the e-commerce ecosystem by offering their expertise to businesses looking to establish, optimize, and grow their online stores on Shopify.

Shopify experts serve as trusted partners to businesses seeking to make the most of the Shopify platform. They offer a wide range of services, from initial store setup and customization to ongoing maintenance and marketing strategies.

These experts are well-versed in the intricacies of Shopify’s tools, features, and best practices, enabling them to guide businesses through every stage of their e-commerce journey.

Qualifications & Skills of Shopify Experts

skills of shopify experts

Technical Proficiency

Shopify experts possess a deep understanding of the Shopify platform, including its backend functionality, coding languages (like HTML, CSS, and Liquid), and integrations. They can navigate and customize Shopify’s themes and templates to meet specific business needs.

Design Expertise

They have a keen eye for design, ensuring that the online store not only functions smoothly but also looks visually appealing and aligns with the brand’s identity.

E-commerce Strategy

Shopify experts are knowledgeable about e-commerce strategies, including product listings, pricing, inventory management, and conversion rate optimization. They can help businesses maximize sales and profitability.

SEO Mastery

They understand the importance of search engine optimization (SEO) in driving organic traffic to the online store. Shopify experts optimize product listings, meta descriptions, and other on-page elements to improve search engine rankings.

Marketing and Advertising

These experts are well-versed in digital marketing strategies, including social media advertising, email marketing, and pay-per-click (PPC) campaigns. They can create and manage marketing initiatives to drive traffic and sales.

Data Analysis

Shopify experts can analyze data from the platform, tracking key performance indicators (KPIs) like conversion rates, bounce rates, and customer behavior. This data-driven approach helps in making informed decisions and optimizing the store further.

Services Provided by Shopify Experts

Shopify experts offer a wide array of services tailored to businesses’ unique needs:

  • Store setup and configuration. They assist in creating and customizing Shopify stores, ensuring they are user-friendly, visually appealing, and functional.
  • Theme development and customization. Experts can either customize existing themes or develop custom themes to match a brand’s unique style and requirements.
  • App development and integration. They can build or integrate third-party apps to enhance store functionality, such as adding advanced payment options, CRM systems, or inventory management tools.
  • Marketing strategies. Shopify experts create and execute marketing plans, including content marketing, email marketing, and social media campaigns.
  • Ongoing support and maintenance. They provide ongoing support, updates, and troubleshooting to ensure the store runs smoothly and remains secure.

Why Businesses Need Shopify Experts

why businesses need shopify experts

Running a successful Shopify store involves navigating a multitude of complexities and challenges. The journey begins with configuring the store’s technical settings, integrating payment gateways, and ensuring secure transactions. While Shopify provides a user-friendly interface, businesses often find themselves in need of expert guidance to ensure a seamless setup.

Designing an appealing and brand-consistent store demands expertise in themes, imagery, and maintaining a consistent look and feel. Businesses recognize the significance of leaving a lasting impression on their customers, and Shopify experts are instrumental in crafting visually engaging storefronts that resonate with the brand’s identity.

As the product catalog grows, inventory management can become overwhelming, requiring efficient tracking and organization. Shopify experts possess the knowledge to streamline this process, ensuring that businesses can efficiently manage their expanding product ranges without the burden of manual oversight.

Achieving visibility in search engine results demands continuous SEO efforts, encompassing keyword optimization, content strategy, and link-building. Additionally, marketing campaigns, email marketing, and social media advertising are essential for attracting traffic and driving sales. Shopify experts bring invaluable expertise in digital marketing and SEO strategies, enabling businesses to improve their online visibility and effectively reach their target audience.

In essence, the complexities and challenges associated with running a Shopify store underscore the critical role of Shopify experts. These professionals possess the expertise and deep knowledge required to navigate each phase of the e-commerce journey, from store configuration to marketing strategies. Their involvement ensures that businesses can maximize their Shopify store’s potential, overcome hurdles, and ultimately thrive in the competitive e-commerce landscape.

The Benefits of Hiring Shopify Experts

Businesses looking to establish or enhance their presence on the Shopify platform often find themselves weighing the advantages of outsourcing Shopify-related tasks to experts.

Here, we explore the compelling benefits of enlisting Shopify experts for your e-commerce needs:

1. Expertise and Specialization

Outsourcing Shopify-related tasks to experts means tapping into specialized knowledge and skills. These professionals have dedicated their careers to mastering the intricacies of the Shopify platform, from technical setup to design, marketing, and SEO. Their expertise ensures that your store operates at its best, right from the start.

2. Time and Resource Efficiency

Running an e-commerce store involves numerous responsibilities that can be time-consuming and resource-intensive. Shopify experts allow businesses to focus on core operations while entrusting specialized tasks to professionals. This efficiency can significantly enhance overall productivity.

3. Cost Savings

While hiring Shopify experts incurs a cost, it can lead to substantial cost savings in the long run. These experts can help prevent costly mistakes and streamline operations, ensuring that your investment in the Shopify platform delivers a strong return.

4. Customization and Brand Alignment

Shopify experts have the skills to customize your store according to your brand’s unique identity. They can create visually appealing, brand-consistent designs that resonate with your target audience, enhancing brand recognition and trust.

5. Enhanced User Experience

A seamless and user-friendly shopping experience is crucial for customer satisfaction and retention. Shopify experts optimize the store’s user interface and navigation, making it easy for customers to browse, shop, and complete transactions.

6. Improved SEO and Visibility

Shopify experts implement effective SEO strategies, helping your store rank higher in search engine results. This increased visibility attracts organic traffic, reducing the need for costly advertising campaigns.

7. Marketing Excellence

Marketing is a key driver of e-commerce success. Shopify experts develop and execute tailored marketing strategies, leveraging their expertise in digital advertising, email marketing, and social media to attract and retain customers.

How to Choose the Right Shopify Expert

shopify experts in nyc

Selecting the right Shopify expert is a critical decision for businesses looking to optimize their e-commerce operations. To make an informed choice, consider the following factors and guidelines when evaluating potential candidates:

Experience and Expertise

Look for Shopify experts with a proven track record and years of experience working with the platform. An established presence suggests reliability and expertise.

Portfolio and Case Studies

Examine the expert’s portfolio to evaluate the quality and diversity of their previous Shopify projects. Pay attention to design aesthetics, functionality, and successful outcomes.

Also, you can inquire about specific case studies or success stories related to their previous clients. These examples can provide insights into their problem-solving abilities and ROI-driven results.

Client Reviews and Testimonials

Check for reviews and testimonials on platforms like Google, Yelp, or social media. Assess the overall sentiment and whether clients were satisfied with the expert’s services.

Don’t hesitate to request references from the Shopify expert. Speaking directly with past clients can provide a more comprehensive understanding of their work and professionalism.

Pricing and Value

Seek Shopify experts who provide transparent pricing structures. Understand what services are included and whether there are additional fees for ongoing support or revisions.

While cost is a factor, prioritize value over the lowest price. Consider how the expert’s services align with your business goals and the potential return on investment (ROI) they can offer.

Communication and Collaboration

Assess the expert’s communication skills and responsiveness. Effective communication is vital for conveying your goals and expectations. Look for an expert who is willing to collaborate with your team and involve you in the decision-making process. A collaborative approach often leads to better results.

Wrapping Up

E-commerce is a dynamic arena characterized by rapid technological advancements and shifting consumer preferences. When it comes to establishing and expanding your online store, it’s imperative to recognize the critical role of Shopify experts. Staying competitive requires a commitment to adapt and innovate continuously.

Shopify experts are invaluable partners for businesses seeking to maximize their e-commerce success. Their specialized knowledge, technical expertise, and strategic insights help navigate the complexities of the Shopify platform.

Beyond initial setup, ongoing support and maintenance are crucial for sustaining e-commerce success. Shopify experts provide the technical updates, performance optimization, and marketing strategies needed to thrive.

Looking for Shopify Experts in NYC?

At IT Creative Labs, we understand the intricate world of e-commerce and Shopify like no other. Our team of seasoned Shopify experts is ready to help you navigate the ever-evolving landscape of online retail. Whether you need design enhancements, technical support, or a comprehensive e-commerce strategy, we’ve got you covered.

Unlock your online store’s full potential with IT Creative Labs. Contact us today to embark on a journey of e-commerce excellence!

Connect to WooCommerce Rest API using Javascript

Do you  know, how to get data from WooCommerce via Rest API from the client, using JavaScript? Surprisingly, tutorials on this delicate subject are seldom found on page one of search results. Moreover, as of the moment of this writing WooCommerce documentation is also missing this information.

Warning: It is never a good idea to expose API authentication credentials.

Nevertheless, in rare cases when you do end up using this frivolous setup in production, make sure that your API key is for read only.

Below are a couple working code snippets – one using jQuery and one using vanilla async/await. Both get the job done:

const wooClientKey = 'ck_00000000000000000000000000';
const wooClientSecret = 'cs_00000000000000000000000000';
const wooUrl = '';

function basicAuth(key, secret) {
    let hash = btoa(key + ':' + secret);
    return "Basic " + hash;

let auth = basicAuth(wooClientKey, wooClientSecret);

function getData(url) {
        url: url,
        method: 'GET',
        beforeSend: function (req) {
            req.setRequestHeader('Authorization', auth);
        .done(function (data) {
            return data;


While the code itself is fairly self explanatory, here’s a quick step by step breakdown:


The “consts” are merely script settings, which one can generate from within their WooCommerce  API section (WP Admin area).


This is a helper function, introduced for clarity.

The “Basic” HTTP authentication scheme transmits access credentials – username and password, encoded using base64 (defined in RFC 7617).

Thus, all basicAuth does is uses btoa() method to create a base64 encoded ASCII string  (<key>: <secret>) and return the resulting hash along with the “Basic” identifier.

Vanilla Javascript

const wooClientKey = 'ck_00000000000000000000000000';
const wooClientSecret = 'cs_00000000000000000000000000';
const wooUrl = '';

function basicAuth(key, secret) {
    let hash = btoa(key + ':' + secret);
    return "Basic " + hash;

let auth = basicAuth(wooClientKey, wooClientSecret);

async function getProducts() {
    try {
        const response = await fetch(wooUrl + 'products', {
            headers: {"Authorization": basicAuth(wooClientKey, wooClientSecret)}
        return await response.json();
    catch (error) {
        // catches errors both in fetch and response.json
Отладка. Будет убрана потом