Change “/Products” In The Product Page URL
add_filter( 'register_sc_product_post_type_args', '_my_rewrite_slug' ); function _my_rewrite_slug( $args ) { $args['rewrite']['slug'] = 'our-services'; // Replace "our-services" with your preferable slug return $args; }
Change Sign-up Fee Label
add_filter('sc_plan_text_sign_up_fee', function(){ return 'custom label here';});
Change Sign-up Fee Label In Subscription Summary
add_filter('sc_plan_text_sign_up_fee', function($str){ return 'custom label here'; });
Change Cash On Delivery Label
add_filter('sc_payment_methods', 'yourtheme_change_cod', 99, 2); function yourtheme_change_cod($payment_methods, $post_id) { if(isset($payment_methods['cashondelivery'])){ $payment_methods['cashondelivery']['label'] = 'In Person Payment'; } return $payment_methods; }
Change trial and sign-up fee text in the checkout form subscription summary
Example: $XX / month after XX-day trial for $XX – cancel any time.
add_filter('sc_plan_text_with_a', function($str){ return 'after'; }); add_filter('sc_plan_text_day_free_trial', function($str){ return '-day trial'; }); add_filter('sc_plan_text_and_a', function($str){ return 'for'; }); add_filter('sc_plan_text_sign_up_fee', function($str){ return ' - cancel any time.'; });
Add “After” And “For” To Subscription Summary Text On Default Thank You Page
Example:
$XX / month
after XX-day trial
for $XX
remove_filter('sc_format_subcription_order_detail','sc_filter_format_subcription_terms_text', 10); add_filter('sc_format_subcription_order_detail','mytheme_format_subcription_order_detail', 10, 6); function mytheme_format_subcription_order_detail($text, $terms, $trial_days=false, $sign_up_fee=false, $discount=false, $discount_duration=false) { if(!$terms) { return $text; } if($trial_days) { // (e.g. "5-day trial") $terms .= '<br>after ' . $trial_days . '-day trial'; } if ($sign_up_fee) { // (e.g. "$5 sign-up fee") $terms .= '<br>for ' . sc_format_price($sign_up_fee); } if ($discount && $discount_duration) { // (e.g. "Discount: 5% off for 3 months") $terms .= '<br><strong>'.__('Discount:','ncs-cart').' </strong> '; $terms .= sprintf(__('%s off for %d months','ncs-cart'), sc_format_price($discount), $discount_duration); } return $terms; }
Add “Cancel Anytime” To Subscription Summary Text
Example: $XX / month with a XX-day trial for $XX sign-up fee. Cancel anytime.
add_filter('sc_plan_text_day_free_trial', function($str){ return '-day trial'; }); add_filter('sc_plan_text_and_a', function($str){ return 'and'; }); add_filter('sc_plan_text_sign_up_fee', function($str){ return 'sign-up fee. Cancel anytime.'; });
Change Credit Card Label
add_filter('sc_payment_methods', 'sc_payment_method_custom', 10, 2); function sc_payment_method_custom($payment_methods, $post_id){ $payment_methods['stripe']['label']= 'any text you want'; return $payment_methods; }
Move Custom Fields To Display Above Default Fields On Checkout Form
remove_action('sc_checkout_form_fields', 'sc_custom_fields', 10, 2); add_action('sc_card_details_fields', 'sc_custom_fields', 2, 2);
Show Products in Product Category and Tag Archives
add_filter('sc-cart-cpt-options', 'mytheme_product_cpt_options'); function mytheme_product_cpt_options($opts){ if($opts['labels']['singular_name'] == 'Product'){ $opts['exclude_from_search'] = false; } return $opts; }
Limit Country Codes
Note: Country codes are located in the ncs-cart-countries.php file.
app>public>wp-content>plugins>studiocart>includes>ncs-cart-countries.php
add_filter( 'sc_countries', 'yourtheme_countries' ); function yourtheme_countries($countries) { return array( "GB" => "United Kingdom" "US" => "United States" ); }
Send Phone Field To Mailchimp
add_filter(‘sc_mailchimp_merge_data’,‘mytheme_add_phone_to_mc’, 10, 2); function mytheme_add_phone_to_mc($data, $order_id) { if ($phone = get_post_meta($order_id, ‘_sc_phone’, true)){ $data[‘MC_FIELD_TAG’] = $phone; } return $data; }