How to Integrate WooCommerce with WordPress

In this guide to integrate Woocommerce with WordPress, we'll show you how to extend the ecommerce functionality to your WordPress website, it's installation, minimum requirement and automatic installation.

How to Integrate WooCommerce with WordPress

1. WooCommerce By Automattic :

Description:

WooCommerce is a flexible, open-source eCommerce solution built on WordPress. Whether you’re launching a business, taking an existing brick and mortar store online, or designing sites for clients you can get started quickly and build exactly the store you want.
Activate the free WooCommerce plugin on a new or existing WordPress site, follow the optional guided tour, and set up a new store in minutes with:

Installation:

Minimum Requirements
Minimum Requirements
Automatic installation is the easiest option — WordPress will handle the file transfer, and you won’t need to leave your web browser. To do an automatic install of WooCommerce, log in to your WordPress dashboard, navigate to the Plugins menu, and click “Add New.
In the search field type “WooCommerce,” then click “Search Plugins.” Once you’ve found us, you can view details about it such as the point release, rating, and description. Most importantly, of course, you can install it by! Click “Install Now,” and WordPress will take it from there.
Screenshots for Automatic installation:
1. Log in to your WordPress dashboard, navigate to the Plugins menu, and click “Add New”.
2. In the search field type “WooCommerce,” then click “Search Plugins.”
2. In the search field type “WooCommerce,” then click “Search Plugins.”
Note: If you see the form like the following. This connection information is required to perform the requested action WordPress needs to access your web server.
Steps:

1. Open your wp-config.php file from location: your_project_folder/wp-config.php
2. Add the code “define(‘FS_METHOD’,’direct’);” as in the following screenshot.

3. After adding this code save the file and try to install the woocommerce plugin again.
Manual installation

Manual installation method requires downloading the WooCommerce plugin and uploading it to your web server via your favorite FTP application. The WordPress codex contains instructions on how to do this here.

Sample data

WooCommerce comes with some sample data you can use to see how products look; import sample_products.xml via the WordPress importer. You can also use the core CSV importer or our CSV Import Suite extension to import sample_products.csv

Screenshots
1. Products List:
2. Products:
3. Product Page:
4. Edit Product:
5. Setting:
2. WordPress Rest Api – Oauth 1.0a Server by WP REST API Team
Description:
Connect applications to your WordPress site without ever giving away your password.
This plugin uses the OAuth 1.0a protocol to allow delegated authorization; that is, to allow applications to access a site using a set of secondary credentials. This allows server administrators to control which applications can access the site, as well as allowing users to control which applications have access to their data.
This plugin only supports WordPress >= 4.4.
Installation:
Screenshots for Automatic installation:
1. Log in to your WordPress dashboard, navigate to the Plugins menu, and click “Add New.”
2. In the search field type “WordPress Rest API – Oauth 1.0a Server,” then click “Search Plugins.”
3. You can install it by! Click “Install Now,” and WordPress will take it from there.
4. Once installed and activated, go to Users > Applications and click the [Add New] button.
5. On the “Add Application” page you will fill in some values. “Consumer Name” and “Description” can be whatever you wish. Just put something that makes sense. I’m not sure what the Callback does at this time so I just inserted something like “http://wp-api-main/auth/success”.
6. After you have filled in all 3 fields, click the [Add Consumer] button. Now you will see that the Client has a Client Key and Client Secret under the “OAuth Credentials” section.
7. Copy those for later.
Client Key (consumer_key):yqdqpx9jA5iX Client Secret (consumer_secret): xkJLwJeuxrgIe57OjYpLqeYgfwRT2BaQLd76ZqMofJsGoWOo
8. Open the Postman app.
In the “Get” request URL field enter the URL of the main API website’s /oauth1/request path. I have entered
http://WooCom/oauth1/request
Under Authorization Type, choose OAuth 1.0
Enter the Consumer Key (ie. the Client Key) and Consumer Secret (ie. the Client Secret).
9. Click the [Update Request] button. This will automatically fill in the timestamp field and the Nonce field.
10. Your request URL will have been updated to something like this:
http://localhost/WooCom/oauth1/request?oauth_consumer_key=yqdqpx9jA5iX&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1566303680&oauth_nonce=R9frT2&oauth_version=1.0&oauth_signature=/mSLKcioDTBT1Bv2UY3hy3bMh+k=
Then click the [Send] button.
Scroll down to see the response. You should see something like this:
oauth_token=7fbeCZ09zTgUBACiD61WtSZh&oauth_token_secret=lRSipBW0VlNFrANyuCGKpJfXVXHW08FKF5GxIprv45iuEY7K&oauth_callback_confirmed=true
11. Save that string somewhere. We will need these 2 initial OAuth tokens:
oauth_token: 7fbeCZ09zTgUBACiD61WtSZh
oauth_token_secret: lRSipBW0VlNFrANyuCGKpJfXVXHW08FKF5GxIprv45iuEY7K
Next, we will use the “oauth_token” value we just got and construct a URL like this (on our Main API site):
http://wp-api-main/oauth1/authorize?oauth_token=OXjySsfBdsbWa04BMFAJy6ox
Load the URL in your browser.
You will get a login-type screen which has a message like “Howdy eric,
“Client API Connection” would like to connect to WP-API Main.”
12. Click the [Authorize] button.
The next screen will have a message like this: “Your verification token is PvHs1j8ol5FqVd4QPv0eGt9t”
Verification token: LuoQNRB0sK0xci7t91zttMQx
Copy that token down… we’ll need that later, too!

13. The last step is to get our access token.
So in Postman, enter this URL into the request URL field:
http://localhost/WooCom/wordpress/oauth1/access

This time you will need to fill in your:
  • Consumer Key
  • Consumer Secret
  • Token
  • Token Secret
    Clicking the [Update Request] button will fill in the nonce and timestamp and your request URL will be transformed into something like this:
http://localhost/WooCom/wordpress/oauth1/access?oauth_consumer_key=yqdqpx9jA5iX&oauth_token=7fbeCZ09zTgUBACiD61WtSZh&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1566305057&oauth_nonce=kKfgR7&oauth_version=1.0&oauth_signature=3OqJLsWIuOHBMJoF6XtYN0qe6lg=
14. Next, click the [Params] button to the right of the request URL.
15. Add 1 new row to the params. Set the key to “oauth_verifier” and the value to “LuoQNRB0sK0xci7t91zttMQx” (which is the value we got in the previous step.
16. Then click the [Send] button. Note that you may need to click the [Update Request] again and then click [Send].
After you scroll down you will see your new tokens.
oauth_token=oPwgkAv27KnFv5pUcBLBpNUA&oauth_token_secret=6JyEQzb5MQ5ZrcdbIgicrjWJLD4RizNWClK15pgSpaXPD9VL
oauth_token: oPwgkAv27KnFv5pUcBLBpNUA
oauth_token_secret: 6JyEQzb5MQ5ZrcdbIgicrjWJLD4RizNWClK15pgSpaXPD9VL
You can now disregard your old oauth_token and oauth_token_secret tokens. You won’t need the old ones anymore. You only need these new ones. Additionally, you can disregard your oauth_verifier code as well. You shouldn’t need that code anymore.
OK, we are done with Postman and we now have the necessary OAuth tokens we need in order to make an authenticated API request.
Important Links:
1. For WordPress Rest Api – Oauth 1.0a Server documentation
2. To generate Client Key, Client Secret Key and authentications auth_token and token_secret

3. Woo REST API

Description:
WooCommerce (WC) 2.6+ is fully integrated with the WordPress REST API. This allows WC data to be created, read, updated, and deleted using requests in JSON format and using WordPress REST API Authentication methods and standard HTTP verbs which are understood by most HTTP clients.
Important Links:
For woo REST API documentation:

4. CoCart by Sébastien Dumont

Description:
WooCommerce REST API is great but it’s missing one important ability and that is to manage the shopping cart.
That’s were CoCart comes in. Just as a customer would interact with an online store in their browser, CoCart allows you to get the cart contents including totals, add, remove, restore and update items to and from the shopping cart via the REST API.
Built With Developers in Mind
Exclusively for WooCommerce. With CoCart, running your store completely via the REST API is now complete. Control and manage the shopping cart with ease. Powerful options, clear responses and developer ready for any filtering required to your needs.
CoCart also works well with official WooCommerce extensions such as:
  • Bookings
  • Name Your Price
  • Points and Rewards
  • Pre-Orders
  • Product Add-ons
Installation:
Minimum Requirements
Visit the WooCommerce server requirements documentation for a detailed list of server requirements.
Automatic Installation
Automatic installation is the easiest option as WordPress handles the file transfers itself and you don’t need to leave your web browser. To do an automatic install of CoCart, log in to your WordPress dashboard, navigate to the Plugins menu and click Add New.
In the search field type “CoCart” and click Search Plugins. Once you’ve found the plugin you can view details about it such as the point release, rating, and description. Most importantly, of course, you can install it by simply clicking “Install Now”.
Screenshots for Automatic installation:
1. Log in to your WordPress dashboard, navigate to the Plugins menu, and click “Add New.”
2. In the search field type “CoCart,” then click “Search Plugins.”
3. You can install it by! Click “Install Now,” and WordPress will take it from there.
Manual Installation
The manual installation method involves downloading the plugin and uploading it to your webserver via your favorite FTP application. The WordPress codex contains instructions on how to do this here.
Important Links:
1. For CoCart Plugin of WordPress.
2. For CoCart documentation
https://docs.cocart.xyz/#introduction

5. TI WooCommerce WishList Plugin by TemplateInvaders

Description:
WooCommerce Wishlist is a simple but powerful tool that can help you to convert your site visitors into loyal customers. There are many situations when customers can’t buy a product at this time or simply don’t want to. Possibility to save products for later encourages users to return to your site and after all, make a purchase. Adding products to Wishlist is easy and convenient so it may also force your customers to buy even more products than they planned. Users can share their wishlist, for example, to help their friends choose a gift for an upcoming holiday and so on. By sharing their Wishlists, they are bringing you, new potential customers. All in all this increasing amount of your site visitors, conversion and as a result sales.
Important Links & Installation:
1. For TI WooCommerce WishList Plugin of WordPress. https://wordpress.org/plugins/ti-woocommerce-wishlist/ 2. For TI WooCommerce WishList Plugin installation visit following given link. https://templateinvaders.com/documentation/ti-woocommerce-wishlist-free/?utm_source=wordpressorg&utm_content=documentation

6. WordPress REST API by WP REST API Team

Description:
WordPress is moving towards becoming a fully-fledged application framework, and we need new APIs. This project was born to create an easy-to-use, easy-to-understand and well-tested framework for creating these APIs, plus creating APIs for the core.
This plugin provides an easy to use REST API, available via HTTP. Grab your site’s data in simple JSON format, including users, posts, taxonomies and more. Retrieving or updating data is as simple as sending an HTTP request.
The WordPress REST API exposes a simple yet easy interface to WP Query, the posts API, post meta API, users API, revisions API and many more. Chances are, if you can do it with WordPress, the API will let you do it.
The REST API also includes an easy-to-use JavaScript API based on Backbone models, allowing plugin and theme developers to get up and running without needing to know anything about the details of getting connected.
Installation:
Install the WP REST API via the plugin directory, or by uploading the files manually to your server. For full-flavored API support, you’ll need to be using pretty permalinks to use the plugin, as it uses custom rewrite rules to power the API. Once you’ve installed and activated the plugin, check out the documentation for details on your newly available endpoints.
Important Links:

1. For WordPress REST API (Version 2) of WordPress
https://wordpress.org/plugins/rest-api/#installation
2. Check out the documentation for details on your newly available endpoints.
https://developer.wordpress.org/rest-api/

7. JWT Authentication for WP REST API by Enrique Chavez

Description:

Extends the WP REST API using JSON Web Tokens Authentication as an authentication method.
JSON Web Tokens are an open, industry-standard RFC 7519 method for representing claims securely between two parties.
Support and Requests please in Github: https://github.com/Tmeister/wp-api-jwt-auth

Requirements:
WP REST API V2

This plugin was conceived to extend the WP REST API V2 plugin features and, of course, was built on top of it.
So, to use the wp-api-jwt-auth you need to install and activate WP REST API.

PHP
Minimum PHP version: 5.3.0
PHP HTTP Authorization Header enable

Most of the shared hosting has disabled the HTTP Authorization Header by default.
To enable this option you’ll need to edit your .htaccess file add the following code

RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
WPENGINE

To enable this option you’ll need to edit your .htaccess file add the following code
See https://github.com/Tmeister/wp-api-jwt-auth/issues/1
SetEnvIf Authorization “(.*)” HTTP_AUTHORIZATION=$1

Configuration
CONFIGURATE THE SECRET KEY

The JWT needs a secret key to sign the token this secret key must be unique and never revealed.
To add the secret key edit your wp-config.php file and add a new constant called JWT_AUTH_SECRET_KEY
define(‘JWT_AUTH_SECRET_KEY’, ‘your-top-secret-key’);

You can use a string from here https://api.wordpress.org/secret-key/1.1/salt/
CONFIGURATE CORS SUPPORT

The wp-api-jwt-auth plugin has the option to activate CORs support.

To enable the CORs Support edit your wp-config.php file and add a new constant called JWT_AUTH_CORS_ENABLE
define(‘JWT_AUTH_CORS_ENABLE’, true);
Finally activate the plugin within your wp-admin.
Installation:
USING THE WORDPRESS DASHBOARD
  1. Navigate to the ‘Add New’ in the plugins dashboard
  2. Search for ‘jwt-authentication-for-wp-rest-api’
  3. Click ‘Install Now’
  4. Activate the plugin on the Plugin dashboard
UPLOADING IN WORDPRESS DASHBOARD
  1. Navigate to the ‘Add New’ in the plugins dashboard
  2. Navigate to the ‘Upload’ area
  3. Select jwt-authentication-for-wp-rest-api.zip from your computer
  4. Click ‘Install Now’
  5. Activate the plugin in the Plugin dashboard

Important Links:
1. For WordPress REST API (Version 2) of WordPress, usage and how to configure the plugin
https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/#description