One place for hosting & domains

      March 2019

      How To Write Comments in Go


      Comments are lines that exist in computer programs that are ignored by compilers and interpreters. Including comments in programs makes code more readable for humans as it provides some information or explanation about what each part of a program is doing.

      Depending on the purpose of your program, comments can serve as notes to yourself or reminders, or they can be written with the intention of other programmers being able to understand what your code is doing.

      In general, it is a good idea to write comments while you are writing or updating a program as it is easy to forget your thought process later on, and comments written later may be less useful in the long term.

      Comments in Go begin with a set of forward slashes (//) and continue to the end of the line. It is idiomatic to have a white space after the set of forward slashes.

      Generally, comments will look something like this:

      // This is a comment

      Comments do not execute, so there will be no indication of a comment when running a program. Comments are in the source code for humans to read, not for computers to execute.

      In a “Hello, World!” program, a comment may look like this:


      package main
      import (
      func main() {
          // Print “Hello, World!” to console
          fmt.Println("Hello, World!")

      In a for loop that iterates over a slice, comments may look like this:


      package main
      import (
      func main() {
          // Define sharks variable as a slice of strings
          sharks := []string{"hammerhead", "great white", "dogfish", "frilled", "bullhead", "requiem"}
          // For loop that iterates over sharks list and prints each string item
          for _, shark := range sharks {

      Comments should be made at the same indent as the code it is commenting. That is, a function definition with no indent would have a comment with no indent, and each indent level following would have comments that are aligned with the code it is commenting.

      For example, here is how the main function is commented, with comments following each indent level of the code:


      package main
      import "fmt"
      const favColor string = "blue"
      func main() {
          var guess string
          // Create an input loop
          for {
              // Ask the user to guess my favorite color
              fmt.Println("Guess my favorite color:")
              // Try to read a line of input from the user. Print out the error 0
              if _, err := fmt.Scanln(&guess); err != nil {
                  fmt.Printf("%sn", err)
              // Did they guess the correct color?
              if favColor == guess {
                  // They guessed it!
                  fmt.Printf("%q is my favorite color!n", favColor)
              // Wrong! Have them guess again.
              fmt.Printf("Sorry, %q is not my favorite color. Guess again.n", guess)

      Comments are made to help programmers, whether it is the original programmer or someone else using or collaborating on the project. If comments cannot be properly maintained and updated along with the code base, it is better to not include a comment rather than write a comment that contradicts or will contradict the code.

      When commenting code, you should be looking to answer the why behind the code as opposed to the what or how. Unless the code is particularly tricky, looking at the code can generally answer the what or how, which is why comments are usually focused around the why.

      Block comments can be used to explain more complicated code or code that you don’t expect the reader to be familiar with.

      You can create block comments two ways in Go. The first is by using a set of double forward slashes and repeating them for every line.

      // First line of a block comment
      // Second line of a block comment

      The second is to use opening tags (/*) and closing tags (*/). For documenting code, it is considered idiomatic to always use // syntax. You would only use the /* ... */ syntax for debugging, which we will cover later in this article.

      Everything here
      will be considered
      a block comment

      In this example, the block comment defines what is happening in the MustGet() function:


      // MustGet will retrieve a url and return the body of the page.
      // If Get encounters any errors, it will panic.
      func MustGet(url string) string {
          resp, err := http.Get(url)
          if err != nil {
          // don't forget to close the body
          defer resp.Body.Close()
          var body []byte
          if body, err = ioutil.ReadAll(resp.Body); err != nil {
          return string(body)

      It is common to see block comments at the beginning of exported functions in Go; these comments are also what generate your code documentation. Block comments are also used when operations are less straightforward and are therefore demanding of a thorough explanation. With the exception of documenting functions, you should try to avoid over-commenting the code and trust other programmers to understand Go, unless you are writing for a particular audience.

      Inline comments occur on the same line of a statement, following the code itself. Like other comments, they begin with a set of forward slashes. Again, it’s not required to have a whitespace after the forward slashes, but it is considered idiomatic to do so.

      Generally, inline comments look like this:

      [code]  // Inline comment about the code

      Inline comments should be used sparingly, but can be effective for explaining tricky or non-obvious parts of code. They can also be useful if you think you may not remember a line of the code you are writing in the future, or if you are collaborating with someone who you know may not be familiar with all aspects of the code.

      For example, if you don’t use a lot of math in your Go programs, you or your collaborators may not know that the following creates a complex number, so you may want to include an inline comment about that:

      z := x % 2  // Get the modulus of x

      You can also use inline comments to explain the reason behind doing something, or to provide some extra information, as in:

      x := 8  // Initialize x with an arbitrary number

      You should only use inline comments when necessary and when they can provide helpful guidance for the person reading the program.

      In addition to using comments as a way to document code, you can also use opening tags (/*) and closing tags (*/) to create a block comment. This allows you to comment out code that you don’t want to execute while you are testing or debugging a program you are currently creating. That is, when you experience errors after implementing new lines of code, you may want to comment a few of them out to see if you can troubleshoot the precise issue.

      Using the /* and */ tags can also allow you to try alternatives while you’re determining how to set up your code. You can also use block comments to comment out code that is failing while you continue to work on other parts of your code.


      // Function to add two numbers
      func addTwoNumbers(x, y int) int {
          sum := x + y
          return sum
      // Function to multiply two numbers
      func multiplyTwoNumbers(x, y int) int {
          product := x * y
          return product
      func main() {
              In this example, we're commenting out the addTwoNumbers
              function because it is failing, therefore preventing it from executing.
              Only the multiplyTwoNumbers function will run
              a := addTwoNumbers(3, 5)
          m := multiplyTwoNumbers(5, 9)

      Note: Commenting out code should only be done for testing purposes. Do not leave snippets of commented out code in your final program.

      Commenting out code with the /* and */ tags can allow you to try out different programming methods as well as help you find the source of an error through systematically commenting out and running parts of a program.


      Using comments within your Go programs helps to make your programs more readable for humans, including your future self. Adding appropriate comments that are relevant and useful can make it easier for others to collaborate with you on programming projects and make the value of your code more obvious.

      Commenting your code properly in Go will also allow for you to use the Godoc tool. Godoc is a tool that will extract comments from your code and generate documentation for your Go program.

      Source link

      How To Back Up, Import, and Migrate Your Apache Kafka Data on Debian 9

      The author selected Tech Education Fund to receive a donation as part of the Write for DOnations program.


      Backing up your Apache Kafka data is an important practice that will help you recover from unintended data loss or bad data added to the cluster due to user error. Data dumps of cluster and topic data are an efficient way to perform backups and restorations.

      Importing and migrating your backed up data to a separate server is helpful in situations where your Kafka instance becomes unusable due to server hardware or networking failures and you need to create a new Kafka instance with your old data. Importing and migrating backed up data is also useful when you are moving the Kafka instance to an upgraded or downgraded server due to a change in resource usage.

      In this tutorial, you will back up, import, and migrate your Kafka data on a single Debian 9 installation as well as on multiple Debian 9 installations on separate servers. ZooKeeper is a critical component of Kafka’s operation. It stores information about cluster state such as consumer data, partition data, and the state of other brokers in the cluster. As such, you will also back up ZooKeeper’s data in this tutorial.


      To follow along, you will need:

      • A Debian 9 server with at least 4GB of RAM and a non-root sudo user set up by following the tutorial.
      • A Debian 9 server with Apache Kafka installed, to act as the source of the backup. Follow the How To Install Apache Kafka on Debian 9 guide to set up your Kafka installation, if Kafka isn’t already installed on the source server.
      • OpenJDK 8 installed on the server. To install this version, follow these instructions on installing specific versions of OpenJDK.
      • Optional for Step 7 — Another Debian 9 server with Apache Kafka installed, to act as the destination of the backup. Follow the article link in the previous prerequisite to install Kafka on the destination server. This prerequisite is required only if you are moving your Kafka data from one server to another. If you want to back up and import your Kafka data to a single server, you can skip this prerequisite.

      Step 1 — Creating a Test Topic and Adding Messages

      A Kafka message is the most basic unit of data storage in Kafka and is the entity that you will publish to and subscribe from Kafka. A Kafka topic is like a container for a group of related messages. When you subscribe to a particular topic, you will receive only messages that were published to that particular topic. In this section you will log in to the server that you would like to back up (the source server) and add a Kafka topic and a message so that you have some data populated for the backup.

      This tutorial assumes you have installed Kafka in the home directory of the kafka user (/home/kafka/kafka). If your installation is in a different directory, modify the ~/kafka part in the following commands with your Kafka installation’s path, and for the commands throughout the rest of this tutorial.

      SSH into the source server by executing:

      • ssh sammy@source_server_ip

      Run the following command to log in as the kafka user:

      Create a topic named BackupTopic using the shell utility file in your Kafka installation's bin directory, by typing:

      • ~/kafka/bin/ --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic BackupTopic

      Publish the string "Test Message 1" to the BackupTopic topic by using the ~/kafka/bin/ shell utility script.

      If you would like to add additional messages here, you can do so now.

      • echo "Test Message 1" | ~/kafka/bin/ --broker-list localhost:9092 --topic BackupTopic > /dev/null

      The ~/kafka/bin/ file allows you to publish messages directly from the command line. Typically, you would publish messages using a Kafka client library from within your program, but since that involves different setups for different programming languages, you can use the shell script as a language-independent way of publishing messages during testing or while performing administrative tasks. The --topic flag specifies the topic that you will publish the message to.

      Next, verify that the script has published the message(s) by running the following command:

      • ~/kafka/bin/ --bootstrap-server localhost:9092 --topic BackupTopic --from-beginning

      The ~/kafka/bin/ shell script starts the consumer. Once started, it will subscribe to messages from the topic that you published in the "Test Message 1" message in the previous command. The --from-beginning flag in the command allows consuming messages that were published before the consumer was started. Without the flag enabled, only messages published after the consumer was started will appear. On running the command, you will see the following output in the terminal:


      Test Message 1

      Press CTRL+C to stop the consumer.

      You've created some test data and verified that it's persisted. Now you can back up the state data in the next section.

      Step 2 — Backing Up the ZooKeeper State Data

      Before backing up the actual Kafka data, you need to back up the cluster state stored in ZooKeeper.

      ZooKeeper stores its data in the directory specified by the dataDir field in the ~/kafka/config/ configuration file. You need to read the value of this field to determine the directory to back up. By default, dataDir points to the /tmp/zookeeper directory. If the value is different in your installation, replace /tmp/zookeeper with that value in the following commands.

      Here is an example output of the ~/kafka/config/ file:


      # the directory where the snapshot is stored.
      # the port at which the clients will connect
      # disable the per-ip limit on the number of connections since this is a non-production config

      Now that you have the path to the directory, you can create a compressed archive file of its contents. Compressed archive files are a better option over regular archive files to save disk space. Run the following command:

      • tar -czf /home/kafka/zookeeper-backup.tar.gz /tmp/zookeeper/*

      The command's output tar: Removing leading / from member names you can safely ignore.

      The -c and -z flags tell tar to create an archive and apply gzip compression to the archive. The -f flag specifies the name of the output compressed archive file, which is zookeeper-backup.tar.gz in this case.

      You can run ls in your current directory to see zookeeper-backup.tar.gz as part of your output.

      You have now successfully backed up the ZooKeeper data. In the next section, you will back up the actual Kafka data.

      Step 3 — Backing Up the Kafka Topics and Messages

      In this section, you will back up Kafka's data directory into a compressed tar file like you did for ZooKeeper in the previous step.

      Kafka stores topics, messages, and internal files in the directory that the log.dirs field specifies in the ~/kafka/config/ configuration file. You need to read the value of this field to determine the directory to back up. By default and in your current installation, log.dirs points to the /tmp/kafka-logs directory. If the value is different in your installation, replace /tmp/kafka-logs in the following commands with the correct value.

      Here is an example output of the ~/kafka/config/ file:


      ############################# Log Basics #############################
      # A comma separated list of directories under which to store log files
      # The default number of log partitions per topic. More partitions allow greater
      # parallelism for consumption, but this will also result in more files across
      # the brokers.
      # The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.
      # This value is recommended to be increased for installations with data dirs located in RAID array.

      First, stop the Kafka service so that the data in the log.dirs directory is in a consistent state when creating the archive with tar. To do this, return to your server's non-root user by typing exit and then run the following command:

      • sudo systemctl stop kafka

      After stopping the Kafka service, log back in as your kafka user with:

      It is necessary to stop/start the Kafka and ZooKeeper services as your non-root sudo user because in the Apache Kafka installation prerequisite you restricted the kafka user as a security precaution. This step in the prerequisite disables sudo access for the kafka user, which leads to commands failing to execute.

      Now, create a compressed archive file of the directory's contents by running the following command:

      • tar -czf /home/kafka/kafka-backup.tar.gz /tmp/kafka-logs/*

      Once again, you can safely ignore the command's output (tar: Removing leading / from member names).

      You can run ls in the current directory to see kafka-backup.tar.gz as part of the output.

      You can start the Kafka service again — if you do not want to restore the data immediately — by typing exit, to switch to your non-root sudo user, and then running:

      • sudo systemctl start kafka

      Log back in as your kafka user:

      You have successfully backed up the Kafka data. You can now proceed to the next section, where you will be restoring the cluster state data stored in ZooKeeper.

      Step 4 — Restoring the ZooKeeper Data

      In this section you will restore the cluster state data that Kafka creates and manages internally when the user performs operations such as creating a topic, adding/removing additional nodes, and adding and consuming messages. You will restore the data to your existing source installation by deleting the ZooKeeper data directory and restoring the contents of the zookeeper-backup.tar.gz file. If you want to restore data to a different server, see Step 7.

      You need to stop the Kafka and ZooKeeper services as a precaution against the data directories receiving invalid data during the restoration process.

      First, stop the Kafka service by typing exit, to switch to your non-root sudo user, and then running:

      • sudo systemctl stop kafka

      Next, stop the ZooKeeper service:

      • sudo systemctl stop zookeeper

      Log back in as your kafka user:

      You can then safely delete the existing cluster data directory with the following command:

      Now restore the data you backed up in Step 2:

      • tar -C /tmp/zookeeper -xzf /home/kafka/zookeeper-backup.tar.gz --strip-components 2

      The -C flag tells tar to change to the directory /tmp/zookeeper before extracting the data. You specify the --strip 2 flag to make tar extract the archive's contents in /tmp/zookeeper/ itself and not in another directory (such as /tmp/zookeeper/tmp/zookeeper/) inside of it.

      You have restored the cluster state data successfully. Now, you can proceed to the Kafka data restoration process in the next section.

      Step 5 — Restoring the Kafka Data

      In this section you will restore the backed up Kafka data to your existing source installation (or the destination server if you have followed the optional Step 7) by deleting the Kafka data directory and restoring the compressed archive file. This will allow you to verify that restoration works successfully.

      You can safely delete the existing Kafka data directory with the following command:

      Now that you have deleted the data, your Kafka installation resembles a fresh installation with no topics or messages present in it. To restore your backed up data, extract the files by running:

      • tar -C /tmp/kafka-logs -xzf /home/kafka/kafka-backup.tar.gz --strip-components 2

      The -C flag tells tar to change to the directory /tmp/kafka-logs before extracting the data. You specify the --strip 2 flag to ensure that the archive's contents are extracted in /tmp/kafka-logs/ itself and not in another directory (such as /tmp/kafka-logs/kafka-logs/) inside of it.

      Now that you have extracted the data successfully, you can start the Kafka and ZooKeeper services again by typing exit, to switch to your non-root sudo user, and then executing:

      • sudo systemctl start kafka

      Start the ZooKeeper service with:

      • sudo systemctl start zookeeper

      Log back in as your kafka user:

      You have restored the kafka data, you can move on to verifying that the restoration is successful in the next section.

      Step 6 — Verifying the Restoration

      To test the restoration of the Kafka data, you will consume messages from the topic you created in Step 1.

      Wait a few minutes for Kafka to start up and then execute the following command to read messages from the BackupTopic:

      • ~/kafka/bin/ --bootstrap-server localhost:9092 --topic BackupTopic --from-beginning

      If you get a warning like the following, you need to wait for Kafka to start fully:


      [2018-09-13 15:52:45,234] WARN [Consumer clientId=consumer-1, groupId=console-consumer-87747] Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)

      Retry the previous command in another few minutes or run sudo systemctl restart kafka as your non-root sudo user. If there are no issues in the restoration, you will see the following output:


      Test Message 1

      If you do not see this message, you can check if you missed out any commands in the previous section and execute them.

      Now that you have verified the restored Kafka data, this means you have successfully backed up and restored your data in a single Kafka installation. You can continue to Step 7 to see how to migrate the cluster and topics data to an installation in another server.

      Step 7 — Migrating and Restoring the Backup to Another Kafka Server (Optional)

      In this section, you will migrate the backed up data from the source Kafka server to the destination Kafka server. To do so, you will first use the scp command to download the compressed tar.gz files to your local system. You will then use scp again to push the files to the destination server. Once the files are present in the destination server, you can follow the steps used previously to restore the backup and verify that the migration is successful.

      You are downloading the backup files locally and then uploading them to the destination server, instead of copying it directly from your source to destination server, because the destination server will not have your source server's SSH key in its /home/sammy/.ssh/authorized_keys file and cannot connect to and from the source server. Your local machine can connect to both servers however, saving you an additional step of setting up SSH access from the source to destination server.

      Download the zookeeper-backup.tar.gz and kafka-backup.tar.gz files to your local machine by executing:

      • scp sammy@source_server_ip:/home/kafka/zookeeper-backup.tar.gz .

      You will see output similar to:


      zookeeper-backup.tar.gz 100% 68KB 128.0KB/s 00:00

      Now run the following command to download the kafka-backup.tar.gz file to your local machine:

      • scp sammy@source_server_ip:/home/kafka/kafka-backup.tar.gz .

      You will see the following output:


      kafka-backup.tar.gz 100% 1031KB 488.3KB/s 00:02

      Run ls in the current directory of your local machine, you will see both of the files:


      kafka-backup.tar.gz zookeeper.tar.gz

      Run the following command to transfer the zookeeper-backup.tar.gz file to /home/kafka/ of the destination server:

      • scp zookeeper-backup.tar.gz sammy@destination_server_ip:/home/sammy/zookeeper-backup.tar.gz

      Now run the following command to transfer the kafka-backup.tar.gz file to /home/kafka/ of the destination server:

      • scp kafka-backup.tar.gz sammy@destination_server_ip:/home/sammy/kafka-backup.tar.gz

      You have uploaded the backup files to the destination server successfully. Since the files are in the /home/sammy/ directory and do not have the correct permissions for access by the kafka user, you can move the files to the /home/kafka/ directory and change their permissions.

      SSH into the destination server by executing:

      • ssh sammy@destination_server_ip

      Now move zookeeper-backup.tar.gz to /home/kafka/ by executing:

      • sudo mv zookeeper-backup.tar.gz /home/sammy/zookeeper-backup.tar.gz

      Similarly, run the following command to copy kafka-backup.tar.gz to /home/kafka/:

      • sudo mv kafka-backup.tar.gz /home/kafka/kafka-backup.tar.gz

      Change the owner of the backup files by running the following command:

      • sudo chown kafka /home/kafka/zookeeper-backup.tar.gz /home/kafka/kafka-backup.tar.gz

      The previous mv and chown commands will not display any output.

      Now that the backup files are present in the destination server at the correct directory, follow the commands listed in Steps 4 to 6 of this tutorial to restore and verify the data for your destination server.


      In this tutorial, you backed up, imported, and migrated your Kafka topics and messages from both the same installation and installations on separate servers. If you would like to learn more about other useful administrative tasks in Kafka, you can consult the operations section of Kafka's official documentation.

      To store backed up files such as zookeeper-backup.tar.gz and kafka-backup.tar.gz remotely, you can explore DigitalOcean Spaces. If Kafka is the only service running on your server, you can also explore other backup methods such as full instance backups.

      Source link

      How to Build an Awesome WooCommerce Store with OceanWP

      Eye appeal is buy appeal. This is an old adage that rings just as true for online stores as it does for physical ones. In order to remain competitive, it’s crucial that your site displays your products in a gorgeous, well-structured fashion on every device. Equally important is ensuring that you can easily manage customer information and payments on the back end.

      Building a website with the OceanWP WooCommerce theme is a perfect way to achieve both of these goals in WordPress. Whatever the nature of your online business, OceanWP will take the guesswork and hassle out of showcasing your products for maximum effect. Better still, since OceanWP offers full integration with the WooCommerce plugin, you can configure, manage, and promote your e-commerce site with ease.

      In this article, we’ll introduce WooCommerce, and discuss why it’s the perfect option for your online store. Then we’ll walk you through how to create a WooCommerce-powered website using OceanWP, and show you a few extensions you can implement to make your store even better. Let’s dive in!

      An Introduction to WooCommerce

      WooCommerce makes setting up your online store a quick, easy, and efficient process.

      WooCommerce is a highly customizable plugin that enables you to turn your WordPress website into an online storefront. It helps you quickly and easily create a catalog of your products, comprised of product descriptions with accompanying images and information. After that, you can let visitors make purchases using several popular payment gateways, including Stripe and PayPal.

      Whether you wish to sell physical products, digital items, services, or some combination of the three, WooCommerce can accommodate your specific needs. It is extremely versatile, and makes the process of organizing products, managing payments, and gathering reports easy (even for e-commerce beginners). There’s a reason why this is the number one e-commerce plugin for WordPress.

      Some of the other key features of WooCommerce include:

      • The ability to display product variations (i.e. different clothing sizes and colors, various software packages, etc).
      • Automatic tax calculations based on country and state rates.
      • Options to display customer ratings and reviews.
      • Functionality that aids in affiliate product promotion.

      Although WooCommerce contains all the back-end functionality you will need to build and run your e-commerce store, you’ll still need a way to showcase your products for maximum effect. That’s where the OceanWP WooCommerce theme comes into play. By combining this versatile theme with WooCommerce, you can drastically improve your chances of making your online business a resounding success.

      Your Store Deserves WooCommerce Hosting

      Sell anything, anywhere, anytime on the world’s biggest e-commerce platform.

      How to Build an Awesome WooCommerce-Powered Store with OceanWP (In 6 Steps)

      OceanWP is a fast, responsive, and highly-customizable WordPress theme. What’s more, it contains numerous templates to help you design a unique e-commerce site. Let’s talk about how to get started!

      Step 1: Install OceanWP and Import Your Chosen Demo

      OceanWP free and premium demos.
      OceanWP offers a wide array of free and premium demos to choose from.

      The first thing you’ll need to do is install and activate the OceanWP theme. It includes a number of demos you can use as the basis for your store. You can pick out one of the e-commerce demos, and then customize it to suit your exact needs.

      To do this, you will first need to install and activate the Ocean Extra plugin. This tool will add all the free demos to your site. After Ocean Extra is installed, you’ll be prompted to set up OceanWP via a simple wizard. Then you can select whatever demo you like. If you’re interested in one of the premium demos, on the other hand, you can access it by purchasing the OceanWP Core Extensions Bundle.

      Step 2: Download and Install WooCommerce

      The WooCommerce setup wizard helps you lay the groundwork for your e-commerce site in minutes.

      Once your theme is activated, you’ll need to set up the WooCommerce plugin if you haven’t already done so.

      You will be directed to the WooCommerce setup wizard, which we recommend going through. It will help you set up all the basic details of your e-commerce business, including your store’s address, the currency you’ll use, and the kinds of products you’ll be selling. You also have the option to choose the units that will be used to measure your products, and to determine how shipping will work. Finally, you also have the choice to integrate WooCommerce with the Jetpack plugin, giving you access to a variety of useful features.

      Once you’ve completed the wizard, you should see a WooCommerce option in the main menu of your WordPress dashboard. You’re now ready to start adding products!

      Step 3: Add Your Products Using WooCommerce

      The OceanWP theme harmonizes perfectly with WooCommerce, letting you build informative and attractive product descriptions.

      By navigating to Products > Add New, you can now start adding wares to your e-commerce store. This intuitive process involves naming the item, writing up a product description, and uploading the corresponding image for the product. You also have the option to add an image gallery to each product. This can be particularly useful if you offer variations on a single item (i.e. a shirt with the same design that’s available in different colors).

      After you’ve input the basic elements above, you can use the WooCommerce Product Data window below the WordPress editor to add in the crucial e-commerce details. This includes the product’s price and tax status, as well as the shipping details (weight, dimensions, post class, etc).

      In addition, you have the option to link additional products to the product description (for upselling or cross-selling applications), and to specify customizable attributes (such as clothing sizes and colors).

      Once you have finished adding and customizing your product pages, you can further enhance them with some of the extra features offered by OceanWP.

      Step 4: Optimize Your Products with OceanWP

      OceanWP lets you optimize your product galleries to grab visitors’ attention.

      At this point, you have a basic but functioning store in place. Now, it’s time to tailor the look and feel of your WooCommerce site to meet your unique needs. When you select a new or existing product, you can scroll down to the OceanWP settings. Here, you can configure everything from the layout of your products to the color of the link text, to the logo you want featured on the page (which is handy if the product you are uploading is associated with a particularly well-known brand).

      OceanWP will also ensure that your product descriptions are optimized for mobile device browsing. Some demos (such as Store) have pre-configured product displays, which you can replace or customize to your liking. More importantly, you can add your product descriptions to your website’s homepage. This can be extremely handy if you want to showcase your latest stock or your most popular products.

      Remember to save your product descriptions as drafts, or publish them once you have finished filling in all the necessary sections. Then, you can assign your products to categories in order to keep them organized.

      Step 5: Build Item Categories

      Categories help customers rapidly find the products they are looking for.

      Using the WooCommerce plugin, you can configure the kinds of product categories you wish to add to your store. Simply navigate to Products > Categories, and you will have access to a number of options.

      For example, you can decide whether you want to have parent categories that contain various subcategories. For example, one parent category might be Menswear, with Jackets and Pants acting as subcategories. You also have the option to add thumbnail images to go along with each category.

      Every category you create will display as a page in OceanWP. If you have chosen an e-commerce demo, you will see that default categories have already been created. You are free to customize those categories as you wish. Visitors will then be able to refine their category searches by filtering results according to price, size, or other parameters you decide to include. This, in turn, will make it easier for them to make purchases.

      Step 6: Tweak Your Cart Display and Checkout Settings

      OceanWP’s multistage checkout streamlines the customer experience on multiple devices.

      OceanWP enables customers to automatically view what’s in their cart whenever a new product is added to it. Better still, the default Mini Cart feature makes it easy for mobile device shoppers to get a clear and concise overview of the products they’ve purchased.

      To make things even easier for your customers, OceanWP also helps you implement a streamlined multistage checkout system. This enables buyers to review their purchases, and select payment and shipping details with even greater ease, no matter what device they’re using.

      Although these WooCommerce-specific features are included by default, you are given the ability to further tweak their appearance using the Elementor page builder (which is bundled with OceanWP). With a little time and patience, you’ll have your e-commerce store looking great and performing perfectly in no time!

      4 OceanWP Extensions to Improve Your WooCommerce Store

      The steps outlined above cover all the building blocks necessary to create an awesome WooCommerce site. To help you further improve your store, however, OceanWP also offers several handy extensions. Once you have purchased an extension, you will receive a license key, which you can activate by navigating to Theme Panel > Licenses.

      Let’s take a look at how each of these extensions can help your e-commerce business go the extra mile.

      1. Woo Popup

      This simple yet effective extension displays a pop-up when one of your customers adds an item to a cart. This pop-up displays the price total (and the number of items in the cart), and gives the customer the choice of continuing to shop or moving on to the checkout screen.

      Using the Woo Popup extension, you can:

      • Enhance the user experience on all devices, by creating a more streamlined shopping experience.
      • Customize the color, size, and text of the pop-up.
      • Reorganize the elements of the pop-up to better match your branding.

      Price: Woo Popup can be used on a single site for $9.99 per year. Alternatively, you can also access it by purchasing OceanWP’s Core Extensions Bundle — licenses start at $39 per year.

      2. Product Sharing

      In order to maximize your client base, you need to ensure that your product descriptions are easily shareable on social media. The Product Sharing extension makes this process quick and easy.

      Using this extension, you can:

      • Add Facebook, Twitter, Pinterest, and email sharing buttons to each product.
      • Customize these sharing buttons to better match your branding.
      • Use a child theme to edit social sharing capabilities

      Price: Product Sharing is free to download and use on your OceanWP site.

      3. Portfolio

      To help your store stand out from the competition, it’s important to show off your products in the most eye-catching way possible. The Portfolio extension enables you to display your wares prominently on any page of your site. You can customize margins, overlay colors, and tweak typography to match your desired aesthetic.

      Using Portfolio, you can:

      • Effortlessly adjust image and column numbers, enabling you to showcase your products in a way that compliments your aesthetic.
      • Assign categories to your portfolio, which can correspond with your product categories.
      • Create an image portfolio that is 100% responsive on virtually any mobile device (you will also have the option to preview what your portfolio will look like on various devices before you publish it).

      Price: The Portfolio extension can be implemented on one site for $9.99 per year, or accessed by purchasing the Core Extensions Bundle.

      4. White Label

      Whatever the nature of your e-commerce store, proper branding is crucial in order to create a rapport with prospective customers. To that end, the White Label extension lets you replace instances of the OceanWP name on your site with your own brand name. It also offers ways to rename elements of your site so that they’re more optimized for search engines.

      Using the White Label extension, you can:

      • Add your brand name to all admin pages.
      • Change the theme name, URL, and description.
      • Replace the theme screenshot with one of your own choosing.

      Price: White Label can be added to a single OceanWP installation for $9.99 per year. It’s also included in the Core Extensions Bundle.

      Are You Ready to Woo?

      Creating a successful e-commerce business requires careful planning, a sound creative vision, and some dedicated work. However, by combining the WooCommerce plugin with the OceanWP WooCommerce theme, you can build a gorgeous online store in no time, and save yourself plenty of hassle and frustration in the process.

      Source link