Skip to content

Instantly share code, notes, and snippets.

@thadallender
Created April 16, 2014 19:37
Show Gist options
  • Select an option

  • Save thadallender/10924480 to your computer and use it in GitHub Desktop.

Select an option

Save thadallender/10924480 to your computer and use it in GitHub Desktop.
Customize Localized Sell Media Text
function my_set_add_to_cart_button() {
global $wp_scripts;
$data = $wp_scripts->get_data( 'sell_media', 'data' );
if( !is_array( $data ) ) {
$data = json_decode( str_replace( 'var sell_media = ', '', substr( $data, 0, -1 ) ), true );
}
$data['added_to_cart'] = 'New Add Cart Button Text';
$wp_scripts->add_data( 'sell_media', 'data', '' );
wp_localize_script( 'sell_media', 'sell_media', $data );
}
add_action( 'sell_media_scripts_hook', 'my_set_add_to_cart_button' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment