Code Snippets

Change “/Products” In The Product Page URL

add_filter( 'sc-cart-cpt-options', function($opts){
if($opts['labels']['name'] == 'Products') {
$opts['rewrite']['slug'] = 'custom label here';
}
return $opts;
});

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’, ‘mytheme_change_cod_label’, 10, 2);
  function mytheme_change_cod_label($payment_methods, $post_id ) {
    if(isset($payment_methods[‘cashondelivery’])) {
       $payment_methods[‘cashondelivery’][‘label’] = ‘Custom Label Here’;
    }
    return $payment_methods;
 } 

Change Subscription Summary Text “And” To “For”

Example: $XX / month with a XX-day trial for $XX sign-up fee

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 ''; })

Change Subscription Summary Text “With” To “After”

Example: $XX / month after XX-day trial for $XX sign-up fee

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;
}

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;
}