Themes Coder React WooCommerceDocs
Getting started

Introduction

This guide covers React WooCommerce from start to finish: what's in the package, how to install it, every setting.

Press / anywhere to search these docs, or use View all on one page in the sidebar to print or save the whole guide as a PDF.

About#

React WooCommerce is an easy solution for pragmatic developers around the world. With just one single compilation you can create mobile apps for your WooCommerce website and publish the Apps on play store and Appstore. It accommodates massive number of very famous and essential plugins like

  • WPML (WordPress Multi Language)

  • WordPress Multi-Vendor and Dokan

  • WC Points & Rewards

  • Multi-Currency

  • After ship

  • One Signal

  • You can create an app for any type of store. React WooCommerce supports all types of products.

  • As far as the payment gateways is a major consideration, you can integrate all gateways that are compatible with WordPress WooCommerce due to the web view feature facility.

  • When it comes to shipping gateways, it allows all the shipping methods.

  • Social login option through Facebook following just a few simple steps.

Objectives#

Following are the objectives of React WooCommerce:

  1. This ensures high sales, and in time delivery of the products.

  2. This reduces the time of transaction and payment.

  3. It allows visitors across certain boundaries to see and order the products.

  4. The ease of ordering and payment enhances the conversion rate.

  5. Extended options and ease throughout the transaction render more confidence and satisfaction to the customer.

Pre Requisites#

Before you use the app and start the installation process on your machine, this is important points to know in detail.

  1.  **Tools**.
    

First, this is important, please make sure you have already install and run the simulator successful base on this guide with REACT-NATIVE-CLI.

https://facebook.github.io/react-native/docs/0.59/getting-started

It will help you install and build your first Example React Native app.

2)Application build and test dependencies.

Below given are the essential dependencies that are needed to build the application and also for testing purpose i.e

  1. WordPress 4.4+
  2. WooCommerce 2.6+.
  3. Latest Node version(make sure it is Node 8.3 or newer)
  4. React Native command line interface
  5. JDK, Watchman
  6. We recommend installing Python2 via Chocolatey, a popular package manager for Windows.
  7. Android Studio with SDK Manager.
  8. XCode 10

3) Essentials

  1. You must have wordpress site setup with woocommerce plugin.
  2. You must have a Facebook account to setup facebook login
  3. You must create firebase account setup
  4. You must have OneSignal account setup for push notifications.
Getting started

Installation

This chapter covers React Setup, Plugin Installation and Facebook Login.

React Setup#

Getting Started#

This section will help you walk through the minimum required setup to run project.

Required Setup#

First, this is important, please make sure you have already install and run the simulator successful base on this guide with REACT-NATIVE-CLI.

https://reactnative.dev/docs/environment-setup

it will help you install and build your first Example React Native app.

Installing Node Modules#

Open terminal and go to project folder and run following command

npm install

// or run yarn, this is similar to npm but could be faster // yarn from https://yarnpkg.com yarn

iOS Setup (Mac OS only)#

Follow above link React Native CLI Quickstart -> macOS -> iOS we are using node v12.14.1

Running Simulator#

Run following command if you have installed node modules from previous command.

CocoaPods

cd ios && pod install

After installation of all dependencies back to previous folder

cd ..

run this command

npx react-native run-ios

Android Setup (Mac OS, Windows, Linux)#

Change Android SDK Path

Go to

  1. File -> project Structure into Project Structure
  2. Left -> SDK Location

SDK location select Android SDK location

Running Emulator#

To check the Android device is ready or not run following command from your terminal

adb devices

Please make sure you use the correct Android SDK path. You can find the actual location of the SDK in the Android Studio "Preferences" dialog, under Appearance & Behavior → System Settings → Android SDK. If you have device listed you can run following command

npx react-native run-android

if you are getting error

import com.airbnb.android.react.maps.MapsPackage; PackageList.java:104: error: cannot find symbol new MapsPackage(), ^ symbol: class MapsPackage location: class PackageList 2 errors

then go to the build.gradle file android/build.gradle and add supportLibVersion = "28.0.0" in ext{..} like this

ext {buildToolsVersion = "28.0.3"minSdkVersion = 16compileSdkVersion = 28targetSdkVersion = 28supportLibVersion = "28.0.0" // add this}

if you are on window and getting error metro bundle ‘react-native start' then go to this path

\node_modules\metro-config\src\defaults\blacklist.jsand replace

var sharedBlacklist = [ /node_modules[/\\]react[/\\]dist[/\\].*/, /website\/node_modules\/.*/, /heapCapture\/bundle\.js/, /.*\/__tests__\/.*/ ];

**to:

var sharedBlacklist = [ /node_modules[\/\\]react[\/\\]dist[\/\\].*/, /website\/node_modules\/.*/, /heapCapture\/bundle\.js/, /.*\/__tests__\/.*/ ];

Woocommerce Configuration#

This section will guide how to make the app work with your existing Wordpress website

Required Setup#

As the app is required to connect with the Wordpress site and WooCommerce plugin via Rest API, please refer to the Rest Document for more detail info.

App Config#

Go the project folder open the file: src/common/Theme.style.js and follow below steps to setup the app.

  • https://your-site.com (it will be the url of your domain)
  • consumer key
  • consumer secret
  • change the colors for your theme
  • change default currency
  • change default language for both rtl and ltr
  • change price decimals to your requirement
  • change home pages title

Change SplashScreen and app Icon#

Android#

go into android/app/src/res/mipmap(dpi,mdpi,xhdpi,xxhdpi,xxxhdpi) and replace the splashscreen image for splash screen and ic_launcher and ic_launcher_round(round shape icon) for icon (name and extension of all images should be same )

IOS#

go into ios/RNBecrux/Images.xcassets/ and change the splashscreen and icon

How to Set the App Icon#

Click in the Project navigator and then choose AppIcon

Now just drag the right sized image (in .png format) from Finder onto every blank in the app set. The app icon should be all set up now.

Intro Slider Images#

replace that images for intro1 slider (name and extension of all images should be same )

Rate us#

Android#

For Rate Us button change the google package name in /screens/RateUs.js

IOS#

go to Wordpress site ReactEcommerce/General Settings and enter URL to iOS share app

RTL#

Android#

go into android/app/src/main/java/com/../MainActivity.java folder and change forceRTL() to true

IOS#

go into ios/RNBecrux/AppDelegate.m folder and change forceRTL() to YES

Facebook Integration#

Facebook SDK Installation

https://developers.facebook.com/docs/react-native/getting-started

Facebook Developer Console#

The first thing we need to do is to create a new application in Facebook’s developer dashboard, and this app is the one that Facebook will use to ask our users for their permission when we try to log them into our React Native application. For that, you’ll need to go to the

and create a new app

Add your Platforms to Facebook#

Android#

Add Facebook App ID#

  • Add your Facebook App ID to your app and update your Android manifest.
  • Open your strings.xml file, for example:/app/src/main/res/values/strings.xml .
  • Add a new string with the name facebook_app_id containing the value of your Facebook App ID:

<string name="facebook_app_id">…….</string>

Add your development and release key hashes To ensure the authenticity of the interactions between your app and Facebook, If your app has already been published, you should add your release key hash too. You'll have a unique development key hash for each Android development environment. To generate a development key hash, on Mac, run the following command:

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

On Windows, run this command:

keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl base64

This command will generate a 28-character key hash unique to your development environment. Copy and paste it into the field below. You will need to provide a development key hash for the development environment of each person who works on your app. If your app has already been published, you should also add a hash of your release key. Android apps must be digitally signed with a release key before you can upload them to the store. To generate a hash of your release key, run the following command on Mac or Windows substituting your release key alias and the path to your keystore:

keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | openssl sha1 -binary | openssl base64

This will generate a 28-character string that you should copy and paste into the field below. Also, see the Android documentation for signing your apps.

IOS:#

Configure your info.plist and project settings#

Find the .plist file in the Supporting Files folder in your Xcode Project.

  1. Right-click your .plist file and choose "Open As Source Code".
  2. Copy & Paste the XML snippet into the body of your file

( <dict>...</dict> )

<key>CFBundleURLTypes</key>

<array>

<dict>

<key>CFBundleURLSchemes</key>

<array>

<string>……</string>

</array>

</dict>

</array>

<key>FacebookAppID</key>

<string>……</string>

<key>FacebookDisplayName</key>

<string>rn</string>

Push Notification#

Put your ONESIGNAL APP ID here with your OneSignal google project number in your android/app/build.gradle folder.

android { defaultConfig { manifestPlaceholders = [

onesignal_app_id: 'PUT YOUR ONESIGNAL APP ID HERE',

// Project number pulled from dashboard, local value is ignored.

onesignal_google_project_number: 'REMOTE' ]}}

Generate Credentials#

iOS - Generate an iOS Push Certificate

ANDROID - Generate a Google Server API Key

Deep linking#

Configuring Android#

First, we need to open our Manifest file and add the app name we will want to be referencing, in our case Becruxapp.

In android/app/src/main, open AndroidManifest.xml and change the android:host=” ” according to your link and you can also change android:scheme=” ”.

Configuring iOS#

Step 1. Add URL type toinfo.plist

  1. Open plistand at the top of the file, create a new property called URL types
  2. Expand item 0(zero) and choose URL Schemes.
  3. Give item 0 or 1the name you would like your app to be linkable as. In our case, I chose tcshop.androidecommerce as the name.

Reference:#

https://medium.com/react-native-training/deep-linking-your-react-native-app-d87c39a1ad5e

Config AndroidHow to config App name

Open file android/app/src/main/res/values/strings.xml and change to your App name

Don't forget clean cache after change app info.

cd ./android && ./gradlew clean

Publishing to Google Play Store#

Publishing to Apple Store#

Plugin Installation#

We have added JSON API and React eCommerce plugins. These plugins can be installed in two ways.

You will find the JSON API and React eCommerce plugins in a zipped folder in the pack.

1stMethod

  1. Upload the folder “JSON-API” to your WordPress Plugin folder (/wp-content/plugins)
  2. Now activate the plugin through the “plugins” menu in WordPress or by using the link provided by the plugin installer.
  3. Activate the controller through the JSON API menu found in the WordPress Admin Center (Settings->JSON API)

2ndMethod

Go straight to the admin panel>Plugin>Add New.

The above-given page will show up. From here, click on the “upload plugin” option, make sure that the plugin that you have is in .zip format. Click on the “Browse” option, upload the plugin folder and once the folder is chosen, click on the “Install Now” option”.

Once the plugin is installed, you can activate or deactivate the plugin through settings according to your usage.

After WordPress plugins installation and setup, please follow the below-mentioned instructions to set up your mobile application. After Intallation of plugin need to activate the controllers from Settings >> Json APi

Ionic Woocommerce app works with woocommerce rest api, please follow the link below to enable woocommerce rest api on your server.

https://docs.woocommerce.com/document/woocommerce-rest-api/

After enable rest api, please make sure your site woocommerce rest api working correctly. You can follow that simple tutorial link to check whether rest api works correctly on your sever or not.

https://github.com/woocommerce/woocommerce/wiki/Getting-started-with-the-REST-API

Now you have all set at your wordpress site end. Please proceed with ionic source code setup.

Facebook Login#

The first thing we need to do is to create a new application in Facebook’s developer dashboard, and this app is the one that Facebook will use to ask our users for their permission when we try to log them into our React Native application. For that, you’ll need to go to the Facebook developer console and create a new app.

Settings

App Feature Settings

This chapter covers General Settings, Checkout Settings, Contact Page Settings, Sidebar Menu Links and App Content Pages.

General Settings#

If you want to show the “cancel order” button, select show. While you can also hide it by applying the “hide” option.

From here you can set a certain time duration, prior to which the buyer can cancel the order. For instance, the 8 Hours option implies that order could be cancelled at least 8 hours prior to the agreed delivery time.

This allows you to choose any of Home Screen Style from 8 available styles.

This allows you to choose any Category Screen Style from 5 available styles.

This option allows you to display or hide the “Cart”.

Here you need to place the URL of your business website.

Here you ought to place a specific currency symbol that you deal in.

This option allows you to tag your new arrivals as “New Product” for as many days as you select this option.

This option allows you to place a filter of maximum price so that the products falling within this certain range show on your site page.

Checkout Settings#

a) Checkout Type

In checkout types, there are three further options available.

  1. Default: by selecting this option, you allow the web view of checkout. This checkout option appears in your app.
  2. Virtual: This checkout option is meant for those businesses that deal in virtual or intangible products that cannot be shipped physically, rather just downloaded. For instance, digital products, Pdf files, books, etc. In this checkout style, only the billing detail page appears and not the shipping detail page.
  3. Screen in App: in this checkout type, a separate order page is created right within the app where billing and shipping details are entered and stored.

b) Guest Checkout.

By enabling this option, you allow a random visitor to place the order without properly registering.

c) Custom CSS for Checkout Page.

This custom CSS allows you to change/modify your checkout page options right in the manner you like.

Contact Page Settings#

This entire page is designed in order to facilitate the client in contacting you. You are supposed to fill in each column on this page appropriately and accurately. This contact form is a bridge between you and the client.

Wishlist.

Wishlist is meant for the visitor where he/she can add products that he/she is likely to buy in the future. You can display or hide the wishlist.

Edit Profile.

This is again meant for the visitor to edit his/her profile information that was used in registration. Through this, you can allow or restrict the visitor from editing the profile.

My orders

Through this page, the visitor can see his/her order details and history. You can show or hide this option.

Contact us.

This is the page that carries the details of your contact information. You can show or hide this.

About Us.

This is the page that shows the “about us” content. You can show or hide this from this option.

Billing Shipping Info.

This segment is meant for the user where he/she can store billing and shipping information. You can show or hide it in the left menu.

Downloads.

This is again meant for the visitor whether he/she wants downloads or not. You can show or hide it in the left menu.

News.

This carries the latest news about your business. You can show or hide this from the left menu.

Introduction.

This segment contains your business’s introduction. You can show or hide it from here.

Share App.

Through this option, the visitor can share your app through different mediums with other users. You can show or hide this option from here.

RateApp.

Through this option, the visitor can rate your app. You can show or hide this option from here.

Settings.

Show or hide the settings from the left menu.

App Content Pages#

This feature allows you to display different information for the visitor I.e Your About Us page, Refund Policy, Privacy Policy, Terms, and Conditions content.

Settings

App Compatible plugins

This chapter covers WPML (Multi-Language), Multi Vendor, WC Points and Rewards, Multi Currency and Delivery Tracking.

WPML (Multi-Language)#

WPML implies the WordPress Multi-Language plugin. This is meant for this paid plugin that you can purchase and install to integrate with your app if you need multiple languages on your app. Once you have installed and activated the WPML plugin in the site backend, allow with “Yes” option here to make it functional. Link for this specific plugin is provided here https://wordpress.org/plugins/woocommerce-multilingual/.

This is the default view of the app after the addition of the WPML plugin. Check the language of your choice, for instance, if you select the Arabic language, all the content on the app would show the Arabic language by default as shown below when you essentially enter the data through the Arabic language.

Multi Vendor#

This is again a paid plugin that allows multiple vendors to sell their products on your website. Once you have purchased and installed this plugin on your WordPress website, select the “Yes” option from here to make it completely functional. The link for this particular plugin is given here https://www.wcvendors.com/.

Note: Points and Rewards plugin is not compatible with VC Vendor and dokan plugin.

Above given is the default view of the app after the installation of the Multi-Vendor plugin. Your multiple vendors would show up in this manner when you add them one by one through the backend.

above given is the default view of one of your listed vendors. Account for each vendor would show up in-app like this.

WC Points and Rewards#

This paid plugin is meant to offer different points and rewards to your customers that make considerable purchases. Select “Yes” after the complete installation and activation of the plugin on your WordPress website. The link for this particular plugin is given here https://woocommerce.com/products/woocommerce-points-and-rewards/?_ga=2.49807654.1224914166.1567084292-1405747643.1554209886.

Once you have installed the above-mentioned plugin, this would appear in your app menu bar like this

You can create a standard reward point mechanism according to your choice and policy through the plugin settings menu where you can assign certain points and rewards against a certain sum of money spent on shopping. The reward and points log of each user would appear like this

Multi Currency#

This plugin facilitates businesses that deal in multiple currencies. Configure all required settings of the plugin through the Reacat eCommerce plugin settings option and finally click on the “Yes” option here to make it completely functional. Here is the link for this multi-currency plugin that is compatible with this app https://wordpress.org/plugins/woocommerce-currency-switcher/.

Once you have installed the above mentioned multi-currency plugin, a specific $ sign will appear on the top right of the app’s menu bar like this.

From the menu given below, you can select your desired currency to be applied for all transactions.

Delivery Tracking#

This is meant for the “Aftership” plugin that allows the customer to track their order. After the installation and activation of this plugin, select “Yes” to make it functional. First, you have to make your account on the Aftership. This would issue a specific URL, place that specific URL here along with the yes option. Here we have placed the link for this plugin which is compatible with our app https://wordpress.org/plugins/aftership-woocommerce-tracking/.

Once a user places an order, he/she is assigned a specific tracking number through which the status of the product in transit can be found.

Reference

Support

Stuck on a step, or found something that doesn't work as this guide says? We're happy to help.

Get help#

Before you write#

Please include these, so we can answer in one go:

  1. Your purchase code, or the email you bought with.
  2. Which part you're setting up: the admin panel or website, the customer app, or the delivery or vendor app.
  3. The step in this guide where it stopped working, what you expected and what happened instead.
  4. Screenshots of any error, and the console or build output if a build failed.

What item support covers#

As set by Envato's item support policy, support covers questions about how the item works, fixing bugs in it, and help with the third-party assets it includes. Installing it on your server for you, custom changes and new features aren't part of item support, but you're welcome to ask about them.