1. Documentation /
  2. Buy Once or Subscribe for WooCommerce Subscriptions | Developer Hooks and Filters

Buy Once or Subscribe for WooCommerce Subscriptions | Developer Hooks and Filters

Filter for changing the BOS products query attributes

↑ Back to top

Description:
bos4w_product_query_args – contains the query attributes used in wc_get_products() function.

Usage:

add_filter( 'bos4w_product_query_args', function( $prod_args ) { 
   // custom code  <br>
   return $prod_args; 
}, 10, 1 );

Attributes:
$prod_args – wc_get_products() query attributes.

Filter for changing the “Select options” button text

↑ Back to top

Description:
bos4w_add_to_cart_text – allow text change on the “Select options” button.

Usage:

add_filter( 'bos4w_add_to_cart_text', function custom_switch_item_text( $button_text, $product ) {
   return 'Select options';  
}, 10, 2);

Attributes:
$button_text – The button text.
$product – Product object.

Filter for using the regular price instead of the sale price when the product is bought as a subscription

↑ Back to top

Description:

bos_use_regular_price – allows the use of the product’s regular price instead of the sale price. The default is set to false.

add_filter( 'bos_use_regular_price', function( $use_regular_price ) {
   // custom code
   return $use_regular_price;
}, 10, 1 );

Attributes:

$use_regular_price – bool true/false.

Filter for editing the text next to the price when a product has a Subscription frequency set

↑ Back to top

Description:

bos4w_subscription_text_display – allows editing of the “or subscribe and save up to” text.

add_filter( 'bos4w_subscription_text_display', function ( $display_text ) {
   // custom code
   return $display_text;
}, 10, 1 );

Attributes:

$display_text – String to display

Change the text, interval and discount display in the frequency dropdown

↑ Back to top

Description:
ssd_subscription_plan_display – change the text, interval and discount display in the subscription dropdown options on the product page.

Usage:

add_filter( 'ssd_subscription_plan_display', function( $option_text, $period_interval, $discounted_price, $display_discount ) {
   return $option_text;  
}, 10, 4);

Attributes:
$option_text – The discount select text.
$period_interval – Period interval.
$discounted_price – The discounted price.
$display_discount – The discount percentage.

Change the text and discount display in the radio button for the subscription purchase option

↑ Back to top

Description:
bos4w_and_save_up_to_text – change the text and discount for the radio button for the subscription purchase option displayed on the product page

Usage:

add_filter('bos4w_and_save_up_to_text', function($text,$discount) {
   $text = 'Custom text be added';
   return $text;
}, 10, 2);

Attributes:
$text – Radio option text.
$discount – highest discount set for the product.

WooCommerce

The most customizable ecommerce platform for building your online business.

  • 30-day money-back guarantee
  • Support teams across the world
  • Safe and secure online payment