1. Documentation /
  2. One-click Switch

One-click Switch

Installation

↑ Back to top
  1. Check that you have the required plugins: Woocommerce and Woocommerce Subscriptions.
  2. Go to Plugins and click on Add New.
  3. Upload the plugin zip file and click on install.
  4. Activate the plugin.

Configuration

↑ Back to top
  1. Go to Products and click on Create New.
  2. Create a simple subscription type of product.
  3. Create another one or more simple subscription type of products with different terms that is meant for the same product or service.
  4. Go back to Create New button under Products.
  5. Create a grouped type of product.
  6. Go the Linked Products tab under the Woocommerce settings.
  7. Add the simple subscriptions you created inside the Grouped input box in the Linked Products tab.

Usage

↑ Back to top
  1. Go back to the grouped product you created where you linked all the simple subscriptions.
  2. Notice a new tab was created by the Switching Plugin called Subscription Switch. Go to this tab.
  3. You can enable the user interface of the switching plugin by either (1) using the shortcode provided in the tab or (2) by clicking on the Show One-page Switch checkbox and saving the product.
  4. The first option enables you to display it on any page that you want.
  5. The second option enables you to use the same product page allowing for a normal Woocommerce flow.

Developer

↑ Back to top

Filter: thsa_sswtch_switching_texts Accepted arguments in order (2):

  1. Type: Array. Texts and Hexa Decimal (colours) texts returned to display in the user interface. Available indexes: – [‘theme_color’] – [‘button_colors’][‘active_plan_button_color’] – [‘button_colors’][‘available_plan_button_color’] – [‘button_colors’][‘onhold_plan_button_color’] – [‘switch_btn_text’] – [‘switch_alert’] – [‘switch_info’] – [‘switch-small_text’]
  2. Type: Array. Returns the user status to be able to display different texts depending on the user status. Available indexes: – [‘subscription_id’] – [‘start_date’] – [‘status’] – [‘product_id’] – [‘has_trial’] – [‘trial_period’] – [‘trial_remaining’]

Sample usage in functions.php of your theme:

function edit_language_switch($text_array, $user_status){
	
	if($user_status['status'] === "on-hold"){
		$text_array['switch_info'] = "Update your payment to activate this subscription again.";
	}

	return $text_array;

}

add_filter('thsa_sswtch_switching_texts', 'edit_language_switch', 10, 2);

 

You can find more info here.