/**
* When a formidable form submitted, add form's connected product to cart.
*/
add_action('frm_after_create_entry', 'ff_take_user_to_wc_checkout_for_payment', 20, 2);
function ff_take_user_to_wc_checkout_for_payment($entry_id, $form_id) {
$linked_products = get_posts([
'post_type' => 'product',
'post_status' => 'publish',
'numberposts' => 1,
'meta_key' => '_attached_formidable_form',
'meta_value' => $form_id,
'cache_results' => false,
]);
if (empty($linked_products)) {
return;
}
$product_id = $linked_products[0]->ID;
if (!function_exists('WC') || !WC()->session) {
return;
}
if (method_exists(WC()->session, 'set_customer_session_cookie')) {
WC()->session->set_customer_session_cookie(true);
}
WC()->cart->empty_cart();
$entry = FrmEntry::getOne($entry_id, true);
$form_data = $entry->metas;
$addon_total = 0;
foreach ($form_data as $value) {
if (is_string($value) && strpos(trim($value), '$') === 0) {
$price = floatval(str_replace(['$', ','], '', $value));
$addon_total += $price;
}
}
WC()->session->set('addon_total', $addon_total);
WC()->cart->add_to_cart($product_id, 1, 0, [], ['addon_total' => $addon_total]);
if (empty($_POST['frm_ajax'])) {
wp_safe_redirect(wc_get_checkout_url());
exit;
}
}
/**
* When an item is added to the cart, remove other products.
*/
add_filter( 'woocommerce_add_to_cart_validation', 'ff_keep_only_one_product_in_the_cart', 10, 3 );
function ff_keep_only_one_product_in_the_cart( $valid, $product_id, $quantity ) {
if( ! empty ( WC()->cart->get_cart() ) && $valid ) {
WC()->cart->empty_cart();
}
return $valid;
}
/**
* Disable add to cart confirmation message.
*/
add_filter( 'wc_add_to_cart_message_html', '__return_false' );
/**
* Redirect user to checkout page after adding a product to cart.
*/
add_filter ('add_to_cart_redirect', 'ff_redirect_to_checkout');
function ff_redirect_to_checkout() {
global $woocommerce;
$checkout_url = $woocommerce->cart->get_checkout_url();
return $checkout_url;
}
/**
* Calculate formidable add-on prices and add them to the total price in WC checkout.
*/
add_action('woocommerce_before_calculate_totals', 'ff_apply_addon_total_to_cart_price', 10, 1);
function ff_apply_addon_total_to_cart_price($cart) {
if (is_admin() && !defined('DOING_AJAX')) {
return;
}
foreach ($cart->get_cart() as $cart_item) {
if (!empty($cart_item['addon_total'])) {
$base_price = $cart_item['data']->get_price();
$addon_price = floatval($cart_item['addon_total']);
$cart_item['data']->set_price($base_price + $addon_price);
}
}
}
/**
* Use different Authorize.net accounts in checkout.
*/
add_filter( 'option_woocommerce_authorizeaim_settings', function( $woocommerce_authorizeaim_settings ) {
global $woocommerce;
if ( function_exists( 'is_checkout' ) && function_exists( 'get_field' ) && is_checkout() ) {
foreach ( $woocommerce->cart->get_cart() as $cart_item ) {
$product_id = $cart_item['product_id'];
$api_login_id = get_post_meta( $product_id, 'api_login_id', true );
$transaction_key = get_post_meta( $product_id, 'transaction_key', true );
if ( !empty( $api_login_id ) && !empty( $transaction_key ) ) {
$woocommerce_authorizeaim_settings['login_id'] = $api_login_id;
$woocommerce_authorizeaim_settings['transaction_key'] = $transaction_key;
break;
}
}
}
return $woocommerce_authorizeaim_settings;
} );
/**
* When placing a new WC order by submitting formidable,
* set order's customer detail according to the submitted information.
*/
add_action( 'woocommerce_new_order', 'ff_update_customer_data', 10, 2 );
function ff_update_customer_data($order_id,$order){
$postdata = $_POST;
$email = $postdata['la_email'];
$username = $postdata['la_email'];
$args = array(
'user_email' => $email,
'display_name' => $postdata['la_first_name'],
'first_name' => $postdata['la_first_name'],
'last_name' => $postdata['la_last_name']
);
$userdata = wc_create_new_customer($email,$username,'',$args);
$userdata = json_decode(json_encode($userdata), true);
if(isset($userdata['errors'])){
$customer = get_user_by('email',$email);
if($customer){
$user_id = $customer->ID;
}
}else{
$user_id = $userdata;
update_user_meta($user_id, "first_name",$postdata['la_first_name']);
update_user_meta($user_id, "last_name",$postdata['la_last_name']);
}
$address = array(
'first_name' => $postdata['la_first_name'],
'last_name' => $postdata['la_last_name'],
'email' => $email,
'phone' => $postdata['la_ower_phone'],
'address_1' => $postdata['la_buisiness_adddress_1'],
'address_2' => $postdata['la_buisiness_adddress_2'],
'city' => $postdata['la_buisiness_adddress_city'],
'state' => $postdata['la_buisiness_adddress_state'],
'postcode' => $postdata['la_buisiness_adddress_zipcode'],
'country' => 'US'
);
$order = new WC_Order($order_id);
$order->set_customer_id($user_id);
$order->set_address($address, 'billing');
$order->set_address($address, 'shipping');
$order->save();
}
/**
* Link formidable entry with woocommerce order. -- ⇩⇩⇩ --
*/
// 1. Store formidable entry ID in the customer session.
add_action( 'frm_after_create_entry', function( $entry_id, $form_id ) {
WC()->session->set( 'frm_entry_id', $entry_id );
}, 20, 2 );
// 2. Set formidable entry id from session to the order as an order meta.
add_action( 'woocommerce_checkout_create_order', function( $order, $data ) {
if ( $entry_id = WC()->session->get( 'frm_entry_id' ) ) {
$order->update_meta_data( '_frm_entry_id', $entry_id );
}
}, 10, 2 );
// 3. Display the link to the formidable entry on the order details page.
add_filter( 'woocommerce_order_item_display_meta_key', function( $display_value, $meta ) {
if ( $meta->key == '_formidable_form_data' ) {
$display_value = __( 'Formidable Entry', 'formidable-woocommerce' );
}
return $display_value;
}, 10, 2 );
How to Legally Sell Marijuana in California | Fast Filings
Skip to content
How to Legally Sell Marijuana in California
California state law allows individuals to open cannabis dispensaries, but doing so requires strict adherence to both state and local regulations. Before you can open your doors, you’ll need to obtain a valid California seller’s permit to collect and remit sales tax. You must also secure the proper state cannabis license, as well as obtain local authorization and meet operational, zoning, and environmental requirements.
In this guide, we reveal what’s needed in order to legally operate your retail marijuana business in the Golden State.
Who Can Buy Marijuana Legally in California?
Those who plan to start a business in selling marijuana legally are required to know who they can legally sell to.
Any customer who obtains cannabis from you must:
Be 21 years of age or older (or 18+ with a valid medical marijuana card)
Not purchase more than 28.5 grams of unconcentrated cannabis
Not purchase more than 8 grams of concentrated cannabis
Customers must provide a valid, government-issued photo ID at the time of purchase or delivery. All sales are logged in the state’s tracking system to ensure compliance with purchase limits and age restrictions.
Apply for a California Seller's Permit!
Need help filing your seller's permit in California?
To open a licensed cannabis business, you must have at least one owner responsible for submitting the application to the Department of Cannabis Control (DCC). An “owner” is defined as someone who meets any of the following:
Holds a 20% or greater ownership interest
Serves as the CEO or equivalent of the entity
Is a board member of a nonprofit organization
Exercises control over or participates in the direction, control, or management of the business
Each owner is subject to background checks and must provide required disclosures.
Starting a dispensary in California requires compliance with both local and state regulations. Before applying for a state cannabis license, you must first obtain authorization from the city or county where you plan to operate. This often includes land-use approvals, zoning verification, and community engagement requirements.
Once you have local approval, you’ll need to:
Secure a compliant location that meets state and local zoning laws
Prepare a business plan (often required by local agencies)
Apply for the appropriate state license from the Department of Cannabis Control (DCC)
California offers two main license types for retail cannabis:
Type 9 – Non-storefront retailer (delivery-only)
Type 10 – Storefront retailer (walk-in dispensary)
You’ll also need:
A California seller’s permit from the Department of Tax and Fee Administration (CDTFA) for sales tax purposes
A $5,000 surety bond payable to the State of California
While the state issues cannabis licenses, local jurisdictions provide required approvals, which are typically related to zoning, public safety, and land use.
Other Required Information
When applying, you must submit information such as:
The business’s legal structure and ownership details
Your Social Security Number (SSN) or Federal Employer Identification Number (EIN)
Evidence of compliance with CEQA (California Environmental Quality Act)
A statement confirming that your premises is not located within 600 feet of a school, daycare, or youth center (unless your local jurisdiction allows otherwise)
How Do I Start a Dispensary for a Specific Type of Use?
To sell cannabis legally, you must obtain a state cannabis retailer license for either:
Adult-use (A-license)
Medicinal-use (M-license)
If you want to serve both recreational and medical customers, you’ll need to apply for both license types.
Since each city or county sets its own rules regarding cannabis businesses, it’s critical to verify local requirements before applying. Failure to obtain local approval can prevent or delay your state license, even if you’re otherwise qualified.
California Weed Growing Laws
Adults 21 and older can grow up to six cannabis plants at home in California for personal use. The plants must be kept in a locked, enclosed area and not visible from public spaces. Landlords and rental agreements may still prohibit growing on the property.
Commercial cultivation, harvesting, and other processing require a state license. The type of license depends on the size of the operation and the method of cultivation—indoor, outdoor, or mixed light.
To grow cannabis for commercial purposes, California weed laws require you to have:
Local government approval
A valid cultivation license from the Department of Cannabis Control
Compliance with zoning and environmental rules
Documentation showing legal access to the property
Background checks for owners and key staff
A system to track plants and inventory
Growing Is Not the Same as Selling
A cultivation license is only part of what you’ll need to open a dispensary. Although it allows you to grow cannabis, it does not allow direct sales to consumers. You must apply for separate licenses to distribute cannabis for retail. Having a cultivation license will not reduce fines or protect you from criminal charges if you sell marijuana without the proper license.
Yes, cannabis products can be sold online in California—but only through licensed dispensaries. Online orders must be fulfilled and delivered by a retailer with a valid California cannabis license.
All sales and deliveries must follow cannabis e-commerce laws. That includes strict rules for age checks, product tracking, and delivery procedures.
Requirements for online cannabis sales in California include:
The seller must hold a current state retail license
Deliveries must be made by authorized drivers directly employed by the license holder
All buyers must be 21 or older and show ID at delivery
Products must be stored, labeled, and transported according to state regulations
Sales must be recorded and tracked through the state’s traceability system
Third-party apps may facilitate orders, but they cannot own or profit from the cannabis itself
Any platform offering cannabis delivery must follow marketing, payment, and data privacy rules
Businesses looking to expand into online sales need to follow the same rules as storefront dispensaries. Selling outside this system violates state law and puts your license at risk.
How to Start Selling Weed by Getting Your Seller’s Permit Today
If you’re ready to start selling cannabis but still don’t have your CA seller’s permit, you’ll be happy to know that you can get it fast when you use FastFilings. We prepare all of your needed documents and items, and we include a prepaid express mailer so you can get your permit quickly and easily.