Important note: Greenline currently only supports connecting to one WooCommerce store at a time. If multi-location support is important for your business, we suggest considering Buddi or Dutchie.

WooCommerce connections from Greenline cost an additional $150/month. Contact us to enable the feature for your account.

Your WordPress server

Greenline can only communicate with WooCommerce stores with full SSL/HTTPS encryption supported. If you're on HTTP, please contact your web administrator to set up the encryption.

In your WooCommerce settings, check the following:

  • Your units are in grams

API Key setup

  1. Go to your Greenline Dashboard and select Integrations > Overview from the dropdown menu on the left side of your screen.

  2. Find the WooCommerce block.

  3. Click the "Activate the integration" toggle on.

    1. This will allow WooCommerce access to the Allowed Permissions which can be viewed by clicking the blue "Show" link.

  4. An email will automatically be populated to the Greenline onboarding team to complete the connection. Click send to email this to the appropriate representative.

  5. Once the integration is activated, you will now see a "WooCommerce" tab in your Integrations dropdown on your Dashboard.

Note: If the "Activate the integration" button is toggled off, WooCommerce will no longer have access to your POS information.



Greenline supports WooCommerce REST API v2. Generate your REST API keys here:


Make sure that you provide read and write permissions. Note down the client key and secret, as they will not be made available to you after this screen. On Greenline, copy/paste the fields under Dashboard > Integrations > WooCommerce > Settings.


Make sure that you have an attached inventory location - this is where the inventory sync will pull its values from.

Sales webhook setup (for payments handled online)

When a sale is made on WooCommerce, you want the sale to show up on Greenline so that the inventory is correctly removed. To do that, go to Dashboard > Integrations > WooCommerce > Settings, and copy/paste the provided webhook url. Paste that webhook into your WooCommerce API settings page as seen below:

The webhook url goes into the Delivery URL  field. Make sure that you set the status to be Active , and the topic to be Order updated . The API version should be V2. Adding a sale will remove inventory from Greenline.

Sales webhook setup (for payments handled in-store)

Follow the same steps as above for payments handled online, but change the webhook url from ending in /order  to /pickup . Set the webhook topic to be Order created . This will push the order data to Greenline's parked sales queue, which is accessible from any POS device.

If your store is setting up an order ahead system, here are a few things to keep in mind:

  • Inventory will NOT be removed until the sale is completed.

  • The order number shown on Greenline's parked sales list will be the same as the WooCommerce order ID. The customer should bring a proof of order.

  • WooCommerce emails should be your store's main source of pickup notifications.

30 gram purchase limits

Customers should not be able to purchase more than 30 equivalent grams of dried cannabis. In Greenline, pay attention to the cannabis weight field in the advanced  section per product. If a product is attached to a compliance category and has a cannabis weight field, that field will be synced to WooCommerce as a custom field and contribute to the 30 gram weight limit. Custom fields can be seen by toggling the screen option:

Note that Greenline's "net product weight" field will be used as the official WooCommerce weight. This is to cover products such as edibles, where the product weight is very different from the dried equivalent weight.

In your theme's functions.php file, add the following snippets:

// Block over-limit carts from checking out
add_action('woocommerce_after_checkout_validation', 'deny_checkout_if_weight');
function deny_checkout_if_weight( $posted ) {
global $woocommerce;
$max_cannabis_weight = 30;
if ( $woocommerce->cart->cart_contents_weight > $max_cannabis_weight ) {
  $notice = 'Sorry, your cart has exceeded the maximum allowed weight of ' . $max_cannabis_weight . get_option('woocommerce_weight_unit');
  wc_add_notice( $notice, 'error' );
}
}

// Update cart validation - add an error message when quantities are updated to exceed the limit
add_filter( 'woocommerce_update_cart_validation', 'checkout_cart_item_quantity_validation', 10, 4);
function checkout_cart_item_quantity_validation($passed, $cart_item_key, $values, $quantity) {
$max_cannabis_weight = 30;
$cartTotalWeight = 0;
$product_id = $values['data']->get_id();

$items = WC()->cart->get_cart();
foreach($items as $item => $productvalues) {
$productId = $productvalues['data']->get_id();
if ($product_id === $productId) {
continue;
}
$product_cannabis_weight_float = get_product_cannabis_weight($productId);
$current_product_total_weight = $productvalues['quantity'] * $product_cannabis_weight_float;
$cartTotalWeight = $cartTotalWeight + $current_product_total_weight;
}

$product_cannabis_weight = get_product_cannabis_weight($product_id);
$product_total_cannabis_weight = $quantity * $product_cannabis_weight;

$cartTotalWeight = $cartTotalWeight + $product_total_cannabis_weight;

    if ( $cartTotalWeight > $max_cannabis_weight ) {
        $passed = false ;
        $message = __( "Your order exceeds the cannabis limit weight of " . $max_cannabis_weight . ". Current weight: " . $cartTotalWeight, "woocommerce" );
        wc_add_notice( $message, 'error' );
    }
    return $passed;
}

// Add to cart validation - Add an error message when total weight exeeds a limit
add_filter( 'woocommerce_add_to_cart_validation', 'custom_price_field_add_to_cart_validation', 20, 5 );
function custom_price_field_add_to_cart_validation( $passed, $product_id, $quantity, $variation_id = null, $variations = null ) {
$max_cannabis_weight = 30;
$cartTotalWeight = 0;

// Get the cannabis weight for all the products current in the cart
    $items = WC()->cart->get_cart();
foreach($items as $item => $values) {
$productId = $values['data']->get_id();
$cannabis_weight_float = get_product_cannabis_weight($productId);

$product_total_can_weight = $values['quantity'] * $cannabis_weight_float;
$cartTotalWeight = $cartTotalWeight + $product_total_can_weight;
}

// If no variation_id for filter, allow to pass through
if (empty($variation_id)) {
return $passed;
}

// Calculate the cannabis weight for product and quantity being added
$cannabis_weight_float = get_product_cannabis_weight($variation_id);
$addintocart = $quantity * $cannabis_weight_float;
$totalCannabisWeight = $cartTotalWeight + $addintocart;

    if ( $totalCannabisWeight > $max_cannabis_weight ) {
        $passed = false ;
        $message = __( "Your order exceeds the cannabis limit weight of " . $max_cannabis_weight . ". Current weight: " . $totalCannabisWeight, "woocommerce" );
        wc_add_notice( $message, 'error' );
    }
    return $passed;
}

function get_product_cannabis_weight($product_id) {
$product_cannabis_weight = get_post_meta( $product_id, 'cannabis_weight', true );
if (is_null($product_cannabis_weight)) {
        return 0;
} else {
$product_cannabis_float = (float)$product_cannabis_weight;
return $product_cannabis_float;
}
}

// Display the cart item weight in cart and checkout pages
// Optional
add_filter( 'woocommerce_get_item_data', 'display_custom_item_data', 10, 2 );
function display_custom_item_data( $cart_item_data, $cart_item ) {
$product_id = $cart_item['data']->get_id();
    if (!empty($product_id)){
        $cart_item_data[] = array(
            'name' => __( 'Weight', 'woocommerce' ),
            'value' =>  ( (int) $cart_item['quantity'] * (float) $cart_item['data']->get_weight() ) . 'g'
        );
    }


$product_cannabis_weight = get_product_cannabis_weight($product_id);

if ( $product_cannabis_weight > 0 ){
        $cart_item_data[] = array(
            'name' => __( 'Cannabis weight', 'woocommerce' ),
            'value' =>  ((int) $cart_item['quantity'] * $product_cannabis_weight) . 'g'
        );
    }
    return $cart_item_data;
}

On a basic Shopkeeper theme installation, the errors will look like the following:

Sync your products

Product syncing is done from the Dashboard > Integrations > WooCommerce > Products page. Here, you will see all of the products and variants available to sync.

Products are matched up between Greenline and WooCommerce using unique SKU values generated by your store. When creating/editing products, please ensure the existence of unique SKUs for all parent products and variants. To simplify the process, you can click the name of a product on this page to go straight to the edit page.

There is a difference between syncing products and syncing inventory.

Syncing products
This will replace your WooCommerce product data with your Greenline data. If you've made a price change on Greenline, or you've updated your product image, you will want to sync your product.

Syncing inventory
Often, you may want a different presentation for your product online vs in-store. For example, you have mark up the price of a product online, show a different description, put the product in a different online-only category etc. Those changes can be made on WooCommerce, and will not reflect on Greenline. Syncing inventory will keep all the custom changes you've made, and only update the quantities in-stock.

Inventory syncs between Greenline and WooCommerce in real-time constantly in the background. For example, if you perform an audit, or if you make a sale, the inventory in Greenline will automatically update the respective product on WooCommerce. You should rarely have to manually sync inventory, if at all.

Setting up Merrco credit card processing

To accept online credit card payments, you must add a payment gateway to your WooCommerce installation. This guide will be going over Merrco - if you use Moneris or any other payment provider, please consult their technical staff for assistance.

To start, install the Merrco plugin from here:

https://woocommerce.com/products/paysafe-payment-gateway/

Make sure you enable the Merrco payment gateway. You can test your transactions by enabling "Enable test mode"

Once in test mode, you can use the following test card numbers to test transactions:
https://developer.paysafe.com/en/rest-apis/cards/test-and-go-live/test-cards/

FAQ

What payment methods are supported?
We support all payment methods that are supported by WooCommerce. We suggest credit cards through either Merrco or Moneris - contact your IT staff or Greenline for help with setup.

If I update my product on Greenline, does my WooCommerce product automatically update?
At the moment, no. Users must go to Dashboard > Integrations > WooCommerce > Products to sync the product changes manually.

How can I stop my products/inventory from syncing?
You can simply go to your Dashboard > Integrations > WooCommerce > Settings page, and clear your url, key, and secret.

What happens if I edit my order on WooCommerce?
If an order is edited (ex. promo product added, customer service decides to include goodies etc.), those changes will not be reflected on Greenline. In cases of manual order editing, we advise the changes to be manually logged in Greenline's master inventory screen.

Should I accept orders on Greenline or WooCommerce?
We suggest using Greenline as the source of truth for inventory and WooCommerce to be source of truth for everything else. View, accept, and respond to orders directly on WooCommerce.

Did this answer your question?