/**
* 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 Obtain a Minnesota Certificate of Good Standing -
Skip to content
How To Obtain A Minnesota Certificate of Good Standing.
If you want to form a contract with another company or open a new line of credit with the bank, you might be asked to provide a Minnesota certificate of good standing (CGS).
This document proves you are properly registered with the state and are up to date on all your business filings. As the name suggests, it shows you’re in “good standing” with the Minnesota Secretary of State.
A certificate of good standing is a legal document proving that a business exists and is in compliance with state law. In Minnesota, certificates of good standing are issued by the Secretary of State.
Apply for a Minnesota Certificate of Good Standing!
Need help applying for a certificate of good standing in Minnesota?
A certificate of good standing proves that your business is on solid ground with the Minnesota Secretary of State. But what’s actually in the document?
The language in a Minnesota certificate of good standing indicates that your business has:
Filed an annual report
Paid all necessary fees to the Secretary of State’s office
Paid franchise tax fees (if applicable)
When Do I Need to Provide a Certificate of Good Standing?
A certificate of good standing is not a business license. You don’t need one to conduct business in Minnesota (but you do need to be properly registered with state).
Rather, you may be asked to provide a certificate of good standing if you want to:
Which Types of Business Entities Can Request a CGS?
To stay in good standing, certain business entities (including corporations and LLCs taxed as S corporations) must submit an annual report on time each year, pay their franchise tax fees (if applicable), and pay all the necessary fees to the Secretary of State’s office.
In general, business entities that must register to operate in the state of Minnesota can request a certificate of good standing. This includes:
For-profit corporations
Nonprofits
Limited liability companies (LLCs)
Limited partnerships (LPs)
Limited liability partnerships (LLPs)
Sole proprietorships and general partnerships that conduct business under an assumed name (DBA)
Sole proprietorships operating under the owner’s name don’t require registration and can’t submit a CGS.
It’s not a bad idea to have a certificate of good standing on hand, especially if you’re trying to woo a potential business partner or planning to open a business bank account or apply for public funding.
These are all instances where you may be asked to provide a CGS. You don’t need to prove that someone has requested a certificate of good standing in order to obtain one from the Minnesota Secretary of State.
But keep in mind that only businesses that are required to register with the state can request a certificate of good standing. If your business isn’t registered, you won’t be able to obtain a CGS.
But, in this case, you shouldn’t need one either. If someone asks you for a CGS and your business isn’t required to register, explain why you can’t provide it. The person/entity may not be aware that only registered businesses can request a certificate of good standing.
How Do I Comply with Minnesota Requirements to Get a CGS?
Only registered businesses that are in compliance with state laws can obtain a Minnesota certificate of compliance. To comply with the law, you need to:
Have the right business licenses and permits – Check with the Secretary of State to learn which ones you need.
Pay your taxes and state fees – This includes sales tax, unemployment insurance tax, franchise tax, and any other required Minnesota taxes.
File your annual renewal – This form, known in other states as an annual report, is due at the end of each year and keeps the Secretary of State updated on key information about your business.
If you request a CGS online, the fee is $15. If you request a CGS in person or by mail, the fee is $5.
How long will it take to get my Minnesota Certificate of Good Standing?
Minnesota certificates of good standing are usually processed the same day. If you submit your request by mail, it will take 2-5 business days to process, plus mailing time. In-person requests take around 1 hour.
Is a CGS required to stay compliant in Minnesota?
You don’t need a certificate of good standing to be compliant with Minnesota’s business laws. But to obtain a CGS, your business needs to be compliant. This means paying your taxes and fees on time, completing your annual renewals, and obtaining the appropriate licenses and permits.